HandyCache форум

Главная категория => Общие вопросы => Тема начата: truefriend-cz от 25 августа 2017, 12:12:11



Название: Bug hc.execute_and_wait
Отправлено: truefriend-cz от 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?


Название: Re: Bug hc.execute_and_wait
Отправлено: hc.addict от 26 августа 2017, 13:43:19
Try:

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


Название: Re: Bug hc.execute_and_wait
Отправлено: truefriend-cz от 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


Название: Re: Bug hc.execute_and_wait
Отправлено: hc.addict от 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]')


Название: Re: Bug hc.execute_and_wait
Отправлено: truefriend-cz от 26 августа 2017, 23:22:52
I'm trying to eliminate third-party programs. AutoIt can running with hide parameters? (no flash windows, etc.)


Название: Re: Bug hc.execute_and_wait
Отправлено: hc.addict от 27 августа 2017, 07:49:05
Yes, it is possible in Autoit.


Название: Re: Bug hc.execute_and_wait
Отправлено: truefriend-cz от 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)?


Название: Re: Bug hc.execute_and_wait
Отправлено: mai62 от 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.