Jump to content

need help with capturing strings


adamgal
 Share

Recommended Posts

Hi,

Anyone know if there's a simple way to trigger some function when the user types in a certain string (like in autohotkey)?

I know I can build something like that, but I wondered if there was something similar to sethotkey()

thanks,

Adam

Link to comment
Share on other sites

Sounds like you might want to check into a key logger. Unless I am mistaken you are wanting someone to type something like 'showmethemoney' and it executes a script?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

why not?

I just need it to automate some extremely tedious work and I have too many shortcuts for all of them to be alt-something ctrl-something etc. and still have it set up comfortably, basically I just need some way to get the last key that was pressed, like in GLUT.

the thing is, there are other free programs that do this but I couldn't find one with a half decent language and if I could do it in autoit it would save alot of headaches

Link to comment
Share on other sites

You can use one key for hundreds of functions if you like. Here I will show you how to use only the pause key with ALT, or Shift to do all your stuff.

hotkeyset("{pause}","start")
hotkeyset("!{pause}","display")
hotkeyset("+{pause}","stop")
$num=0
$x=Stringsplit("func1,func2,func3,func4,func5,func6",",")
start()
while 1
sleep(10)
wend


func display()
select
   case $num=1
     msgbox(1,"info","you selected " & $num )
   case else
   msgbox(1,"info","you can put a lot of cases like " & $num)
endselect
endfunc


func start()
if $num>5 then $num=0
$num=$num+1
tooltip("Pause to cycle"& @crlf &"Shift Pause to quit"& @crlf &"Press ALT+Pause for "&$x[$num],0,0)
endfunc

func stop()
exit
endfunc

This way it is available in any application, and doesn't need to be a key logger. You can set up an array for all your text, and if you had a lot of them, you could modify it to have 10 or 20 hotkeys per cycle instead of one.

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Here is a dynamic one, you can see I set it up to run programs that are in the array, but you can also set an array to do a lot more.

hotkeyset("{pause}","start")
hotkeyset("!{pause}","display")
hotkeyset("+{pause}","stop")
$num=0
$x=Stringsplit("info,notepad.exe,calc.exe,explorer.exe,c:\bob.exe,myprogram.exe",",")
start()
while 1
sleep(10)
wend


func display()
select
   case $num=1
     msgbox(1,"info","you selected " & $num )
   case else
   msgbox(1,'info','in this case, I would have done a run("'&$x[$num]&'")')
endselect
endfunc


func start()
if $num>=$x[0] then $num=0
$num=$num+1
tooltip("Pause to cycle"& @crlf &"Shift Pause to quit"& @crlf &"Press ALT+Pause for "&$x[$num],0,0)
endfunc

func stop()
exit
endfunc

AutoIt3, the MACGYVER Pocket Knife for computers.

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