Sign in to follow this  
Followers 0
IrishPride

One More Question

2 posts in this topic

#1 ·  Posted (edited)

Hey guys,

For any of you that were helping me earlier, I appreciate it, and I have one more question for you.

After establishing that a func can be called for using a func call, within a separate func, I was wondering if it was possible to make it only continue on with the calling for another func, if a hotkey was pressed earlier.

Sorry for the poor wording, I didn't know how to state it. Check the example :

HotKeySet("{F1}" , "Start" )
HotKeySet("{F2}" , "Test" )
WinActivate( "New Text Document" )
    While 1
Start()
    WEnd

    Func Start()
    
    WinActivate( "New Text Document" )
    Send( "1/10" )
    Send( "2/10" )
    Send( "3/10" )
    Send( "4/10" )
    Send( "5/10" )
    Send( "6/10" )
    Send( "7/10" )
    Send( "8/10" )
    Send( "9/10" )
    Send( "10/10" )
    Send( "{ENTER}" )
    Test()
    
    Sleep ( 1500 )
    EndFunc

Func Test()
    Send( "11/10 - WINNING!" )
    Send( "{ENTER}" )
    Sleep ( 250 )
EndFunc

However, I'm wondering how to call for the Test function, given that F2 was pressed; if not, repeat Start() loop.

Thanks in advance!

-IrishPride

Edited by IrishPride

Share this post


Link to post
Share on other sites



One way you can do it is to set a "flag"

#Include <Misc.au3>

HotKeySet("{F1}" , "Start" )
HotKeySet("{F2}" , "Test" )
$flag=0
WinActivate( "New Text Document" )
    While 1
If _isPressed("70") or _isPressed("71") Then
$flag=1
EndIf
Start()
    WEnd

    Func Start()
    
    WinActivate( "New Text Document" )
    Send( "1/10" )
    Send( "2/10" )
    Send( "3/10" )
    Send( "4/10" )
    Send( "5/10" )
    Send( "6/10" )
    Send( "7/10" )
    Send( "8/10" )
    Send( "9/10" )
    Send( "10/10" )
    Send( "{ENTER}" )
If $flag=1 Then
    Test()
EndIf
    
    Sleep ( 1500 )
    EndFunc

Func Test()
    Send( "11/10 - WINNING!" )
    Send( "{ENTER}" )
    Sleep ( 250 )
EndFunc

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0