Blame | Last modification | View Log | Download
;; AutoIt Version: 3.0; Language: English; Platform: WinXP/2003/Vista; Author: Marcel Jordaan (mjordaan@rldautomation.eu);; Script Function:; Starts the FactoryLink webclient using graph.exe, and accepts the the same commandline parameters as graph.exe.; This script will start the weblcient and close all popup messageboxes reporting errors, normally weblcient will close; after accepting popup messages!; Note: the path variable should be set to the bin-directory where webclient is installed; Usage:; Calling this script in cmd or batch file makes it possible to auto-close webclient after an error,; and restart the same or an alternative weblcient connection.;initialize the command line parameter string$params = "";Get the commandline and build the parameter list for webclientFor $i = 1 to $CmdLine[0] step 1$params = $params & " " & $CmdLine[$i]Next;start webclient with parametersRun("graph.exe" & $params);wait for graph to start, no longer then 20 seconds$wcproc = ProcessWait( "graph.exe", 20)If $wcproc = 0 ThenMsgBox(0, "FactoryLink webclient", "'Graph' did not start. Bye!")ExitEndIf;get the PID for graph.exe, so we can check if the process is still running$webclient = ProcessExists( "graph.exe");Wait for webclient toe report a failure;weblcient should be running, if not quitwhile ($webclient <> 0);weblcient uses standard messageboxes to report errors, other programs use the same;class names for the standard messageboxes.;if we find a standard message box, check if it is owned by webclient$var = WinList("[CLASS:#32770]");$array[0][0] = Number of windows returned;$array[1][0] = 1st window title;$array[1][1] = 1st window handle (HWND);$array[2][0] = 2nd window title;$array[2][1] = 2nd window handle (HWND);loop through all the standard messageboxesFor $i = 1 to $var[0][0] step 1;check if the messagebox is owned by webcient, if not just ignoreIf $webclient = WinGetProcess($var[$i][0]) Then;messagebox is owned by webclient, give user 2.5 seconds to read....Sleep( 2500);close the message boxWinClose($var[$i][0]);for severe erros weblcient shuts downEndIfNext;do not use 100% CPU power, just go to sleep for half a secondSleep( 500);we are finished if weblcient is shutdown or has ended$webclient = ProcessExists( "graph.exe")WEnd; Finished!