Jump to content

Basic script help


Recommended Posts

While 1

If _IsPressed('41') Then

Send ("{p}")

EndIf

wend

this is my script, right now it sends p when a is pressed

how can i change this so when i tap "a" "p" will be pressed until i hit "b"(as an example)

Link to comment
Share on other sites

i can't understand you, please re-explain in the clearly words

Edited by d4rk

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Hotkeyset("a", "p")

While 1
 Sleep(60000)
Wend

Func p()
 Hotkeyset("a")
 Hotkeyset("b", "stop")
 While 1
  Send("p")
 Wend
EndFunc()

Func stop()
 Hotkeyset("a", "p")
 Hotkeyset("b")
 While 1
  Sleep(60000)
 Wend
EndFunc

That should do it, not tested though.

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

Hotkeyset("a", "p")

While 1
 Sleep(60000)
Wend

Func p()
 Hotkeyset("a")
 Hotkeyset("b", "stop")
 While 1
  Send("p")
 Wend
EndFunc()

Func stop()
 Hotkeyset("a", "p")
 Hotkeyset("b")
 While 1
  Sleep(60000)
 Wend
EndFunc

That should do it, not tested though.

that's working now, the only problem is it doesn't seem to hold p down, just rapidly tap it

tabbed version of what i want:

-"a" makes "p" be held down

-"b" sends "b" and stops "p" from being held down

Edited by flick
Link to comment
Share on other sites

that's working now, the only problem is it doesn't seem to hold p down, just rapidly tap it

tabbed version of what i want:

-"a" makes "p" be held down

-"b" sends "b" and stops "p" from being held down

Perhaps more like this:

HotKeySet("{ESC}", "_Quit")
HotKeySet("a", "p")

While 1
    Sleep(20)
WEnd

Func p()
    HotKeySet("a")
    HotKeySet("b", "stop")
    Send("{p down}")
EndFunc   ;==>p

Func stop()
    HotKeySet("b")
    Send("{p up}")
    Send("b")
    HotKeySet("a", "p")
EndFunc   ;==>stop

Func _Quit()
    Exit
EndFunc   ;==>_Quit

Have a nice weekend...

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Perhaps more like this:

HotKeySet("{ESC}", "_Quit")
HotKeySet("a", "p")

While 1
    Sleep(20)
WEnd

Func p()
    HotKeySet("a")
    HotKeySet("b", "stop")
    Send("{p down}")
EndFunc   ;==>p

Func stop()
    HotKeySet("b")
    Send("{p up}")
    Send("b")
    HotKeySet("a", "p")
EndFunc   ;==>stop

Func _Quit()
    Exit
EndFunc   ;==>_Quit

Have a nice weekend...

:)

the only problem is when i first hit "a" it sends "p" instead

this happens when i first start it, or when i restart it after hitting b

Link to comment
Share on other sites

the only problem is when i first hit "a" it sends "p" instead

this happens when i first start it, or when i restart it after hitting b

So use _IsPressed() in the While/WEnd loop instead of the HotKeySet() for "a":

#include <misc.au3>

HotKeySet("{ESC}", "_Quit")

While 1
    If _IsPressed("41") Then 
        Send("{p down}")
        Sleep(250) ; button debounce
    EndIf
    If _IsPressed("42") Then 
        Send("{p up}")
        Sleep(250) ; button debounce
    EndIf
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...