Paedric Posted July 2, 2010 Share Posted July 2, 2010 Hello, I have a script that starts a program with several options possible, and in one of those options, files are copied before launching the program. However, I'd like to copy files over those files I copied before, but only once the program has been closed by the user, which may be hours latter. I tried using WinWaitNotActive, but either it doesn't work, or I couldn't manage to get it to work since I'm new to this. Thanks in advance to anyone who would like to try to help me. Link to comment Share on other sites More sharing options...
happy2help Posted July 2, 2010 Share Posted July 2, 2010 Hi and Welcome! Post your script so far and we will take a look for you. Link to comment Share on other sites More sharing options...
Paedric Posted July 2, 2010 Author Share Posted July 2, 2010 Here is the relevant part, the whole script is about a thousand lines long, and I'm not the one that have done it, I'm just editing it. It is the end that I'm trying to change. expandcollapse popupFunc _Factionselected() global $MultiplayerUsed = 0 If $Factionselected = "" Then ; MsgBox(4096, "RS II - message", "default", 12) If $EngineSelected = "RomeTW-BI.exe" Then $Factionselected = "-mod: " ElseIf $EngineSelected = "RomeTW-ALX.exe" Then $Factionselected = "-mod: " Else $Factionselected = "" EndIf ElseIf $Factionselected = "Select a faction" Then ; MsgBox(4096, "RS II - message", "Greek", 12) If $EngineSelected = "RomeTW-BI.exe" Then $Factionselected = "-mod: " ElseIf $EngineSelected = "RomeTW-ALX.exe" Then $Factionselected = "-mod: " Else $Factionselected = "" EndIf ElseIf $Factionselected = "Battles Only" Then ; MsgBox(4096, "RS II - message", "Others", 12) If $EngineSelected = "RomeTW-BI.exe" Then $Factionselected = "-mod: " ElseIf $EngineSelected = "RomeTW-ALX.exe" Then $Factionselected = "-mod: " Else $Factionselected = "" EndIf ElseIf $Factionselected = "One-turn Campaigns" Then ; MsgBox(4096, "RS II - message", "Rome", 12) $Factionselected = "-mod:play_one_turn " ElseIf $Factionselected = "Rome" Then ; MsgBox(4096, "RS II - message", "Rome", 12) $Factionselected = "-mod:play_rome " ElseIf $Factionselected = "Carthage" Then ; MsgBox(4096, "RS II - message", "Carthage", 12) $Factionselected = "-mod:play_carthage " ElseIf $Factionselected = "Gallaeci" Then ; MsgBox(4096, "RS II - message", "Gallaeci", 12) $Factionselected = "-mod:play_gallaeci " ElseIf $Factionselected = "Seleucid" Then ; MsgBox(4096, "RS II - message", "Seleucid", 12) $Factionselected = "-mod:play_seleucid " ElseIf $Factionselected = "Greek City-States" Then ; MsgBox(4096, "RS II - message", "Greek", 12) $Factionselected = "-mod:play_greeks " ElseIf $Factionselected = "Macedon" Then ; MsgBox(4096, "RS II - message", "Macedon", 12) $Factionselected = "-mod:play_macedon " ElseIf $Factionselected = "Ptolemaic Empire" Then ; MsgBox(4096, "RS II - message", "Ptolemaic Empire", 12) $Factionselected = "-mod:play_ptolemaic_empire " ElseIf $Factionselected = "Pergamon" Then ; MsgBox(4096, "RS II - message", "Pergamon", 12) $Factionselected = "-mod:play_pergamon " ElseIf $Factionselected = "Sparta" Then ; MsgBox(4096, "RS II - message", "Sparta", 12) $Factionselected = "-mod:play_sparta " ElseIf $Factionselected = "Boii" Then ; MsgBox(4096, "RS II - message", "Boii", 12) $Factionselected = "-mod:play_boii " ElseIf $Factionselected = "Parthia" Then ; MsgBox(4096, "RS II - message", "Parthia", 12) $Factionselected = "-mod:play_parthia " ElseIf $Factionselected = "Pontus" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_pontus " ElseIf $Factionselected = "Arverni" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_arverni " ElseIf $Factionselected = "Dacia" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_dacia " ElseIf $Factionselected = "Armenia" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_armenia " ElseIf $Factionselected = "Belgae" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_belgae " ElseIf $Factionselected = "Cimbri" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_cimbri " ElseIf $Factionselected = "Sarmatia" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_sarmatia " ElseIf $Factionselected = "Scythia" Then ; MsgBox(4096, "RS II - message", "Pontus", 12) $Factionselected = "-mod:play_scythia " ElseIf $Factionselected = "Test Campaign" Then ; MsgBox(4096, "RS II - message", "Test", 12) $Factionselected = "-mod:play_test " ElseIf $Factionselected = "Multiplayer" Then FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Multiplayer\export_descr_unit.txt", @ScriptDir & "\..\data\export_descr_unit.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Default_DMB\default\descr_model_battle.txt", @ScriptDir & "\..\data\descr_model_battle.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Post_Marian_Roman_General\descr_character.txt", @ScriptDir & "\..\data\descr_character.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Multiplayer\Rome.lnt", @ScriptDir & "\..\data\menu\Rome.lnt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Multiplayer\menu_english.txt", @ScriptDir & "\..\data\text\menu_english.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Multiplayer\descr_rebel_factions.txt", @ScriptDir & "\..\data\descr_rebel_factions.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Multiplayer\descr_mount.txt", @ScriptDir & "\..\data\descr_mount.txt", 1 ) Msgbox(4096, "Mutiplayer", "Please be aware that you are using the multiplayer option. All of the options are set to default to make sure to have compatible data. Don't forget to re-change them after playing.", 12) ; MsgBox(4096, "RS II - message", "Multiplayer", 12) $Factionselected = "-mod: " If winwaitnotactive("RomeTW-BI.exe") = true Then FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Single_Player\export_descr_unit.txt", @ScriptDir & "\..\data\export_descr_unit.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Single_Player\Rome.lnt", @ScriptDir & "\..\data\menu\Rome.lnt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Single_Player\menu_english.txt", @ScriptDir & "\..\data\text\menu_english.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Single_Player\descr_rebel_factions.txt", @ScriptDir & "\..\data\descr_rebel_factions.txt", 1 ) FileCopy( @ScriptDir & "\..\data\_IMPORTANT_STUFF\Single_Player\descr_mount.txt", @ScriptDir & "\..\data\descr_mount.txt", 1 ) EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
happy2help Posted July 2, 2010 Share Posted July 2, 2010 Instead of If winwaitnotactive("RomeTW-BI.exe") = true Then try Processwaitclose("RomeTW-BI.exe") Then Link to comment Share on other sites More sharing options...
Paedric Posted July 2, 2010 Author Share Posted July 2, 2010 Thanks, I've managed to do it in another totally different way. But thanks nonetheless! 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