Zoomba Posted September 17, 2009 Posted September 17, 2009 Hello all (please excuse my noobiness ) I have an application being installed and configured automatically (Java and batches) on a virtual machine, one of the last parts of the config is done using Autoit. The problem is that the script doesn't run until a user logs in to via RDP (probably because it waits for a window) Has anyone encountered this before? Any idea to solve this? This is the code in case it can help (any suggestions welcome! expandcollapse popup#cs=========================== ===========================================Description=========================================== Regenerate Forms HTML ================================================================================================= Date: Sep 6 2009 Dalet Version 3.03.60956 Autohor: Zoomba #ce=========================== ;======Global Variables====== AutoItSetOption("SendKeyDelay", 10) AutoItSetOption("MouseCoordMode", 2) AutoItSetOption("CaretCoordMode", 2) ;BlockInput(1) Global $USER_PASS, $WINDOW_TITLE, $MAIN_TREE, $ERRORLEVEL $USER_PASS = "dalet_admin" $DSN = "SBG" $WINDOW_TITLE = "DaletPlus Admin" $MAIN_TREE = "[CLASS:SysTreeView32]" $LOG_MESSAGE_PREFIX = @YEAR&"-"&@MDAY&"-"&@MON&" "&@HOUR&":"&@MIN&":"&@SEC&"."&@MSEC&" "&@ComputerName&" - " ;======Global Functions====== Func LogInRemoteAdmin() ;If $CmdLine[0] = 0 Then Exit(1) ;$DSN = $CmdLine[1] Run("c:\Program Files\Dalet\DaletPlus\bin\RemoteAdmin.exe") WinWaitActive("DaletPlus database") ControlFocus ( "DaletPlus database", "", 4004 ) ControlSetText("DaletPlus database", "", 4004, $USER_PASS) ControlFocus ( "DaletPlus database", "", 4006 ) ControlSetText("DaletPlus database", "", 4006, $USER_PASS) ControlFocus ( "DaletPlus database", "", 1001 ) ControlSetText("DaletPlus database", "", 1001, $DSN) ControlFocus ("DaletPlus database", "&OK", "[CLASS:Button; INSTANCE:2]") MouseClick("left", 89, 112) WinWaitActive("DaletPlus Admin") EndFunc Func ExpandTree() ControlFocus($WINDOW_TITLE, "", "[CLASS:SysTreeView32; INSTANCE:1]") Send("{SHIFTDOWN}{NUMPADADD}{SHIFTUP}") EndFunc Func MinimizeTree() ControlFocus($WINDOW_TITLE, "", "[CLASS:SysTreeView32; INSTANCE:1]") Send("{DOWN 3}{SHIFTDOWN}{NUMPADSUB}{SHIFTUP}") ControlFocus($WINDOW_TITLE, "", "[CLASS:SysTreeView32; INSTANCE:1]") EndFunc Func ProcessKill($sPID) If IsString($sPID) Then $sPID = ProcessExists($sPID) Sleep(100) If Not $sPID Then Return SetError(1, 0, 0) Return Run(@ComSpec & " /c taskkill /F /PID " & $sPID & " /T", @SystemDir, @SW_HIDE) EndFunc Func WriteLogfile($data,$logpath) $file = FileOpen($logpath, 1) If $file = -1 Then Exit FileWrite($file, $data & @CRLF) FileClose($file) EndFunc ;======Call Functions (call functions)====== LogInRemoteAdmin() WriteLogFile($LOG_MESSAGE_PREFIX&" Login to Remote Admin successfull",@ScriptDir&"\RegenerateForms.log") MinimizeTree() RegenerateForms() WriteLogFile($LOG_MESSAGE_PREFIX&" Regrenerate Forms successfull",@ScriptDir&"\RegenerateForms.log") ;======All Functions====== ;MediaAssetManagement Func RegenerateForms() MouseClick("left", 91, 55, 3) Send("{RIGHT}") MouseClick("left", 97, 105, 1) WinWaitActive($WINDOW_TITLE, "The Asset Manager Direc") ;ControlFocus($WINDOW_TITLE, "", "[CLASS:SysTabControl32; INSTANCE:1]") Send("{TAB}{SHIFTDOWN}{TAB}{SHIFTUP}{RIGHT}") Sleep(50) WinWaitActive($WINDOW_TITLE, "After a change") ControlFocus($WINDOW_TITLE, "Regenerate Forms HTML", "[CLASS:Button; INSTANCE:1]") Send("{ENTER 2}") ;ControlClick($WINDOW_TITLE, "Regenerate Forms HTML", "[CLASS:Button; INSTANCE:1]", "left", 1, 221, 191) Sleep(8000) Call(ProcessKill("RemoteAdmin.exe")) EndFunc Thanx!
herewasplato Posted September 17, 2009 Posted September 17, 2009 Welcome to the forum. If you cannot find the answer in this FAQ post... http://www.autoitscript.com/forum/index.php?showtopic=37289&view=findpost&p=571221 ...post back for more help. [size="1"][font="Arial"].[u].[/u][/font][/size]
Zoomba Posted September 22, 2009 Author Posted September 22, 2009 Welcome to the forum.If you cannot find the answer in this FAQ post...http://www.autoitscript.com/forum/index.php?showtopic=37289&view=findpost&p=571221...post back for more help.OK - that's it - thanx a lot man!
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