Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Basic help for a complete noob regarding closing a script after use

$
0
0
Hey guys, first of all, i ask patience, since I'm super dumb when it comes to scripts, codes, etc.

I also been trying stuff on and off, copying scripts, reading help and whatnot, but i sort of hit a wall, and despite trying new stuff i can't quite get it to work.

I've used the search function, read numerous posts, and went through the relevant sections on the wiki, but i can't quite make it do what i want it to.

Basically, i want this program to run fullscreen, and load a certain file (which i already acomplished by copying scripts and fiddling around).

I also want it to close when i press the ESC key, which is also working at the moment.

HOWEVER, the script keeps running after the program closes, and upon pressing ESC it closes other programs, i want to correct that.

So basically, after that particular program closes, the script should stop, im sure a more correct way of doing it, would be to make the script only work while that particular program is running, but i have no idea how to go about doing that.

Also there might be unnecessary lines in there, so if someone is kind enough to correct it and help me, i would much appreciate it.

Thanks a bunch.


$windows = "DeSmuME 0.9.9 svn4565 x86-JIT"

Run ( "C:\Program Files\Steam\SteamApps\common\Emulators\Desmume\DeSmuME.exe castle.nds")
WinWait ( $windows )
WinActivate ( $windows )
WinWaitActive ( $windows )
Send("!{ENTER}")

HotKeySet("{Esc}", "CloseWindow")
While 1
sleep(100)
Wend

Func CloseWindow()
; ... can do stuff here
HotKeySet("{Esc}");unregister hotkey
If WinActive("Microsoft Excel") Then
Send("{Esc}")
Else
Send("!{F4}")
EndIf
HotKeySet("{Esc}", "CloseWindow");re-register
EndFunc



Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>