Jump to content

starting and stopping a script


Recommended Posts

#include <misc.au3>

;

Local $Mousecords[2], $Started = 1

$end = 0

While $end = 0

WinWaitActive("Star Wars")

If _IsPressed(70) Then

$Mousecords = MouseGetPos()

Beep(800, 100)

While _IsPressed(70)

;

WEnd

EndIf

If _IsPressed(71) Then

If $Started = 0 Then

$Started = 1

Beep(800, 100)

Else

$Started = 0

Beep(400, 100)

EndIf

While _IsPressed(71)

;

WEnd

EndIf

If $Started = 1 Then

$I = 1

Do

MouseMove(1124,524)

MouseDown("Left")

Sleep(600)

Send("5432")

MouseUp("Left")

MouseDown("Left")

Sleep(400)

Send("5342")

MouseUp("Left")

$I += 1

Sleep(200)

Until $I = 4

Sleep(54325000)

EndIf

WEnd

how would i bind f1 to start this script and f2 to stop it?

Link to comment
Share on other sites

it's easier for us to read if you put the script in script tags & do script tidy before posting.

so are you wanting to run your compiled_script.exe when you hit a hot key you need to compile it, make a shortcut to the .exe then in the properties of the shortcut you can set normal windows hotkeys.

then if you want it to exit on a hotkey you need to set up the exit func and hot key.

just look up HotKeySet() in the help file.

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

#include <misc.au3>

;

Local $Mousecords[2], $Started = 1

$end = 0

While $end = 0

WinWaitActive("Star Wars")

If _IsPressed(70) Then

$Mousecords = MouseGetPos()

Beep(800, 100)

While _IsPressed(70)

;

WEnd

EndIf

If _IsPressed(71) Then

If $Started = 0 Then

$Started = 1

Beep(800, 100)

Else

$Started = 0

Beep(400, 100)

EndIf

While _IsPressed(71)

;

WEnd

EndIf

If $Started = 1 Then

$I = 1

Do

MouseMove(1124,524)

MouseDown("Left")

Sleep(600)

Send("5432")

MouseUp("Left")

MouseDown("Left")

Sleep(400)

Send("5342")

MouseUp("Left")

$I += 1

Sleep(200)

Until $I = 4

Sleep(54325000)

EndIf

WEnd

how would i bind f1 to start this script and f2 to stop it?

Link to comment
Share on other sites

  • Developers

i want it to put the moust position at the coords at f1, start with f2 and end with f3

yes...and ?

What have you done with the supplied help other than ignoring it?

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

yes...and ?

What have you done with the supplied help other than ignoring it?

well i read the tutorial but its greek to me

i dont know what any of that means i just took a script someone wrote for me and changed it so it works how i want it to and the only way i figured that out was i knew it was just pressing numbers and i set the mouse position

but as for code i dont know bubkis

Link to comment
Share on other sites

  • Developers

well i read the tutorial but its greek to me

i dont know what any of that means i just took a script someone wrote for me and changed it so it works how i want it to and the only way i figured that out was i knew it was just pressing numbers and i set the mouse position

but as for code i dont know bubkis

Then start learning and come back when you understand more or ask the person that wrote it for you.

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

i want it to put the moust position at the coords at f1, start with f2 and end with f3

im sorry mate, this just is not a specific enough question. i would help you out but i would need precise information on what you need to do. why dont you start with the first objective, explain it & i'll build it for you (im board atm, your lucky day maybe :)) then if we can get the first part agreed on as working we can move on to the next etc..

so maybe your first part might be something like :-

i want the mouse to move to x,y when the window "window name" is active

But try this first its my best guess from what you have given so far, put mouse where you want to check F1 to start F2 to stop & ESC key to exit script.

#include <misc.au3>
HotKeySet("{F1}", "start")
HotKeySet("{F2}", "stop")
HotKeySet("{ESC}", "escape")
main()
Func main()
    While 1
        Sleep(50)
    WEnd
EndFunc;==>main
Func start()
    $Mousecords = MouseGetPos()
    Beep(800, 100)
    While WinActive("Star Wars")
        $I = 1
        Do
            MouseMove(1124, 524)
            MouseDown("Left")
            Sleep(600)
            Send("5432")
            MouseUp("Left")
            MouseDown("Left")
            Sleep(400)
            Send("5342")
            MouseUp("Left")
            $I += 1
            Sleep(200)
        Until $I = 4
    WEnd
EndFunc;==>start
Func stop()
    Beep(400, 100)
    main()
EndFunc;==>stop
Func escape()
    Exit
EndFunc;==>escape

i didn't understand why you was getting the mouse cords but i left it in anyhow.

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

Thankyou

CODE
#include <misc.au3>

HotKeySet("{F1}", "start")

HotKeySet("{F2}", "stop")

HotKeySet("{F3}", "escape")

Hotkeyset("{F4}", "move")

main()

Func main()

While 1

Sleep(50)

WEnd

EndFunc;==>main

Func start()

While WinActive("Star Wars")

$I = 1

Do

MouseMove(1124, 524)

MouseDown("Left")

Sleep(600)

Send("5432")

MouseUp("Left")

MouseDown("Left")

Sleep(600)

Send("5342")

MouseUp("Left")

$I += 1

Sleep(600)

Until $I = 4

Sleep(10000)

WEnd

EndFunc;==>start

Func stop()

main()

EndFunc;==>stop

Func escape()

Exit

EndFunc;==>escape

Func move()

MouseMove(1124, 524)

EndFunc ;==>move

thats what i have now, now is there a way to make autoit ovveride the game commands, the game reconizes f1 f2 f3 f4 unless its windowed mode but can i make it bypass the game and still do the commands in non windowed mode

Edited by spider0804
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...