Jump to content

"Lots of headache" ro "Simple solution is near"


Recommended Posts

Can`t find the same problem on the forum. But im sure that it is simple.

what i need:

After pressing a "start" button i need the program sanding something to the window

after pressing a "stop" button i need it to STOP doing it ;)

BUT it doesnt doing what i want.

that is my code:

#include <GUIConstants.au3>

GUICreate("NHF",130,70)
GUISetState ()
$butt1=GUICtrlCreateButton("start",10,10,55,50)
$butt2=GUICtrlCreateButton("stop",65,10,55,50)
$label3=GuiCtrlCreateLabel("By Harusal",166,55,55,15)
GuiSetState()

While 1
$msg=GuiGetMsg()
Select
Case $msg=$butt1  
    call("Start")
Case $msg=$butt2  
    Call("Stop")
Case $msg=$GUI_EVENT_CLOSE
    Exit
EndSelect
Wend

Func Start()
WinActivate ("sd.txt - Блокнот")
While 1
Send ("{1}")
WEnd
EndFunc

Func Stop()
    ; what to do to stop the Start Func???
EndFunc

I found another solution which i dont like.

how? im creating two scripts. first will be sanding command to window, second will be starting or killing the first one :blink:

it looks like that:

THE 1st process (Start.exe)

While 1
WinActivate ("blahblahblah")
send {"{1}")
Wend

THE 2nd process

#include <GUIConstants.au3>

GUICreate("NHF",130,70)
GUISetState ()
$butt1=GUICtrlCreateButton("start",10,10,55,50)
$butt2=GUICtrlCreateButton("stop",65,10,55,50)
$label3=GuiCtrlCreateLabel("By Harusal",166,55,55,15)
GuiSetState()

While 1
$msg=GuiGetMsg()
Select
Case $msg=$butt1  
    Run ("Start.exe")
Case $msg=$butt2  
    ProcessClose("Start.exe")
Case $msg=$GUI_EVENT_CLOSE
    Exit
EndSelect
Wend

Please HELP!!!! :P

Link to comment
Share on other sites

  • Developers

Couple of observations:

1. Do not use Call()

2. Reason script 1 doesn't work is because Start() never returns thus you are not checking for any buttons pressed anymore!

3. Which games are you trying to automate?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Couple of observations:

1. Do not use Call()

2. Reason script 1 doesn't work is because Start() never returns thus you are not checking for any buttons pressed anymore!

3. Which games are you trying to automate?

Jos

can u show or say what better to use instead of Call()

and how to make Start() return???

i`ve automated warping and asteroid harvesting in EVE online with the second variant

and now i`m trying to automate honor farming in WOW (not official server) ;)

BUT the reason why im doing it:

1) a hobby after work

2) is practice with programing and English a little (im from Ukraine :blink: )

Edited by kokaaaaa
Link to comment
Share on other sites

Couple of observations:

1. Do not use Call()

2. Reason script 1 doesn't work is because Start() never returns thus you are not checking for any buttons pressed anymore!

3. Which games are you trying to automate?

Jos

thanks a lot!

ive got it!

#include <GUIConstants.au3>

GUICreate("NHF",130,70)
GUISetState ()
$butt1=GUICtrlCreateButton("start",10,10,55,50)
$butt2=GUICtrlCreateButton("stop",65,10,55,50)
$label3=GuiCtrlCreateLabel("By Harusal",166,55,55,15)
GuiSetState()

While 1
$msg=GuiGetMsg()
Select
Case $msg=$butt1  
    call("Start")  
Case $msg=$GUI_EVENT_CLOSE
    Exit
EndSelect
Wend

Func Start()
Do
    $msg=GuiGetMsg()
ControlSend ("blah", "", "", "{1}")
Until $msg= $butt2 
EndFunc
Link to comment
Share on other sites

Couple of observations:

1. Do not use Call()

2. Reason script 1 doesn't work is because Start() never returns thus you are not checking for any buttons pressed anymore!

3. Which games are you trying to automate?

Jos

But i`m still interested what i can use instead of Call()??

Link to comment
Share on other sites

We don't do bots here. Read the announcement.

i`m not asking you to help me make a bot. i made it already.

i`m asking you to help me solve the problem. i ask u to teach me, to give me an advice.

as i sad i need it not for making bot, i need it cause is interesting for me :blink:

Link to comment
Share on other sites

  • Developers

i`m not asking you to help me make a bot. i made it already.

i`m asking you to help me solve the problem. i ask u to teach me, to give me an advice.

as i sad i need it not for making bot, i need it cause is interesting for me :blink:

as stated...

*click*

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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