Jump to content
Sign in to follow this  
tonsafun

If Button Pushed, Push Another

Recommended Posts

tonsafun

ok i am having a problem, i cant find how to do this.

when i push A, i want it to a different letter picked from an array randomly, so if i push A, it might send D or B. how would i do this?

Share this post


Link to post
Share on other sites
tonsafun

Use AutoItv3 (beta)

HotKeySet("a","RandomLetter")

While 1
     Sleep(100)
Wend

Func RandomLetter()
     $a = StringSplit("BCD","")
     Send($a[Int(RANDOM(3))])
EndFunc
can u break that down for me what each thing does? i am not that good at autoit

Share this post


Link to post
Share on other sites
tonsafun

so its not possible? it was for the arrows, if i hit any of the arrows i wanted it to push a random letter

any ideas on what can be done?

Edited by tonsafun

Share this post


Link to post
Share on other sites
tonsafun

k thx worked well, but can i delay the send key to every second?

Share this post


Link to post
Share on other sites
tonsafun

that does nothing, any other ideas? thx for the help btw

Share this post


Link to post
Share on other sites
tonsafun

i got it, sorry im newb that found the help file :whistle:

AutoItSetOption ("SendKeyDelay", 1000)

does the job

anyway to make it more random? it draws same pick quite often sorry for bugging btw

Edited by tonsafun

Share this post


Link to post
Share on other sites
tonsafun

it over flows when i do that can it be prevented?

also im doing 4 letters...not 3 so it never draws the 4th

Edited by tonsafun

Share this post


Link to post
Share on other sites
tonsafun

hmm when i set it as a hotkey, the key ignores its original function, i need it to do the new function, and the original function.

Share this post


Link to post
Share on other sites
tonsafun

yea i dont want that delayed i want that as normal :whistle:

Share this post


Link to post
Share on other sites
tonsafun

was wondering if u can do something like,

if certainbutton pushed then

blahblablha

endif

Share this post


Link to post
Share on other sites
tonsafun

well i need the up button to function as the up button as normal, and also push one of the four buttons (jkl;) at the same time with a one second delay, but the up button should run as normal with no delays

Share this post


Link to post
Share on other sites
CyberSlug

Don't know if this will help but, note that you can un-register a hotkey:

; When you press the left arrow key, the result is Ctrl+Left
;   which usually jumps the keyboard cursor to the previous
;   word in a text editor

HotKeySet("{Left}", "foo")

sleep(0) ;script runs forever until you terminate via tray icon

Func foo()
   HotKeySet("{Left}")
  ;unregister hotkey so that the the left arrow key can be sent
  ;  without causing foo() to call itself infinitely
   Send("^{Left}")
   HotKeySet("{Left}", "foo") ;re-register hotkey
EndFunc

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
tonsafun

how do u pause for a certain amount of time ?

nvm got it

Edited by tonsafun

Share this post


Link to post
Share on other sites
tonsafun

this is what did it

HotKeySet("{UP}","RandomLetter")
HotKeySet("{DOWN}","RandomLetter")
HotKeySet("{LEFT}","RandomLetter")
HotKeySet("{RIGHT}","RandomLetter")
$key = StringSplit("JKL;","")
While 1
  Sleep(10)
Wend

Func RandomLetter()
    HotKeySet("{UP}")
    HotKeySet("{DOWN}")
    HotKeySet("{LEFT}")
    HotKeySet("{RIGHT}")
    AutoItSetOption ("SendKeyDelay", 1000)
    Send($key[Int(RANDOM(4)+1)])
    HotKeySet("{UP}","RandomLetter")
    HotKeySet("{DOWN}","RandomLetter")
    HotKeySet("{LEFT}","RandomLetter")
    HotKeySet("{RIGHT}","RandomLetter")
EndFunc

one last question, is it possible to open IE and go to a webpage

Edited by tonsafun

Share this post


Link to post
Share on other sites
tonsafun

where in here is shift being pushed? cause it is somewhere, plz i need it gone.

HotKeySet("{UP}","RandomLetter")
HotKeySet("{DOWN}","RandomLetter")
HotKeySet("{LEFT}","RandomLetter")
HotKeySet("{RIGHT}","RandomLetter")
$key = StringSplit("JKL;","")
While 1
  Sleep(10)
Wend

Func RandomLetter()
    HotKeySet("{UP}")
    HotKeySet("{DOWN}")
    HotKeySet("{LEFT}")
    HotKeySet("{RIGHT}")
    AutoItSetOption ("SendKeyDelay", 1000)
    Send($key[Int(RANDOM(4)+1)])
    HotKeySet("{UP}","RandomLetter")
    HotKeySet("{DOWN}","RandomLetter")
    HotKeySet("{LEFT}","RandomLetter")
    HotKeySet("{RIGHT}","RandomLetter")
EndFunc

Share this post


Link to post
Share on other sites
CyberSlug

You are sending uppercase letters

$key = StringSplit("JKL;","")

Uppercase letters are Shift+lowercase

Maybe try:

StringSplit("{ShiftDown}j{ShiftUp},{ShiftDown}k{ShiftUp},{ShiftDown}l{ShiftUp},;", ",")

I've also had problems with shift.... this topic


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
CyberSlug

Run('"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www.hiddensoft.com/"')

Or it might be better to use (@ProgramFilesDir & '\Internet Explorer\iexplore.exe' & ' "http://www.hiddensoft.com/"')


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
tonsafun

can i just change to $key = StringSplit("jkl;","")?

Share this post


Link to post
Share on other sites
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.