Jump to content

Hotkeyset not working!


jammu
 Share

Recommended Posts

This is my script

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

HotKeySet("{F4}", "ExitProg")

Func StartProg()

While 1

sleep(300)

MouseClick("left",463, 216)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",492, 215)

Sleep(300)

MouseClick("left",970, 753)

WEnd

Func ExitProg()

Exit

EndFunc

And it gives this error always when i syntaxcheck

: ERROR: syntax error

Func

^

: ERROR: ExitProg(): undefined function.

HotKeySet("{F4}", "ExitProg")

Link to comment
Share on other sites

  • Developers

Run it through tidy and you will understand (i hope):

HotKeySet("{F3}", "StartProg")
HotKeySet("{F4}", "ExitProg")

Func StartProg()
    While 1
        Sleep(300)
        MouseClick("left", 463, 216)
        Sleep(300)
        MouseClick("left", 964, 752)
        Sleep(300)
        MouseClick("left", 964, 752)
        Sleep(300)
        MouseClick("left", 492, 215)
        Sleep(300)
        MouseClick("left", 970, 753)
    WEnd
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
    Func ExitProg()
        Exit
    EndFunc   ;==>ExitProg
;### Tidy Error -> func is never closed in your script.

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

  • Moderators

jammu,

You do not end StartProg before you start ExitProg!. You need to add an EndFunc between these 2 lines:

WEnd
; <<<<<<<<<<<<<<<<<<<<< Add EndFunc here
Func ExitProg()

2 tips:

1. Use Tidy on your scripts - it will pick up on these errors. Press Ctrl-T within SciTE or use the Tools menu.

2. When you post code, please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here).

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

i made it like this now

HotKeySet("{INSERT}", "StartProg")

HotKeySet("{END}", "ExitProg")

Func StartProg()

While 1

sleep(300)

MouseClick("left",463, 216)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",492, 215)

Sleep(300)

MouseClick("left",970, 753)

WEnd

EndFunc

Func ExitProg()

Exit

EndFunc

When i start it and press INSERT it wont start clicking :S annoying

Link to comment
Share on other sites

  • Moderators

jammu,

You need to add some form of loop to keep your script active, otherwise it exits as soon as you have set the HotKeys. ;)

I would suggest:

While 1
    Sleep(10)
WEnd

M23

P.S. Did you read what I posted above about code tags?

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

jammu,

Where do you think it might go? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Developers

damn, i'm just stupid ;) can you type that to my script please? :evil: i just can't get it

c'mon, learn some basics to help yourself. 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

  • Moderators

jammu,

You only have a While...WEnd loop inside one of your functions. ;)

Run through what you want your script to do:

It has 2 functions which you want to run when HotKeys are pressed - those are now properly defined by Func...EndFunc. The main part of the script sets these HotKeys and then does what? At the moment: nothing, it just exits. So you you need to keep the script active at this point:

Set HotKeys

Loop

Functions

When this is done the script remains active so your HotKeys can activate the functions. :evil:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

While 1

HotKeySet("{INSERT}", "StartProg")

HotKeySet("{END}", "ExitProg")

WEnd

Func StartProg()

While 1

sleep(300)

MouseClick("left",463, 216)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",492, 215)

Sleep(300)

MouseClick("left",970, 753)

WEnd

EndFunc

Func ExitProg()

Exit

EndFunc

? ;) yeahyeah call me dumb whatever.. -.-

Link to comment
Share on other sites

;\\\\\\\\\\\\\\\\\\\\Set hotkeys
HotKeySet("{F3}", "_Start")
HotKeySet("{F4}", "_Pause")
HotKeySet("{F5}", "_Exit")
;////////////////////

;\\\\\\\\\\\\\\\\\\\\Declare vars
Global $i
;////////////////////

;\\\\\\\\\\\\\\\\\\\\Main loop
While 1
    Sleep(1000)
WEnd
;////////////////////

;\\\\\\\\\\\\\\\\\\\\Functions
Func _Start()
    While 1
        Sleep(100)
        $i += 1
        ToolTip($i)
    WEnd
EndFunc   ;==>_Start

Func _Pause()
    ToolTip("Program paused.")
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_Pause

Func _Exit()
    Exit
EndFunc   ;==>_Exit
;////////////////////

Edited by Info
Link to comment
Share on other sites

Ok it works now but not in the game :/

I have KAROS online minimized and i open the script, then i go to karos and press "INSERT" it won't start but when i dont go to karos it starts.. Like the autoit wouldnt receive the command from me :e

Sorry for bad english. I hope you understand

Link to comment
Share on other sites

  • Moderators

jammu,

And does that match what I suggested? NO! ;)

You are redeclaring your HotKeys every pass of that loop and you will run into huge problems with CPU usage - in fact I think you might well be at 100% and so you will not get your script to work properly.

Go and read what I posted above AGAIN and try and put the loop I suggested in the place I recommended.

M23

P.S. And if you post your code again without CODE TAGS, I will NOT help any more. :evil:

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

jammu,

Which part of:

You need to add some form of loop to keep your script active, otherwise it exits as soon as you have set the HotKeys. I would suggest:

While 1

Sleep(10)

WEnd

and

Set HotKeys

Loop

Functions

do you not understand?

M23

P.S. That nice man Info has given you solution directly if you look carefully!

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

jammu,

This is not good:

While 1
HotKeySet("{INSERT}", "StartProg")
HotKeySet("{END}", "ExitProg")
WEnd

It uses far too much of your processor and can even crash your system. :evil: As I said before, you only need to declare the HotKeys once. The code should read:

HotKeySet("{INSERT}", "StartProg")
HotKeySet("{END}", "ExitProg")

While 1
    Sleep(10)
WEnd

As to why it does not work in your game - ask a gamer! ;) Although I seem to have heard somewhere that certain games might be protected against things like botting - I wonder if that could have something to do with it? :evil:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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