Jump to content

Input's into Script


Recommended Posts

Ive been learning Autoit lately, trying to make a few simple programs for myself. I just started learning GUI's and such and I got one working now. But I haven't figured out how to get whats in my inputs into my script. I have 2 inputs, $First and $second, and I need each to be plugged into the script

My script is as follows

$i = 1

Do

Send("/target $First{Enter}")

Send("5")

Sleep(1510)

Send("/target $Second{Enter}")

Send("5")

Sleep(1510)

Send("/target $First{Enter}")

Send("5")

Sleep(1510)

Send("/target $Second{Enter}")

Send("5")

Sleep(1510)

Send("/target $First{Enter}")

Send("5")

Sleep(1510)

Send("/target $Second{Enter}")

Send("5")

Sleep(1510)

Send("/target $First{Enter}")

Send("3")

Sleep(1510)

Send("/target $Second{Enter}")

Send("3")

Sleep(1510)

Until $i > 1

Not sure how to get whats in the inputs in the place of $First and $Second in the script though

Any help would be appreciated :)

Link to comment
Share on other sites

Hi, wellcome on board! ^_^

But I haven't figured out how to get whats in my inputs into my script

Use GuiCtrlRead() to get data from controls, or GuiCtrlSetData() to set data :)

Like this:

#include <GuiConstants.au3>

$Gui = GuiCreate("Test")

$GetData_1_Button = GUICtrlCreateButton("Get data", 10, 40, 60, 20)
$Input_1 = GUICtrlCreateInput("Input 1", 80, 40, 300)

$GetData_2_Button = GUICtrlCreateButton("Get data", 10, 80, 60, 20)
$Input_2 = GUICtrlCreateInput("Input 2", 80, 80, 300)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GetData_1_Button
            $DataRead = GUICtrlRead($Input_1)
            MsgBox(0, "", $DataRead)
        Case $GetData_2_Button
            $DataRead = GUICtrlRead($Input_2)
            MsgBox(0, "", $DataRead)
    EndSwitch
WEndoÝ÷ Ú«¨µäÚ®¢ßíj¸·Mú*ì´Iízº®¢ßêº^!ü¨ºÚòx-¢Ç§tIíz»h²¥ªíË¥j·(Úè»­¶ß¢·±jje{*.q©î±à¨Úè'§u«­¢+Ø¥¹±Õ±ÐíÕ¥
½¹ÍѹÑ̹ÔÌÐì((ÀÌØíÕ¤ôÕ¥
ÉÑ ÅÕ½ÐíQÍÐÅÕ½Ðì¤((ÀÌØíQÍÑ ÕÑѽ¸ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíQÍÐÅÕ½Ðì°ÄÀ°ÈÀ°àÀ°ÈÀ¤((ÀÌØíM¹¹ÑÉ}  ÕÑѽ¸ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíM¹¹ÑÈѼQÍÐÅÕ½Ðì°ÄÀ°àÀ°ÄÈÀ°ÈÀ¤()U%MÑMÑÑ ¤()]¡¥±Ä($ÀÌØí5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí5Í($%
ÍÀÌØíU%}Y9Q}
1=M($$%á¥Ð($%
ÍÀÌØíM¹¹ÑÉ}    ÕÑѽ¸($$%
½¹Ñɽ±½ÕÌ ÀÌØíÕ¤°ÅÕ½ÐìÅÕ½Ðì°ÀÌØíQÍÑ    ÕÑѽ¸¤($$%
½¹Ñɽ±M¹ ÀÌØíÕ¤°ÅÕ½ÐìÅÕ½Ðì°ÀÌØíQÍÑ   ÕÑѽ¸°ÅÕ½Ðíí¹ÑÉôÅÕ½Ðì¤($%
ÍÀÌØíQÍÑ ÕÑѽ¸($$%5Í   ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí   ÕÑѽ¸lÅÕ½ÐìµÀìU%
ÑɱI ÀÌØíQÍÑ   ÕÑѽ¸¤µÀìÅÕ½ÐítÝ̱¥­ÅÕ½Ðì¤(%¹MÝ¥Ñ )]¹

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hi, wellcome on board! :)

Use GuiCtrlRead() to get data from controls, or GuiCtrlSetData() to set data :)

Like this:

#include <GuiConstants.au3>

$Gui = GuiCreate("Test")

$GetData_1_Button = GUICtrlCreateButton("Get data", 10, 40, 60, 20)
$Input_1 = GUICtrlCreateInput("Input 1", 80, 40, 300)

$GetData_2_Button = GUICtrlCreateButton("Get data", 10, 80, 60, 20)
$Input_2 = GUICtrlCreateInput("Input 2", 80, 80, 300)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GetData_1_Button
            $DataRead = GUICtrlRead($Input_1)
            MsgBox(0, "", $DataRead)
        Case $GetData_2_Button
            $DataRead = GUICtrlRead($Input_2)
            MsgBox(0, "", $DataRead)
    EndSwitch
WEndƒoÝŠ÷ Ú«¨µäžÚ®¢ßíj¸·Mú*ì´Iízº®¢ß꺋^!ü¨ºÚòŠx-¢Ç§tIíz»h²‰ž¥ªí‰Ë¥j·(žÚè•»­¶‰ß¢·±jje{*.q©î±à¨žÚè•'§u«­¢+Ø¥¹±Õ‘”€™±ÐíÕ¥
½¹ÍÑ…¹Ñ̹…ÔÌ™Ðì((˜ŒÀÌØíÕ¤€ôÕ¥
É•…Ñ” ™ÅÕ½ÐíQ•ÍЙÅÕ½Ðì¤((˜ŒÀÌØíQ•ÍÑ    ÕÑѽ¸€ôU%
Ñɱ
É•…Ñ•   ÕÑѽ¸ ™ÅÕ½ÐíQ•ÍЙÅÕ½Ðì°€ÄÀ°€ÈÀ°€àÀ°€ÈÀ¤((˜ŒÀÌØíM•¹‘¹Ñ•É}    ÕÑѽ¸€ôU%
Ñɱ
É•…Ñ•   ÕÑѽ¸ ™ÅÕ½ÐíM•¹¹Ñ•ÈѼQ•ÍЙÅÕ½Ðì°€ÄÀ°€àÀ°€ÄÈÀ°€ÈÀ¤()U%M•ÑMÑ…Ñ” ¤()]¡¥±”€Ä($˜ŒÀÌØí5Íœ€ôU%•Ñ5Íœ ¤(%MÝ¥Ñ €˜ŒÀÌØí5Íœ($%
…Í”€˜ŒÀÌØíU%}Y9Q}
1=M($$%á¥Ð($%
…Í”€˜ŒÀÌØíM•¹‘¹Ñ•É}  ÕÑѽ¸($$%
½¹Ñɽ±½ÕÌ ˜ŒÀÌØíÕ¤°€™ÅÕ½Ðì™ÅÕ½Ðì°€˜ŒÀÌØíQ•ÍÑ ÕÑѽ¸¤($$%
½¹Ñɽ±M•¹ ˜ŒÀÌØíÕ¤°€™ÅÕ½Ðì™ÅÕ½Ðì°€˜ŒÀÌØíQ•ÍÑ ÕÑѽ¸°€™ÅÕ½Ðíí¹Ñ•Éô™ÅÕ½Ðì¤($%
…Í”€˜ŒÀÌØíQ•ÍÑ ÕÑѽ¸($$%5Í   ½à À°€™ÅÕ½Ðì™ÅÕ½Ðì°€™ÅÕ½Ðí    ÕÑѽ¸l™ÅÕ½Ð쀙…µÀìU%
ÑɱI•… ˜ŒÀÌØíQ•ÍÑ  ÕÑѽ¸¤€™…µÀ쀙ÅÕ½Ðíṯ݅¥­•™ÅÕ½Ðì¤(%¹‘MÝ¥Ñ )]¹
lol that doesn't make a whole lot of sense to me, but If I were to post my script could you use mine as an example? Would make it easier to understand for future programs ^_^ Thanks for the reply by the way, and thank you for the welcome to the forum

Edit: Heres my script

AutoItSetOption ( "GUIOnEventMode",1 )
HotKeySet("{Scrolllock}","Stop")
HotKeySet("{Pause}","Pause")
#include <GUIConstants.au3>
Dim $Pause


$GUI = GUICreate("Hot Stacker v1.0", 400, 600, -1, -1)
WinsetOnTop("Hot Stacker v1.0", "",1)
GUICtrlCreateLabel("Hot Stacker v1.0", 150, 10)
GUICtrlCreateLabel("INSTRUCTIONS", 150, 80)
GUICtrlCreateLabel("1. Input the name of your first desired tank to have HOTS stacked on.", 10, 105)
GUICtrlCreateLabel("2. Input the name of your second desired tank to have HOTS stacked on.", 10, 130)
GUICtrlCreateLabel("3. Click the 'Start Bot' Button to start this bot.", 10, 155)
GUICtrlCreateLabel("Created By:Andrew N., Muat of MMOwned", 110, 260)
GUICtrlCreateLabel("This bot is intended for use by a druid.", 120, 290)
GUICtrlCreateLabel("I do not take any liability for your account being banned and/or suspended from the",0, 320)
GUICtrlCreateLabel("use of this program. If it does get banned or suspended, your shit out of luck :P", 1, 340)
$First = GUICtrlCreateInput("Target 1's Name", 150, 180 , 100 , 25 , 1)
$Second = GUICtrlCreateInput("Target 2's Name", 150, 210 , 100 , 25 , 1)
$StartBot = GUICtrlCreateButton("Start Bot", 155, 575, 100, 25)
GUICtrlSetOnEvent($StartBot, "bot")
$Lifebloombl = GUICtrlCreatePic(@ScriptDir & "\Lifebloom.gif",25,530, 64,64)
$Lifebloomtr = GUiCtrlCreatePic(@ScriptDir & "\LIfebloom.gif", 330, 10, 64, 64)
$Rejuvenationtl = GUICtrlCreatePic(@ScriptDir & "\Rejuvenation.gif", 25, 10, 64,64)
$Rejuvenationbr = GUICtrlCreatePic(@ScriptDir & "\Rejuvenation.gif", 330, 530, 64, 64)
$Treeoflifebm = GUICtrlCreatePic(@ScriptDir & "\Tree.gif", 175, 400, 64, 64)
GuiSetState(@SW_Show)
While 1
Wend
Guisetstate($StartBot,"Bot")


;Functions
Func Stop()
    MsgBox(0, "Quitting Hot Stacker v1.0", "Now Quitting Hot Stacker v1.0", 1)
    Exit
EndFunc

Func Pause()
    if $Pause = 1 Then
        global $Pause = 0
    Else
        global $Pause = 0
        While $Pause = 1
            Sleep(1000)
        WEnd
    EndIf
EndFunc

Func Bot()
    WinActivate("World of Warcraft")
    WinWaitActive("World of Warcraft")
    Sleep(3000)
    $i = 1
    Do
        Send("/target $First{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target $Second{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target $First{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target $Second{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target $Second{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target $First{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target $Second{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target $First{Enter}")
        Send("3")
        Sleep(1510)
        Send("/target $Second{Enter}")
        Send("3")
        Sleep(1510)
    Until $i > 1
EndFunc
Edited by Muatmessmoko
Link to comment
Share on other sites

Maybe..

Func Bot()
    WinActivate("World of Warcraft")
    WinWaitActive("World of Warcraft")
    Sleep(3000)
    $i = 1
    Do
        Send("/target" & GUICtrlRead($First) & "{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target" & GUICtrlRead($Second) & "{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target" & GUICtrlRead($First) & "{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target" & GUICtrlRead($Second) & "{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target" & GUICtrlRead($Second) & "{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target" & GUICtrlRead($First) & "{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target" & GUICtrlRead($Second) & "{Enter}")
        Send("5")
        Sleep(1510)
        Send("/target" & GUICtrlRead($First) & "{Enter}")
        Send("3")
        Sleep(1510)
        Send("/target" & GUICtrlRead($Second) & "{Enter}")
        Send("3")
        Sleep(1510)
    Until $i > 1
EndFunc
Link to comment
Share on other sites

I would like to add something here, to make it useful for other players also.

See, you're using keybindings, that are probably mapped to your main actionbar. Other players might not have their keys mapped like that, so why not use script commands instead?

You could do it like this

Send("/target" & GUICtrlRead($First) & "{Enter}")
        Send("{Enter}" & "/cast Lifebloom" & "{Enter}")
        Sleep(1510)
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...