Jump to content

Whats wrong with this script?


Recommended Posts

Im trying to make a basic autolooter. It should when you hit PageUP start hitting Z rapidly, and when you hit PageDown, it should stop hitting Z.

$1=2

HotKeySet("{PGDN}", "end")

Func end()

$1=2

EndFunc

HotKeySet(" {PGUP} ", "begin")

Func begin()

$1=1

EndFunc

While $1=1

Send ( "Z" )

WEnd

When I changed it to an .exe it doesnt even open =(.

EDIT: It opens really fast than closes because the script .

Is there someting that says.

Like if $1=2 then wait until $1=1.

So while $1=2 the script does nothing and is just waiting

Edited by milkman
Link to post
Share on other sites

umm just a guess here but inside of a function if you use $1=1 then i believe it will make a new local variable ($1) and it wont edit the one outside of the function so try like

global $1=2


HotKeySet("{PGDN}", "end")
Func end()
global $1=2
EndFunc

HotKeySet(" {PGUP} ", "begin") 
Func begin()
global $1=1
EndFunc


While $1=1
Send ( "Z" )
WEnd

i may be wayoff base here but i think im close :o

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites

just add a

While 1
Sleep(100)
WEnd

to the top

--i think that'll do it

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites
  • Moderators

Global $1 = 2

HotKeySet("{PGDN}", "end")
HotKeySet("{PGUP}", "begin")

While 1
    Sleep(100000)
WEnd

Func begin()
    $1 = 1
    While $1 = 1
        Send ( "Z" )
    WEnd
EndFunc


Func end()
    $1 = 2
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites
  • Moderators

Did you bother to run it? It does work.

Edit:

Here's an example... try running the Exact code rather than trying to impliment what your trying to do, then you'll see it working and go from there.

Global $1 = 2

HotKeySet("{PGDN}", "end")
HotKeySet("{PGUP}", "begin")

While 1
    Sleep(100000)
WEnd

Func begin()
    $1 = 1
    While $1 = 1
        ConsoleWrite('Z' & @LF)
      ;Send ( "Z" )
    WEnd
EndFunc
Func end()
    $1 = 2
    ConsoleWrite('Z Has Been Stopped')
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites

What is the differnce between these two scripts?

This doesnt work

Global $1=2

HotKeySet(" {PGUP} ", "begin")

HotKeySet("{PGDN}", "end")

While 1

Sleep (1000000000000)

Wend

Func begin()

$1=1

While $1=1

Send ( "Z" )

WEnd

EndFunc

Func end()

$1=2

EndFunc

This DOES work

Global $1 = 2

HotKeySet("{PGDN}", "end")

HotKeySet("{PGUP}", "begin")

While 1

Sleep(100000)

WEnd

Func begin()

$1 = 1

While $1 = 1

ConsoleWrite('Z' & @LF)

;Send ( "Z" )

WEnd

EndFunc

Func end()

$1 = 2

ConsoleWrite('Z Has Been Stopped')

EndFunc

The only thing I can find different is that smoke used console write. How is that different than send, and when should I use this?

Sorry, im trying to understand.

EDIT: Awww sorry It was a problem when Compiling it, it works on beta test now =)

Edited by milkman
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...