Jump to content

How can i call only 1 time my function


Bishop12
 Share

Recommended Posts

Hi Guys newbie only im doing only a test and i want to to ask how can i do like ahmm i want is when the script is running then i have 1 function down and i want him to call in while function for just only 1 time and i dont want him  to run again when the while loop repeat again 

 

HotKeySet("{esc}","myExit")


 WinActivate("Untitled")

WinMove("Untitled","",0,0)
while(1)
    sleep(1000)
    Naming()








WEnd








Func Naming()
    Send("NotePad = Notepad",)
EndFunc



func myExit()
   MsgBox(0,"Exiting","Bot is quitting")
   Exit
EndFunc

 

Link to comment
Share on other sites

Just now, Bishop12 said:

Hi Guys newbie only im doing only a test and i want to to ask how can i do like ahmm i want is when the script is running then i have 1 function down and i want him to call in while function for just only 1 time and i dont want him  to run again when the while loop repeat again 

 

HotKeySet("{esc}","myExit")


 WinActivate("Untitled")

WinMove("Untitled","",0,0)
while(1)
    sleep(1000)
    Naming()








WEnd








Func Naming()
    Send("NotePad = Notepad",)
EndFunc



func myExit()
   MsgBox(0,"Exiting","Bot is quitting")
   Exit
EndFunc

 

and then Func Naming() will just only call again when i re run the script ?? any one can help me ?

Link to comment
Share on other sites

You need to move your call to the Naming() function outside of the loop, before it, so that it will run once and then the script will idle in the loop until your hotkey is pressed;

HotKeySet("{esc}","myExit")

WinActivate("Untitled")

WinMove("Untitled","",0,0)

Naming()

while(1)

    sleep(1000)

WEnd

Func Naming()
    Send("NotePad = Notepad")
EndFunc

func myExit()
    MsgBox(0,"Exiting","Bot is quitting")
    Exit
EndFunc

I also removed the comma from the Send in your example as it caused a syntax error.

Link to comment
Share on other sites

21 minutes ago, Valiante said:

You need to move your call to the Naming() function outside of the loop, before it, so that it will run once and then the script will idle in the loop until your hotkey is pressed;

HotKeySet("{esc}","myExit")

WinActivate("Untitled")

WinMove("Untitled","",0,0)

Naming()

while(1)

    sleep(1000)

WEnd

Func Naming()
    Send("NotePad = Notepad")
EndFunc

func myExit()
    MsgBox(0,"Exiting","Bot is quitting")
    Exit
EndFunc

I also removed the comma from the Send in your example as it caused a syntax error.

ohh yes thankyou for that help sir :D Ty a lot know i know i probably work hard for this ty again .. :D

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...