JohnTWI Posted July 21, 2020 Share Posted July 21, 2020 I run the following snippet of code with a domain user and have no issues. But when I run the code as a local user the script does not click the button? Sleep(6000) WinExists("THRIVE PRODUCTION SERVER - Thrive") Sleep(7000) ControlFocus("THRIVE PRODUCTION SERVER - Thrive", "", "Button1") Sleep(3000) ControlClick("THRIVE PRODUCTION SERVER - Thrive", "","[CLASS:Button; INSTANCE:1]") Link to comment Share on other sites More sharing options...
rudi Posted July 22, 2020 Share Posted July 22, 2020 Hi. Your line "WinExists" as written will have no effect at all. You might want to try this: $WinTitle="THRIVE PRODUCTION SERVER - Thrive" $WinTXT="" $WinCtrl="Button1" WinWait($WinTitle,$WinTXT) WinActivate($WinTitle,$WinTXT) MsgBox(0, '', "Waiting 2 sec.",2) ; to see, if the window will come on top ControlClick($WinTitle,$WinTXT,$WinCtrl) ; Try the $WinCtrl = "[CLASS:Button; INSTANCE:1]", as you specified already MsgBox(0, '', "done") Do both users have the same local rights? As a shot in the dark you could try what's happening, when you start your script UAC elevated. Add the line #RequireAdmin to your script. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
JohnTWI Posted July 22, 2020 Author Share Posted July 22, 2020 Rudi I added #RequireAdmin to the script - no effect And both users are admin on the server. Thank you for the feed back. Link to comment Share on other sites More sharing options...
JohnTWI Posted July 22, 2020 Author Share Posted July 22, 2020 Rudi I tried your code and the first message box comes up then nothing. Link to comment Share on other sites More sharing options...
rudi Posted August 4, 2020 Share Posted August 4, 2020 Strange. Try this one, run it *NOT* compiled, but from SCITE: $WinTitle="THRIVE PRODUCTION SERVER - Thrive" $WinTXT="" $WinCtrl="Button1" Opt("trayicondebug",1) WinWait($WinTitle,$WinTXT) ToolTip("Window recognized",100,100) WinActivate($WinTitle,$WinTXT) ToolTip("Window activated",100,100) MsgBox(0, '', "Waiting 2 sec.",2) ; to see, if the window will come on top ToolTip("messagebox timeout passed",100,100) $result=ControlClick($WinTitle,$WinTXT,$WinCtrl) ; Try the $WinCtrl = "[CLASS:Button; INSTANCE:1]", as you specified already ToolTip("ControlClick result: " & $result & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console MsgBox(0, '', "done") mouse-over the tray icon of the running script to follow up what script line it's currently at. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
JohnTWI Posted August 5, 2020 Author Share Posted August 5, 2020 rudi Thank you for the feedback. I tried your code above, the "Waiting 2 sec" message box came up then went right to the "done" message box. This snip it of code is part of a much large script. Link to comment Share on other sites More sharing options...
rudi Posted August 6, 2020 Share Posted August 6, 2020 what does the tooltip tell you about rhe ControlClick result an error code? Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
JohnTWI Posted August 7, 2020 Author Share Posted August 7, 2020 Unless I am missing something I did not see it. Link to comment Share on other sites More sharing options...
rudi Posted August 10, 2020 Share Posted August 10, 2020 Tootip displaying can be disabled "in windows", I cannot recall where this setting is available but remember, that it once took me a while to track down that "feature". You might want to readup the forums searching for keywords like "debugging". In general: Each function call is returning a result value, in case an error happened ofthen the built-in @error is set, sometimes additional information can be found in @extended. An easy way to followup what's going on (or going wrong) is to write these informations to a plain TXT file. #include <Date.au3> $Log=@TempDir &"\Thrive-LOG.txt" $hLog=FileOpen($Log,2+8) FileWriteLine($hLog,"Logging started to see what's going on") FileWriteLine($hLog,_NowCalc()) $WinTitle="THRIVE PRODUCTION SERVER - Thrive" $WinTXT="" $WinCtrl="Button1" Opt("trayicondebug",1) FileWriteLine($hLog,_NowCalc() & @TAB & "Starting to wait for Window") $Result=WinWait($WinTitle,$WinTXT,10) FileWriteLine($hLog,_NowCalc() & @TAB & "WinWait" & @TAB & "$Result = " & $result &@TAB & "@error = " & @error & @TAB & "@extended = " & @extended) $result = WinActivate($WinTitle,$WinTXT) FileWriteLine($hLog,_NowCalc() & @TAB & "WinActivate" & @TAB & "$Result = " & $result& @TAB & "@error = " & @error & @TAB & "@extended = " & @extended) $result=Sleep(2000) FileWriteLine($hLog,_NowCalc() & @TAB & "Sleep" & @TAB & "$Result = " & $result & @TAB & "@error = " & @error & @TAB & "@extended = " & @extended) $result=ControlClick($WinTitle,$WinTXT,$WinCtrl) ; Try the $WinCtrl = "[CLASS:Button; INSTANCE:1]", as you specified already FileWriteLine($hLog,_NowCalc() & @TAB & "ControlClick" & @TAB & "$Result = " & @TAB & $result & @TAB & "@error = " & @error & @TAB & "@extended = " & @extended) MsgBox(0, '', "done") FileWriteLine($hLog,"-----------------------------------------------") FileWriteLine($hLog,"done - " & _NowCalc()) FileClose($hLog) ShellExecute($Log) Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now