Jump to content
Sign in to follow this  
Skerb

Newb Question

Recommended Posts

I was curious if it is possible to set a variable with a long string of commands. I repeat like 15 commands multiple times and was wondering if I can just set it as a variable; if so, how would I write it? Thanks!

Share this post


Link to post
Share on other sites

MouseClick("left", 89,221)

Sleep(500)

MouseClick("left", 130,367)

Sleep(1500)

Send("{PGDN}")

Sleep(500)

MouseClick("left", 119,563)

Sleep(1000)

Send("Skerb's Message")

Sleep(1000)

Send("{TAB}")

Sleep(200)

Send("{TAB}")

Sleep(200)

Send("{TAB}")

Sleep(200)

I need to run this script a bunch of times, I tried Valuater's StringSplit, but it did not work. Any other ideas? Thanks!

Share this post


Link to post
Share on other sites

then maybe

; Press Esc to terminate script, Pause/Break to "pause"
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d
;;;; Body of program would go here ;;;;
While 1
    MouseClick("left", 89, 221)
    Sleep(500)
    MouseClick("left", 130, 367)
    Sleep(1500)
    Send("{PGDN}")
    Sleep(500)
    MouseClick("left", 119, 563)
    Sleep(1000)
    Send("Skerb's Message")
    Sleep(1000)
    Send("{TAB}")
    Sleep(200)
    Send("{TAB}")
    Sleep(200)
    Send("{TAB}")
    Sleep(200)
WEnd
;;;;;;;;
Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause
Func Terminate()
    Exit 0
EndFunc   ;==>Terminate
Func ShowMessage()
    MsgBox(4096, "Thanks ...", "... Valuater!    ")
EndFunc   ;==>ShowMessage

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Wait, I think I described my problem wrong, hehe. I do not have to keep running this same script, but I have to write it over and over. I want to make a variable so I wouldn't have to repeat writing it over and over. Such as:

something

something

something

*That big routine*

something different

something different

something different

*that big routine*

and etc, etc...I hope I explained myself well enough now, sorry for the confusion before...Lol, unless you were right with the last script, then my apologizes and Im a noob :P

Share this post


Link to post
Share on other sites

I would just make two diffrent exe files and make my main one run the one i want it to do and sleep for a sec then continue with the program....thats only because im lazy though :P


-----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran

Share this post


Link to post
Share on other sites

You want to put it in a function and call it whenever you need it.

While 1
   _DoStuff()
WEnd

Func _DoStuff()
    MouseClick("left", 89, 221)
    Sleep(500)
    MouseClick("left", 130, 367)
    Sleep(1500)
    Send("{PGDN}")
    Sleep(500)
    MouseClick("left", 119, 563)
    Sleep(1000)
    Send("Skerb's Message")
    Sleep(1000)
    Send("{TAB}")
    Sleep(200)
    Send("{TAB}")
    Sleep(200)
    Send("{TAB}")
    Sleep(200)
EndFunc

? *WARNING* The above script will call the fcuntion over and over again sending keystrokes and clicking. I couldn't be bothered adding a Hotkey and just wanted to show you how to do it ^6^.

Edited by Burrup

qq

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...