Problem To use RunWait Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
snowmind
Posts: 124
Joined: 12 Nov 2015, 15:18

Problem To use RunWait  Topic is solved

21 Mar 2019, 15:04

Hi guys, :crazy:


I'm trying to prevent that my script does not hang on certain occasions like the ones that occur below.

Code: Select all

RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER"
If I run this script, it displays an error message. I cannot display the message that there was a failure in execution, even using "If ErrorLevel" or "Try"

Code: Select all

RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER", UseErrorLevel
If ErrorLevel = ERROR
{
MsgBox, Problema to run!	
}
or

Code: Select all

Try
RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER"
catch e
{
MsgBox, Problema to run!	
}
In both ways, the message does not appear "Problema to run!" how can I resolve this? any help?
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Problem To use RunWait

21 Mar 2019, 15:26

UseErrorLevel needs to be the 3rd parameter, but you have it as the 2nd (since the only other comma is actually being escaped). Add another comma, like so:

Code: Select all

RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER",, UseErrorLevel
snowmind
Posts: 124
Joined: 12 Nov 2015, 15:18

Re: Problem To use RunWait

22 Mar 2019, 06:11

Osprey wrote:
21 Mar 2019, 15:26
UseErrorLevel needs to be the 3rd parameter, but you have it as the 2nd (since the only other comma is actually being escaped). Add another comma, like so:

Code: Select all

RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER",, UseErrorLevel
Hii
Hello. Even using the correct format with 2 commas, the message (MsgBox, Problema to run!) is not displayed. :roll:

Code: Select all

RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER",, UseErrorLevel
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Problem To use RunWait

22 Mar 2019, 13:36

snowmind wrote:
22 Mar 2019, 06:11
Hii
Hello. Even using the correct format with 2 commas, the message (MsgBox, Problema to run!) is not displayed. :roll:

Code: Select all

RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER",, UseErrorLevel
It displayed the error when I changed RUNDLL32.exe to a filename that doesn't exist. That proves that there's nothing wrong with the code. If you're not seeing your error, then it means that RUNDLL32.exe was successfully run.
Last edited by Osprey on 23 Mar 2019, 01:40, edited 1 time in total.
hd0202
Posts: 183
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: Problem To use RunWait

23 Mar 2019, 00:36

Code: Select all

RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n"\\HOSTEST\PRINTER",, UseErrorLevel
If ErrorLevel = ERROR
{
MsgBox, Problema to start!	
}
else
{
MsgBox, program ended with code %ErrorLevel% !
}
Hubert

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, exodus_cl, ratyrat, Sniperman and 355 guests