Ravel Posted January 24, 2007 Share Posted January 24, 2007 (edited) Hi, I am trying to create a macro to run in the background of a game. I want it to constantly copy a folder while the game is running, and once i close the game I want the macro to automatically close itself. Here is what I have so far, can someone tell me if I have it right? HotkeySet('{ESC}', 'Terminate') opt ("WinTitleMatchMode",2) While 1 If ProcessExists("SwgClient_r.exe") Then FileCopy("G:\Star Wars\SWG\profiles\*.*", "G:\Star Wars\SWG\profiles.backup\*.*", 9); Flag = 1 + 8 (overwrite + create target directory structure) ; Copy the txt-files from source to target and overwrite target files with same name Sleep(600000) ElseIf Local $List = ProcessList('SWGcopyprofile.exe') For $I = 1 To $List[0][0] ProcessClose($List[$I][1]) Next WEnd Func Terminate() Exit EndFunc Edited January 24, 2007 by Ravel Link to comment Share on other sites More sharing options...
Valuater Posted January 24, 2007 Share Posted January 24, 2007 maybe... HotKeySet('{ESC}', 'Terminate') Opt("WinTitleMatchMode", 2) While 1 If ProcessExists("SwgClient_r.exe") Then FileCopy("G:\Star Wars\SWG\profiles\*.*", "G:\Star Wars\SWG\profiles.backup\*.*", 9); Flag = 1 + 8 (overwrite + create target directory structure) ; Copy the txt-files from source to target and overwrite target files with same name Sleep(600000) Else Exit EndIf WEnd Func Terminate() Exit EndFunc ;==>Terminate 8) Link to comment Share on other sites More sharing options...
Ravel Posted January 24, 2007 Author Share Posted January 24, 2007 maybe...HotKeySet('{ESC}', 'Terminate') Opt("WinTitleMatchMode", 2) While 1 If ProcessExists("SwgClient_r.exe") Then FileCopy("G:\Star Wars\SWG\profiles\*.*", "G:\Star Wars\SWG\profiles.backup\*.*", 9); Flag = 1 + 8 (overwrite + create target directory structure) ; Copy the txt-files from source to target and overwrite target files with same name Sleep(600000) Else Exit EndIf WEnd Func Terminate() Exit EndFunc ;==>Terminate8)So thats it? lol just put exit in there and it will kill itself if the program/game that i am playing ends? Link to comment Share on other sites More sharing options...
Valuater Posted January 24, 2007 Share Posted January 24, 2007 So thats it? lol just put exit in there and it will kill itself if the program/game that i am playing ends?Yepper !!!8) 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