+  HandyCache форум
|-+  Главная категория» Общие вопросы» Bug hc.execute_and_wait
Имя пользователя:
Пароль:
Страниц: [1]   Вниз
  Отправить эту тему    Печать  
Автор Тема: Bug hc.execute_and_wait  (Прочитано 2455 раз)
0 Пользователей и 1 Гость смотрят эту тему.
truefriend-cz
Постоялец
***

Репутация: +3/-1
Offline Offline

Сообщений: 118


« : 25 августа 2017, 12:12:11 »

I have problem not running all exe files:

Код:
hc.execute_and_wait([["D:\123\WinContig\WinContig.exe"]])

Notepad is running no problems, but any other exe not running.

Do you know alternative?
Сообщить модератору   Записан
hc.addict
Новичок
*

Репутация: +1/-0
Offline Offline

Сообщений: 21


« Ответ #1 : 26 августа 2017, 13:43:19 »

Try:

Код:
hc.execute_and_wait('D:\\123\\WinContig\\WinContig.exe')
Сообщить модератору   Записан
truefriend-cz
Постоялец
***

Репутация: +3/-1
Offline Offline

Сообщений: 118


« Ответ #2 : 26 августа 2017, 15:08:51 »

You solution i find on this forum, but not ok.

Sorry, any variant not functioning:

Код:
hc.execute_and_wait('D:\\123\\WinContig\\WinContig.exe')

and my situation:

hc.execute_and_wait(hc.ini_path..'\\Utils\\WinContig\\WinContig.exe')
hc.execute_and_wait(hc.ini_path..'\Utils\\WinContig\\WinContig.exe')
hc.execute_and_wait(hc.ini_path..'Utils\\WinContig\\WinContig.exe')

Worked only:
Код:
hc.execute_and_wait('notepad.exe')
hc.execute_and_wait('notepad.exe' stat.txt)
hc.execute_and_wait('cmd.exe')

And not working:
Код:
hc.execute_and_wait('cmd.exe /C "D:\\123\\WinContig\\WinContig.exe"')
hc.execute_and_wait('cmd.exe /C D:\\123\\WinContig\\WinContig.exe')
hc.execute_and_wait('cmd.exe'..[[/C "D:\123\WinContig\WinContig.exe]])
hc.execute_and_wait('start "" /wait "D:\\123\\WinContig\\WinContig.exe"')

I tested so of any other (exe) programs with same problem.
LOG is clear.

Solving solution is only this:
Код:
hc.execute_and_wait('cmd.exe'..[[ /C ]]..[["]]..hc.ini_path..[[Utils\WinContig\WinContig.exe"]])
...this variant have problem where is window show.

execute_and_wait not have param as SW_HIDE.
Код:
hc.execute_and_wait('cmd.exe'..[[ /C ]]..[["]]..hc.ini_path..[[Utils\WinContig\WinContig.exe"]], SW_HIDE)
mai62, do you can add this param for this function?

(WinContig have param for hide window /NOGUI but short flash window if start (programs for hide running flashing too - as nircmd exec hide))

Working alternative for hide window (every 1 sec. check running process):
Код:
hc.shell_execute([["]]..hc.ini_path..[[Utils\WinContig\WinContig.exe]]..[["]], [["]]..hc.cache_path..[[" /DEFRAG /NOPROMPT /NOSCROLL /CHKDSK:0 /CLEAN:0 /NOGUI]], nil, 'SW_HIDE')
os.remove(hc.cache_path..[[tmp.txt]])
hc.sleep(1000)
while true do
hc.shell_execute([[cmd]], [[/C tasklist /NH /FO CSV /FI "IMAGENAME eq WinContig.exe">"]]..hc.cache_path..[[tmp.txt"]], nil, 'SW_HIDE')
hc.sleep(1000)
local f = io.open(hc.cache_path..[[tmp.txt]], "r")
local content = f:read()
f:close()
if content == [[INFO: No tasks are running which match the specified criteria.]] then
os.remove(hc.cache_path..[[tmp.txt]])
break
end
end
« Последнее редактирование: 26 августа 2017, 16:33:50 от truefriend-cz » Сообщить модератору   Записан
hc.addict
Новичок
*

Репутация: +1/-0
Offline Offline

Сообщений: 21


« Ответ #3 : 26 августа 2017, 16:51:54 »

Try write i Autoit.

You can start with Autoit.
Код:
hc.shell_execute('Your exe with your defrag code for WinContig.exe]')
Сообщить модератору   Записан
truefriend-cz
Постоялец
***

Репутация: +3/-1
Offline Offline

Сообщений: 118


« Ответ #4 : 26 августа 2017, 23:22:52 »

I'm trying to eliminate third-party programs. AutoIt can running with hide parameters? (no flash windows, etc.)
Сообщить модератору   Записан
hc.addict
Новичок
*

Репутация: +1/-0
Offline Offline

Сообщений: 21


« Ответ #5 : 27 августа 2017, 07:49:05 »

Yes, it is possible in Autoit.
Сообщить модератору   Записан
truefriend-cz
Постоялец
***

Репутация: +3/-1
Offline Offline

Сообщений: 118


« Ответ #6 : 27 августа 2017, 14:54:06 »

Ok, thank you very much.

mai62, do you can add this param for this function (parameter SW_HIDE to hc.execute_and_wait)?
« Последнее редактирование: 27 августа 2017, 14:59:51 от truefriend-cz » Сообщить модератору   Записан
mai62
Автор HC
*****

Репутация: +226/-4
Offline Offline

Сообщений: 6383


« Ответ #7 : 29 августа 2017, 02:55:02 »

You can use
hc.shell_execute('notepad.exe', 'stat.txt', nil, 'SW_SHOW', true)
The last argument "true" means that the function will wait for completion notepad.exe.
Сообщить модератору   Записан
Страниц: [1]   Вверх
  Отправить эту тему    Печать  

 
Перейти в: