Jump to content

Autoit


Recommended Posts

Hey everyone, darn im soo tired i've been trying to find out how to make a dialog box by pressing a shortcutkey. After the dialog has poped up i wanted to type somthing and then click ok and then make it Sleep(3000) after that open notepad and make it Send w/e i typed. But ofcourse i havnt got to do that, thats why im here for help.

I did that with a INput box here is the code:

HotKeySet("{F5}", "Type")

HotKeySet("{F8}", "Pause")

HotKeySet("{F9}", "Quit")

While 1

Sleep(100)

Wend

Func Type()

While 1

$clip1 = InputBox("Message", "Enter/Paste text to Spam", "" )

Run("C:\Program Files\Starcraft\Starcraft.exe")

Sleep(700)

$i=0

Do

Send("{Enter}")

Send("" & $clip1)

Send("{Enter}")

until $i=10

wend

EndFunc

Func Quit()

While 1

Exit 0

Wend

Endfunc

Func Pause()

While1

Wend

Endfunc

Basically all that does is when i press F5 a inputbox pops up and what ever i type in it. Gets send to w/e window im on after its sleep time.

So i wanted to do that with a Dialog box because i wanted to Send Profiles that are more then 1 line at once.

This is what i have so far but it seems to make no sense what so ever:

dim $clip1

HotKeySet("{F7}", "Type")

HotKeySet("{F9}", "Pause")

Func Pause()

While 1

Wend

Endfunc

func type()

while 1

$clip1 = Dialog Box

Sleep(700)

$i=0

Do

Send("{Enter}")

Send("" & $clip1)

Send("{Enter}")

until $i=10

wend

EndFunc

GUICreate("Type What You Want To Spam Below") ; will create a dialog box that when displayed is centered

GUISetState (@SW_SHOW) ; will display an empty dialog box

$GUI_EVENT_CLOSE = "1"

$nEdit = GUICtrlCreateEdit ("Type Here", 3,3,300,180)

GUICtrlCreateButton ("Ok", 20,200,50)

GUISetState ()

for $n=1 to 5

GUICtrlSetData ($nEdit,@CRLF & "line "& $n)

next

$EM_LINEINDEX = 0x00BB

$EM_LINEFROMCHAR = 0x00C9

Do

$msg = GUIGetMsg()

if $msg >0 then

$n=GUICtrlSendMsg ($nEdit, $EM_LINEINDEX,-1,0)

$nline=GUICtrlSendMsg( $nEdit, $EM_LINEFROMCHAR,$n,0)

GUICtrlSetState ($nEdit,256) ; set focus

MsgBox (0,"Currentline",$nLine)

Endif

Until $msg = $GUI_EVENT_CLOSE

All this does is when i run it a Dialog box pops up right away and then when i press F7 it types random words or numbers...

Also i didnt include

#include gui.........au3.

because it says "Error reading #include gui.........au3."

Can anyone please look at these sources and see if they can help me, i really need it thank you for reading.

Link to comment
Share on other sites

few things that are a bit wrong about your script in general.

Do
Send("{Enter}")
Send("" & $clip1)
Send("{Enter}")
until $i=10

will loop forever. not 10 times.

also your pause function uses up alot of CPU,

put a sleep() in between the loop.

3: it should be #include <file.in.the.include.dir.au3>

(notice the <>)

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

few things that are a bit wrong about your script in general.

Do
Send("{Enter}")
Send("" & $clip1)
Send("{Enter}")
until $i=10

will loop forever. not 10 times.

also your pause function uses up alot of CPU,

put a sleep() in between the loop.

3: it should be #include <file.in.the.include.dir.au3>

(notice the <>)

<{POST_SNAPBACK}>

I wanted it to loop for ever, because i had the pause button so i can stop it at anytime thanks for the, pause information tho. But does anyone know how to make a dialog box pop up like the way i did with the inputbox.

Also w0uter i dont know what you mean by:

3: it should be #include <file.in.the.include.dir.au3>

(notice the <>)

Link to comment
Share on other sites

I wanted it to loop for ever, because i had the pause button so i can stop it at anytime thanks for the, pause information tho. But does anyone know how to make a dialog box pop up like the way i did with the inputbox.

Also w0uter i dont know what you mean by:

3: it should be #include <file.in.the.include.dir.au3>

(notice the <>)

<{POST_SNAPBACK}>

1

what wOuter meant was this

#include <GUIConstants.au3>

2

please post your code like this

[ code ] ; no spaces

paste your code here

[ /code ] ; no spaces

this way we can read it and try to help your messy script ( not a flame)

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

most people use "While 1" for an infinite loop.

<{POST_SNAPBACK}>

Ic ic ^.^ Learned somthing for next time :whistle: but Hey w0uter can you try to help me with the Dialogbox problem please. I need help on that really bad i just want a box to come up where you can type more then 1 line at once.
Link to comment
Share on other sites

1st

DONT POST TWICE IN TWO DIFFERENT THREADS

2nd

I asked you to send the script with [ code ] and end code [ /code]

3rd

try this

#include <GUIConstants.au3>
dim $clip1, $paused, $blah


HotKeySet("{F7}", "Type")
HotKeySet("{F9}", "Pause")


GUICreate("Type What You Want To Spam Below"); will create a dialog box that when displayed is centered

$nEdit = GUICtrlCreateEdit ("Type Here", 3,3,300,180)
$ok = GUICtrlCreateButton ("Ok", 20,200,50)

GUISetState (@SW_SHOW)

Do
    $msg = GUIGetMsg()
    if $msg = $ok then
        $blah = GUICtrlRead($nEdit)
        Run("notepad.exe")
        WinWaitActive("")
        Send($blah)
    Endif
    Sleep(50)
Until $msg = $GUI_EVENT_CLOSE

Func Pause()
 $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
Endfunc

func type()
;while 1
;$clip1 = Dialog Box
Sleep(700)
;$i=0
;Do
Send("{Enter}")
Send("" & $blah)
Send("{Enter}")
;until $i=10
;wend
EndFunc

not everything you want... but it's alot more than you had

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

1st

DONT POST TWICE IN TWO DIFFERENT THREADS

2nd

I asked you to send the script with [ code ] and end code [ /code]

3rd

try this

#include <GUIConstants.au3>
dim $clip1, $paused, $blah
HotKeySet("{F7}", "Type")
HotKeySet("{F9}", "Pause")
GUICreate("Type What You Want To Spam Below"); will create a dialog box that when displayed is centered

$nEdit = GUICtrlCreateEdit ("Type Here", 3,3,300,180)
$ok = GUICtrlCreateButton ("Ok", 20,200,50)

GUISetState (@SW_SHOW)

Do
    $msg = GUIGetMsg()
    if $msg = $ok then
        $blah = GUICtrlRead($nEdit)
        Run("notepad.exe")
        WinWaitActive("")
        Send($blah)
    Endif
    Sleep(50)
Until $msg = $GUI_EVENT_CLOSE

Func Pause()
 $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
Endfunc

func type()
;while 1
;$clip1 = Dialog Box
Sleep(700)
;$i=0
;Do
Send("{Enter}")
Send("" & $blah)
Send("{Enter}")
;until $i=10
;wend
EndFunc

not everything you want... but it's alot more than you had

8)

<{POST_SNAPBACK}>

Hey Valuater Thank You So Much. Also I apologize for posting it twice and the other mistake, sorry.

Your Source Is what i wanted Exactly Thank you very Much I was wondering if i can Send Color Text while doing that. Like what i type in the dialog box gets sended in red text or the color i pick is that possible is so -.- sorry but can u tell me how.

Thanks

Link to comment
Share on other sites

Hey Valuater Thank You So Much. Also I apologize for posting it twice and the other mistake, sorry.

Your Source Is what i wanted Exactly Thank you very Much I was wondering if i can Send Color Text while doing that. Like what i type in the dialog box gets sended in red text or the color i pick is that possible is so -.- sorry but can u tell me how.

Thanks

<{POST_SNAPBACK}>

Ic ic... Hmm the source you wrote for me works fine but i wanted to make the dialogbox

a hotkey i tried doing this

Func Open()
While 1
$nEdit = GUICtrlCreateEdit ("",3,3,300,200)
$ok = GUICtrlCreateButton ("Ok",0,210,50)
GUISetState (@SW_SHOW)
Do
$msg = GUIGetMsg()
if $msg = $ok then
$blah = GUICtrlRead($nEdit)
Run("C:\Program Files\Starcraft\Starcraft.exe")
WinWaitActive("Brood War")
Send("{Enter}")
Send($blah)
Send("{Enter}")
Endif
Sleep(50)
Until $msg = $GUI_EVENT_CLOSE
Wend
Endfunc

That code above doesnt seem to do anything when i press the hotkey.

Also i tried to do

Hotkeyset("F7", "Open")
Func Open()
While 1
$nEdit = GUICtrlCreateEdit ("",3,3,300,200)
$ok = GUICtrlCreateButton ("Ok",0,210,50)
GUISetState (@SW_SHOW)
Wend
Endfunc

$nEdit = GUICtrlCreateEdit ("",3,3,300,200)
$ok = GUICtrlCreateButton ("Ok",0,210,50)
GUISetState (@SW_SHOW)

Do
$msg = GUIGetMsg()
if $msg = $ok then
$blah = GUICtrlRead($nEdit)
Run("C:\Program Files\Starcraft\Starcraft.exe")
WinWaitActive("Brood War")
Send("{Enter}")
Send($blah)
Send("{Enter}")
Endif
Sleep(50)
Until $msg = $GUI_EVENT_CLOSE

That source worked but the problem with that was when i tried to type in the dialogbox it kept earsing and coming back for some reason. I wrote this

a gain because it was giving me a error when i didn't

$nEdit = GUICtrlCreateEdit ("",3,3,300,200)

$ok = GUICtrlCreateButton ("Ok",0,210,50)

GUISetState (@SW_SHOW)

I was just wondering how do i make it a Hotkey, thanks.

Link to comment
Share on other sites

here ya go

#include <GUIConstants.au3>
dim $clip1, $paused, $blah

HotKeySet("{F7}", "Open")
HotKeySet("{F9}", "Pause")

$My_GUI = GUICreate("Type What You Want To Spam Below"); will create a dialog box that when displayed is centered
$nEdit = GUICtrlCreateEdit ("Type Here", 3,3,300,180)
$ok = GUICtrlCreateButton ("Ok", 20,200,50)
GUISetState(@SW_HIDE, $My_GUI)

While 1
    Sleep(50)
WEnd

Func Pause()
$Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
Endfunc

Func Open()
GUISetState(@SW_SHOW, $My_GUI )
While 2
    $msg = GUIGetMsg()
    if $msg = $ok then
        $blah = GUICtrlRead($nEdit)
        Run("C:\Program Files\Starcraft\Starcraft.exe")
        WinWaitActive("Brood War") 
        Send("{Enter}") 
        Send($blah)
        Send("{Enter}") 
    Endif
    If $msg = $GUI_EVENT_CLOSE then Exit
Sleep(50)
WEnd 
Endfunc

glad you tried!

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Ic ic... Hmm the source you wrote for me works fine but i wanted to make the dialogbox

a hotkey i tried doing this

Func Open()
While 1
$nEdit = GUICtrlCreateEdit ("",3,3,300,200)
$ok = GUICtrlCreateButton ("Ok",0,210,50)
GUISetState (@SW_SHOW)
Do
$msg = GUIGetMsg()
if $msg = $ok then
$blah = GUICtrlRead($nEdit)
Run("C:\Program Files\Starcraft\Starcraft.exe")
WinWaitActive("Brood War")
Send("{Enter}")
Send($blah)
Send("{Enter}")
Endif
Sleep(50)
Until $msg = $GUI_EVENT_CLOSE
Wend
Endfunc

That code above doesnt seem to do anything when i press the hotkey.

Also i tried to do

Hotkeyset("F7", "Open")
Func Open()
While 1
$nEdit = GUICtrlCreateEdit ("",3,3,300,200)
$ok = GUICtrlCreateButton ("Ok",0,210,50)
GUISetState (@SW_SHOW)
Wend
Endfunc

$nEdit = GUICtrlCreateEdit ("",3,3,300,200)
$ok = GUICtrlCreateButton ("Ok",0,210,50)
GUISetState (@SW_SHOW)

Do
$msg = GUIGetMsg()
if $msg = $ok then
$blah = GUICtrlRead($nEdit)
Run("C:\Program Files\Starcraft\Starcraft.exe")
WinWaitActive("Brood War")
Send("{Enter}")
Send($blah)
Send("{Enter}")
Endif
Sleep(50)
Until $msg = $GUI_EVENT_CLOSE

That source worked but the problem with that was when i tried to type in the dialogbox it kept earsing and coming back for some reason. I wrote this

a gain because it was giving me a error when i didn't

$nEdit = GUICtrlCreateEdit ("",3,3,300,200)

$ok = GUICtrlCreateButton ("Ok",0,210,50)

GUISetState (@SW_SHOW)

I was just wondering how do i make it a Hotkey, thanks.

<{POST_SNAPBACK}>

Edited by Orochimaru
Link to comment
Share on other sites

here ya go

#include <GUIConstants.au3>
dim $clip1, $paused, $blah

HotKeySet("{F7}", "Open")
HotKeySet("{F9}", "Pause")

$My_GUI = GUICreate("Type What You Want To Spam Below"); will create a dialog box that when displayed is centered
$nEdit = GUICtrlCreateEdit ("Type Here", 3,3,300,180)
$ok = GUICtrlCreateButton ("Ok", 20,200,50)
GUISetState(@SW_HIDE, $My_GUI)

While 1
    Sleep(50)
WEnd

Func Pause()
$Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
Endfunc

Func Open()
GUISetState(@SW_SHOW, $My_GUI )
While 2
    $msg = GUIGetMsg()
    if $msg = $ok then
        $blah = GUICtrlRead($nEdit)
        Run("C:\Program Files\Starcraft\Starcraft.exe")
        WinWaitActive("Brood War") 
        Send("{Enter}") 
        Send($blah)
        Send("{Enter}") 
    Endif
    If $msg = $GUI_EVENT_CLOSE then Exit
Sleep(50)
WEnd 
Endfunc

glad you tried!

8)

<{POST_SNAPBACK}>

That source above doesnt work because first off when ever i put

#include <GUIConstants.au3>

at the top it always says Error reading GUIConstants.au3

Second thing is that i used that source u just gave me and it says

If $msg = $ok then

if $msg = ^ Error

Error: Variable used with out being declared

Link to comment
Share on other sites

Not to break up the romance, Valuator, but perhaps Orochimaru doesn't have GUIConstants.au3 in his Include directory.

@Orochimaru: Check your AutoIt3\Include directory to see if you have GUIConstants.au3 in there. If not, get it. I will even attach it here for you.

Link to comment
Share on other sites

That source above doesnt work because first off when ever i put

#include <GUIConstants.au3>

at the top it always says Error reading GUIConstants.au3

Second thing is that i used that source u just gave me and it says

If $msg = $ok then

if $msg = ^ Error

Error: Variable used with out being declared

<{POST_SNAPBACK}>

Thanks a lot you two :whistle:

It works fine now i found out what the problem was with #include <GUIConstants.au3>

I had to put the full link of where the file was located

#include <C:\Documents and Settings\nezar1\Desktop\autoit-v3.1.1\Include\GUIConstants.au3>

Well this works fine :dance: thanks a lot i one one more thing to ask =.= how do i make it when i click "Ok" button that the dialogbox it closes till the next time its hotkey is pressed but when it closes it sends the key also. For example like a inputbox you can click ok it'll close and send what u told it to send. If thats not possible how do i add a cancle button to close it cuz if i click it with the X button on top it closes whole program. Btw Thanks A lot!! You 2.

Link to comment
Share on other sites

Thanks a lot you two :whistle:

It works fine now i found out what the problem was with #include <GUIConstants.au3>

I had to put the full link of where the file was located

#include <C:\Documents and Settings\nezar1\Desktop\autoit-v3.1.1\Include\GUIConstants.au3>

Well this works fine :dance: thanks a lot i one one more thing to ask =.= how do i make it when i click "Ok" button that the dialogbox it closes till the next time its hotkey is pressed but when it closes it sends the key also. For example like a inputbox you can click ok it'll close and send what u told it to send. If thats not possible how do i add a cancle button to close it cuz if i click it with the X button on top it closes whole program. Btw Thanks A lot!! You 2.

<{POST_SNAPBACK}>

Take a look at GUISetState ().

Ex: GUISetState (@SW_Hide) <-- put that in your "if $msg = $ok then" statement.

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...