Search the Community
Showing results for tags 'program control'.
-
I have a general question. Is it possible to tell under program control when #RequireAdmin is needed? Specifically I can WinMove the Date and Time window without #RequireAdmin, however I cannot WinMove the System Properties window without using the #RequireAdmin. This script shows the issue. ;#RequireAdmin ;<-- makes A BIG difference #AutoIt3Wrapper_run_debug_mode=Y ; use this to debug in console window <--- LOOK Opt("WinTitleMatchMode", -2) ;nocase partial match okay ;MoveIt($pgm, $pgm_title) MoveIt("notepad.exe", "notepad") ;works MoveIt("cmd.exe", "cmd") ;works MoveIt("control timedate.cpl", "Date and Time") ;works MoveIt("systempropertiesprotection.exe", "System Properties") ;FAILS - handles correct, Winclose fails, etc. - actually hangs next run command - manually close window after MsgBox winclose pops up - then it will continue correctly MoveIt("control timedate.cpl", "Date and Time") ;works MoveIt("control sysdm.cpl", "System Properties") ;try old version - FAILS ALSO ;??? Is there some special approach needed to move a System Properties box ??? YES YES YES IT REQUIRES #RequireAdmin !!!!! Exit Func MoveIt($pgm, $pgm_title) Send("#r") ;open run box ;wait for it WinWait("Run") ;partial match If Not WinActive("Run") Then WinActivate("Run") WinWaitActive("Run") Send($pgm & @CRLF) ;run program WinWait($pgm_title) ;partial match If Not WinActive($pgm_title) Then WinActivate($pgm_title) WinWaitActive($pgm_title) MsgBox(0,"Debug","Ready to move.") $hl = WinMove($pgm_title, "", 0, 0) MsgBox(0,"Debug","Should be at 0,0 and handle = " & $hl & " (0=not found)") $hl = WinMove($pgm_title, "", 100, 100, Default, Default, 100) ;move slowly keep current size MsgBox(0,"Debug","Should be at 100,100 and handle = " & $hl & " (0=not found)") MsgBox(0,"Debug","Move completed.") $r = WinClose($pgm_title) ;be polite and close it MsgBox(0, "Debug", "WinClose return value = " & $r) EndFunc