 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ralphh85
Joined: 31 Jan 2006 Posts: 197 Location: truro, cornwall
|
Posted: Thu Apr 26, 2007 8:15 pm Post subject: onexit help. |
|
|
i think this is a general script issue, i have a scrpt which records 10min vids and saves them and then starts recording again like a cctv setup kinda.
when the script exits i want it to unhide the recording software (virtualdub)
but the onexit is not working??? (see end of script)
| Code: |
#Persistent ; didnt think this would be needed but is
settitlematchmode, 2
Detecthiddenwindows, on
ifwinnotexist, VirtualDub
{
run, F:\Downloaded Programs\VirtualDub-1.6.9\VirtualDub.exe ; C:\Downloaded Programs\VirtualDub-1.6.9\VirtualDub.exe
winwait, VirtualDub
winactivate, VirtualDub
send, !f ; puts it in to capture mode along with line below
Send, p
sleep, 300
winactivate, VirtualDub
send, !v
send, {enter}
}
sleep, 1000
winhide, VirtualDub
SetTimer, record , 600000 ;records 10 mins at a time (will be 10mins or more once working
record:
ifwinexist, [capture in progress]
{
ControlSend, #327701, {esc}, VirtualDub
sleep, 500
}
start:
sleep, 500
ifwinexist, [FILE EXISTS]
{
ControlSend, #327701, {]}, VirtualDub
sleep, 100
gosub start
}
else
ControlSend, #327701, {F5}, VirtualDub
return
OnExit, ExitSub
ExitSub:
winshow, VirtualDub
ExitApp
|
please help!
cheers
Ralph |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Thu Apr 26, 2007 8:16 pm Post subject: |
|
|
| Code: |
#Persistent ; needed since there are no hotkeys - use exitapp to close when you want
settitlematchmode, 2
Detecthiddenwindows, on
OnExit, ExitSub ; this directive needs to be up at the top.
ifwinnotexist, VirtualDub
{
run, F:\Downloaded Programs\VirtualDub-1.6.9\VirtualDub.exe ; C:\Downloaded Programs\VirtualDub-1.6.9\VirtualDub.exe
winwait, VirtualDub
winactivate, VirtualDub
send, !f ; puts it in to capture mode along with line below
Send, p
sleep, 300
winactivate, VirtualDub
send, !v
send, {enter}
}
sleep, 1000
winhide, VirtualDub
SetTimer, record , 600000 ;records 10 mins at a time (will be 10mins or more once working
return ;added return here, since the timer will make this happen automatically. add a gosub, record if you want the first instance to run right away
record:
ifwinexist, [capture in progress]
{
ControlSend, #327701, {esc}, VirtualDub
sleep, 500
}
start:
sleep, 500
ifwinexist, [FILE EXISTS]
{
ControlSend, #327701, {]}, VirtualDub
sleep, 100
gosub start
}
else
ControlSend, #327701, {F5}, VirtualDub
return
ExitSub:
winshow, VirtualDub
ExitApp
|
_________________
(Common Answers) |
|
| Back to top |
|
 |
ralphh85
Joined: 31 Jan 2006 Posts: 197 Location: truro, cornwall
|
Posted: Thu Apr 26, 2007 8:19 pm Post subject: |
|
|
very quick answer but that dont work either :s
Ralph |
|
| Back to top |
|
 |
ralphh85
Joined: 31 Jan 2006 Posts: 197 Location: truro, cornwall
|
Posted: Thu Apr 26, 2007 8:21 pm Post subject: |
|
|
sorry yes it does work, and thanks for the other tips to, i know im not paticuly good at scripting so like to know how to do it properly!!
cheers
Ralph |
|
| Back to top |
|
 |
DataLife
Joined: 27 Apr 2008 Posts: 368
|
Posted: Thu May 07, 2009 1:44 pm Post subject: |
|
|
| engunneer wrote: | | Code: |
OnExit, ExitSub ; this directive needs to be up at the top. |
|
I struggled with this issue also and now that I know the answer it seems very obvious.
Although, I think the documentation should indicate the OnExit needs to be in the autoexecute section.
DataLife _________________ Unless otherwise stated, all code is untested
Check out my AHK page http://www.autohotkey.net/~DataLife/index.html |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|