AutoHotkey Community

It is currently May 26th, 2012, 7:34 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: onexit help.
PostPosted: April 26th, 2007, 9:15 pm 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2007, 9:16 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
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


_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2007, 9:19 pm 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
very quick answer but that dont work either :s


Ralph


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2007, 9:21 pm 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 7th, 2009, 2:44 pm 
Offline

Joined: April 27th, 2008, 5:28 pm
Posts: 489
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

_________________
Check out my scripts.
(MyIpChanger) (XPSnap) (SavePictureAs)

All my scripts are tested on Windows 7, AutoHotkey_L 32 bit Ansi unless otherwise stated.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: dmg, krajan, over21, RaptorX, Yahoo [Bot] and 62 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group