AutoHotkey Community

It is currently May 26th, 2012, 10:45 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: September 16th, 2009, 2:10 pm 
Offline

Joined: September 2nd, 2008, 4:20 pm
Posts: 50
Not sure I'm using the correct terminology there but here's what I'd like to do.

I have this script, it works great, but I have this loop in it that I use to pause the script while it's executing.

This is sprinkled all over my script:

Code:
Loop
{
  Sleep, 1000
  If A_Cursor not contains AppStarting,Wait
  break
}


What I tried to do was make it a function (again not sure if that is the correct terminology) and call it with gosub:

Code:
script excuting blah blah blah
gosub, pfp
more script excuting blah blah blah


; FUNCTIONS

PFP: ; Pause For Program
Loop
{
  Sleep, 1000
  If A_Cursor not contains AppStarting,Wait
  break
}


But when I do that I the more script executing stuff doesn't excute.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2009, 2:17 pm 
Code:
script excuting blah blah blah
pfp()
more script excuting blah blah blah

; FUNCTIONS

PFP(){ ; Pause For Program
  Loop
  {
    Sleep, 1000
    If A_Cursor not contains AppStarting,Wait
      return
  }
}

???


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2009, 3:36 pm 
Offline

Joined: September 2nd, 2008, 4:20 pm
Posts: 50
That works perfectly, thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2009, 6:51 pm 
Offline

Joined: January 10th, 2009, 2:57 pm
Posts: 19
Code:
script excuting blah blah blah
gosub, pfp
more script excuting blah blah blah


; FUNCTIONS

PFP: ; Pause For Program
Loop
{
  Sleep, 1000
  If A_Cursor not contains AppStarting,Wait
  break
}
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2009, 12:27 am 
Offline

Joined: April 4th, 2008, 8:15 pm
Posts: 538
Location: Canada
Quote:
Although Gosub is useful for simple, general purpose subroutines, consider using functions for more complex purposes.

http://www.autohotkey.com/docs/Functions.htm


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: Bing [Bot], JSLover, Miguel, rbrtryn, XstatyK and 55 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