Wardio Posted November 13, 2006 Share Posted November 13, 2006 Hello, have just created and compiled a script that does a load of button presses and the like on an application that i use, which works perfectly on my machine. However, when i try and run this program on my server machine, and don't have a remote desktop connection open on the account I'm running it as, it won't run. Is there any way round this? I'm guess it's because there's no window to load the application windows up, and thus my script doesn't click on the appropriate buttons etc. Some help much appreciated! Cheers, Tom Link to comment Share on other sites More sharing options...
lod3n Posted November 13, 2006 Share Posted November 13, 2006 You're not using WinWaitActive are you? Because that only works when a window can become active. Try WinWait instead. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Wardio Posted November 13, 2006 Author Share Posted November 13, 2006 I was using that command... just changed it over and think it's working now... I'll be able to tell in the morning Works fine when i'm remote desktopping into the account i'm running the script on... was so close to automating this damned thing!!Thanks for the help, you're a star...TomYou're not using WinWaitActive are you? Because that only works when a window can become active. Try WinWait instead. Link to comment Share on other sites More sharing options...
n00b Posted November 14, 2006 Share Posted November 14, 2006 I was using that command... just changed it over and think it's working now... I'll be able to tell in the morning Works fine when i'm remote desktopping into the account i'm running the script on... was so close to automating this damned thing!!Thanks for the help, you're a star...TomI would like to know if you got it to work, i am in the same dilema, created a script to automate interaction with an IE page, but it's not working if there is no Interactive display with the PC. Link to comment Share on other sites More sharing options...
Wardio Posted November 14, 2006 Author Share Posted November 14, 2006 Ok so this didn't work at all, i still need to have the window open and active to be able to do things. Removing that line meant my program waited forever, as needed the window active to be able to do the Send() stuff i was doing.Guess the answer is to change to ControlSend(), but i don't know how to use ClassNameNN as the determinant, everything i try just doesn't work...You're not using WinWaitActive are you? Because that only works when a window can become active. Try WinWait instead. Link to comment Share on other sites More sharing options...
Fossil Rock Posted November 14, 2006 Share Posted November 14, 2006 Show us the code so that we might better understand. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
Wardio Posted November 14, 2006 Author Share Posted November 14, 2006 Show us the code so that we might better understand. here we go expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.1.1.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $g_szVersion = "Juice Automation Automator" If WinExists($g_szVersion) Then Exit; It's already running AutoItWinSetTitle($g_szVersion) ; COMMAND LINE INPUT ; ; PARAM 1 - STARTTIME (IN 24HRS) ; PARAM 2 - ENDTIME (IN 24HRS) ; PARAM 3 - [OPTIONAL] SCRIPTLIST FILENAME ; PARAM 4 - [OPTIONAL] DATE TO RUN AUTOMATION Dim $workingdir Dim $mainappname Dim $scriptlist Dim $logfilename Dim $timeout = 10 Dim $date Dim $starttime Dim $endtime $workingdir = "Z:\phoenix\tools\release\Juice\" $logfilename = String ($workingdir & "OvernightInfo\log.txt") $mainappname = "JUICE" If ( $CmdLine[0] == 2) Then $starttime = $CmdLine[1] $endtime = $CmdLine[2] $scriptlist = String ($workingdir & "OvernightInfo\OvernightScripts.jal") $date = String(@MON & "/" & @MDAY & "/" & @YEAR ) ElseIf ( $CmdLine[0] == 3) Then $starttime = $CmdLine[1] $endtime = $CmdLine[2] $scriptlist = String( $workingdir & $CmdLine[3]) $date = String(@MON & "/" & @MDAY & "/" & @YEAR ) ElseIf ( $CmdLine[0] == 4 ) Then $starttime = $CmdLine[1] $endtime = $CmdLine[2] $scriptlist = String( $workingdir & $CmdLine[3]) $date = $CmdLine[4] Else ;$starttime = "22:00" ;$endtime = "23:00" ;$scriptlist = String ($workingdir & "OvernightInfo\OvernightScripts.jal") ;$date = String(@MON & "/" & @MDAY & "/" & @YEAR ) MsgBox (16, "ERROR", "Incorrect Number of Parameters, Exiting", 2) Exit EndIf LogClean() LogOut("Logfile Opened") AutoItSetOption ( "WinTitleMatchMode",4) ; start the tool ;debug running of juice.exe for testing. ;LogOut("Open Juice.EXE") ;$juiceargs = "juiceTESTServer.cfg" ;$exefile = String ($workingdir & "Juice.EXE" & " " & $juiceargs) ;Run( $exefile, $workingdir ) LogOut("Wait for Juice to Open") Dim $temp = WinWait( $mainappname, "", $timeout) If ($temp == 0) Then MsgBox (16, "ERROR", "Juice Didn't load in time!, Exiting", 2) Exit EndIf LogOut("Application Window Open, now load automation manager") WinActivate( WinGetHandle( $mainappname ) ) Send("!w") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") WinActivate ("Automation Manager - All Teams") WinWaitActive("Automation Manager - All Teams") $automationhandle = WinGetHandle("Automation Manager - All Teams") LogOut("Loaded Automation Manager") ;ControlSetText("Automation Manager - All Teams","",3802994,"11 / 11 / 2006 - 05 : 00 AM") LogOut("Set Start Time and Date") ;set times to run script Send("{TAB}") Send("{TAB}") ;set startdate Send(GetDay($date)) Send("{SPACE}") Send(GetMonth($date)) Send("{SPACE}") Send(GetYear($date)) Send("{SPACE}") ;set starttime Send(GetHour($starttime)) Send("{SPACE}") Send(GetMins($starttime)) Send("{SPACE}") If (GetHour($starttime) <12) Then Send("AM") EndIf LogOut("Set End Time and Date") Send("{TAB}") ;set enddate Send(GetDay($date)) Send("{SPACE}") Send(GetMonth($date)) Send("{SPACE}") Send(GetYear($date)) Send("{SPACE}") ;set endtime Send(GetHour($endtime)) Send("{SPACE}") Send(GetMins($endtime)) Send("{SPACE}") If (GetHour($starttime) <12) Then Send("AM") EndIf LogOut("Setting Reboot Options (Currently Reboot on Start, end and Disconnect)") ControlClick($automationhandle,"","End") ControlClick($automationhandle,"","Crash") ;GOT HERE! ControlClick($automationhandle,"","Load List") WinWaitActive("Load Juice Script List") LogOut("Loaded Load List Dialog") ControlSetText("Load Juice Script List","",1148,$scriptlist) Send("{ENTER}") LogOut("Commiting Run") ;commit Run ControlClick($automationhandle,"","Commit") WinClose ($automationhandle) ;----------------------------------------------------------------------------- Func GetDay($date) Return StringLeft ($date,2) EndFunc Func GetMonth($date) $date = StringTrimLeft ($date,3) Return StringLeft ($date,2) EndFunc Func GetYear($date) $date = StringTrimLeft ($date,6) Return StringLeft ($date,4) EndFunc Func GetHour($time) Return StringLeft($time,2) EndFunc Func GetMins($time) $time = StringTrimLeft ($time,3) Return StringLeft($time,2) EndFunc Func LogClean() Dim $logfile $logfile = FileOpen( $logfilename, 10 ) FileWrite($logfile,"Log created.") FileClose($logfile) EndFunc Func LogOut( $string ) Dim $logfile $logfile = FileOpen( $logfilename, 9 ) FileWriteLine($logfile,$string ) FileClose( $logfile) EndFunc Link to comment Share on other sites More sharing options...
Fossil Rock Posted November 14, 2006 Share Posted November 14, 2006 Quick question... does the other machine utilize 'Z:\' drive ? Is it mapped on both machines ? Agreement is not necessary - thinking for one's self is! 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