Jump to content


Closing explorer, Waiting, then Reopening it


  • Please log in to reply
5 replies to this topic

#1 Dranklin Brosevelt

Dranklin Brosevelt
  • Guests

Posted 11 October 2010 - 05:59 PM

I've been trying to write a script but I think I'm doing something wrong. I have an old game called X-Wing that needs explorer to be closed before it runs. I want explorer to close, then open up again after I'm done playing. Here's what I have right now:

Process, Close, explorer.exe
Run, C:\Program Files\LucasArts\XWING95\XWING95.exe
WinWait, X-Wing Win95
WinWaitClose
Run, explorer.exe
When I run this, it closes explorer and opens the game like it should. But then the game immediately closes and explorer starts again. Can anyone help me figure this out?

#2 TLM

TLM
  • Members
  • 3595 posts

Posted 11 October 2010 - 07:21 PM

Just a guess..
Process, Close, explorer.exe
Run[color=red]Wait[/color], C:\Program Files\LucasArts\XWING95\XWING95.exe
; WinWait, X-Wing Win95
; WinWaitClose
Run, explorer.exe

Then again,
the system will probably automatically restart explorer if its closed.
The only thing I can think off is to tempoaraily rename explorer.exe
to say explorer_.exe.
Then when X-Wing has closed change the name back to the explorer.exe
and run it again.

The downside to this is renaming explorer.exe is very dangerous
and can cause your system to fail.
I dont suggest doing this!

#3 dave_100

dave_100
  • Members
  • 94 posts

Posted 11 October 2010 - 07:36 PM

Hi
I have exactly the same problem and also the answer for you
its using a script called wintrigger, and it auto closes explorer when the game starts, and when the game is finished, starts a new instance automatically,

all you should have to amend below is the games window name

Wintrigger by Masterfocus:
<!-- m -->http://www.autohotke...asterFocus/AHK/<!-- m -->
<!-- m -->http://www.autohotke... ... rigger.ahk<!-- m -->

#Persistent

; ------ ------ CONFIGURATION SECTION ------ ------



ProgWinTitle1 = Age of Empires II Expansion ahk_class Age of Empires II  Expansion ;amend this using windows spy for your game
WinTrigger1 = Active


; SetTimer Period
CheckPeriod = 200

; ------ END OF CONFIGURATION SECTION ------ ------

SetTimer, LabelCheckTrigger, %CheckPeriod%
Return

; ------ ------ ------

LabelCheckTrigger:
  While ( ProgWinTitle%A_Index% != "" && WinTrigger := WinTrigger%A_Index% )
    if ( !ProgRunning%A_Index% != !Win%WinTrigger%( ProgWinTitle := ProgWinTitle%A_Index% ) )
      GoSubSafe( "LabelTriggerO" ( (ProgRunning%A_Index% := !ProgRunning%A_Index%) ? "n" : "ff" ) A_Index )
Return

; ------ ------ ------

GoSubSafe(mySub)
{
  if IsLabel(mySub)
    GoSub %mySub%
}

; ------ ------ CUSTOM LABEL SECTION ------ ------

LabelTriggerOn1:
run TASKKILL /F /IM explorer.exe,, hide
LabelTriggerOff1:
run explorer.exe
return

; ------ END OF CUSTOM LABEL SECTION ------ ------

#ifwinactive


#4 Dranklin Brosevelt

Dranklin Brosevelt
  • Guests

Posted 11 October 2010 - 07:53 PM

Thanks for the help guys. Dave that works flawlessly, thanks a ton. :)

#5 MasterFocus

MasterFocus
  • Moderators
  • 4132 posts

Posted 13 October 2010 - 07:10 PM

@dave_100: Next time, don't remove the usage instructions and the credits.

- WinTrigger by MasterFocus

#6 dave_100

dave_100
  • Members
  • 94 posts

Posted 13 October 2010 - 07:46 PM

@dave_100: Next time, don't remove the usage instructions and the credits.

- WinTrigger by MasterFocus


apologies and no offence meant, ive edited my post accordingly