Bradman Posted February 3, 2007 Share Posted February 3, 2007 http://www.autoitscript.com/forum/index.php?showtopic=39988See Previous Post for details of project!I have had some success! Here is what I have so far.I have a problem getting the Run($line) to run the next line of the txt file. I am not sure what I have done wrong!Help Please!CODE$g_szVersion = "My Script 1.1"If WinExists($g_szVersion) Then Exit AutoItWinSetTitle($g_szVersion)Opt("WinWaitDelay",250)Opt("WinTitleMatchMode",4)Opt("WinDetectHiddenText",1)Opt("MouseCoordMode",0)Opt("RunErrorsFatal", 0)#include <Date.au3>;RunAsSet("administrator", @ComputerName, "password"); REM out for local test!HotKeySet("^!x", "MyExit")$file = FileOpen("C:\SCRIPTS\SYS_NAMES.txt", 0); text file has the delprof.exe path ie "C:\SCRIPTS\Delprof.exe" local for the testWhile 1 $line = FileReadLine($file) If @error = -1 Then MsgBox(16, 'WARNING', 'UNABLE TO READ FILE',5) Sleep(1000) Run($line) If @error Then MsgBox(16, 'WARNING', 'DELPROF.EXE DID NOT RUN!',5)WinWait("C:\SCRIPTS\Delprof.exe","",8)If Not WinActive("C:\SCRIPTS\Delprof.exe","") Then WinActivate("C:\SCRIPTS\Delprof.exe","")WinWaitActive("C:\SCRIPTS\Delprof.exe","",8)Sleep(1000)Send("n")Sleep(1000)Send("{ENTER}")If WinActive("C:\SCRIPTS\Delprof.exe","") Then WinWaitClose("C:\SCRIPTS\Delprof.exe","")If Not WinExists("C:\SCRIPTS\Delprof.exe","") Then$file = FileOpen("C:\SCRIPTS\DELETE_PROFILE_LOG.txt", 9) FileWrite($file,"UNABLE TO ACCESS REMOTE SYSTEM: ") FileWrite($file,$line & @CRLF) FileWrite($file, (_NowDate()) & @CRLF) FileWrite($file, (_NowtIME(3)) & @CRLF) FileWrite($file, " " & @CRLF) FileClose($file)EndIfMsgBox(0, "SYSTEM ACCESSED:", $line); I use this message box as a way of controlling the test when the loop is running!WendFileClose($file);RunAsSet()Func MyExit() Exit EndFunc 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