Sign in to follow this  
Followers 0
coolness

Help With Multi Hotkeying

12 posts in this topic

Here is the script that I do have. it will allow me to choose one hotkey to auto write one message. but when I try to duplicate that sectoin of code, and change [f1} to {F2} in the secound string, it says its a duplicate funtion. please help, if you can.

run("notepad.exe")

HotKeySet( "{F1}", "_Open")

While 1

Wend

Func _Open ()

send("Yes f1 wrote this.")

EndFunc ;==>_Open

that script works just fine.

this one doesn't work.

run("notepad.exe")

HotKeySet( "{F1}", "_Open")

While 1

Wend

Func _Open ()

send("Yes f1 wrote this.")

EndFunc ;==>_Open

HotKeySet( "{F2}", "_Open")

While 1

Wend

Func _Open ()

send("Yes f2 wrote this.")

EndFunc ;==>_Open

Could someone please tell me what I'm doing wrong?

Share this post


Link to post
Share on other sites



You mentioned this is another section, I thought you were asking there. And stop with the large fonts.

Anyways, you are getting exactly the error you should be getting. You are putting "Func _Open" twice. You can't have 2 functions with the same name in the same file.

Share this post


Link to post
Share on other sites
do you know how, I can get it to work, to where it will allow multiple hotkey functions, under one. script?

Share this post


Link to post
Share on other sites

do you know how, I can get it to work, to where it will allow multiple hotkey functions, under one. script?

Write. a full. sentence, using, proper grammar?

Tell the second hotkey to go to a different function. Like IceKirby said, it doesn't have anything to do with you calling it twice or using different hotkeys to call it, the reason it isn't working is because you have two declarations of Func _Open(). Call one _Open2() and you'll be fine.

Next time post support questions in the support forum. This is the Scripts and Scraps forum, a place for posting complete programs.

Share this post


Link to post
Share on other sites

Write. a full. sentence, using, proper grammar?

Easy for a person living the language!

Please reply in a neutral language, Esperanto. (hmm, not that I speak it :) )

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Comon guys hes a nooby. its not his fault he was just born that way. lol

it should look like this:

Opt("SendKeyDelay", 0);speed
run("notepad.exe")
HotKeySet( "{F1}", "_Open")
HotKeySet( "{F2}", "_Open2")
While 1
Wend

Func _Open ()
send("Yes f1 wrote this." )
EndFunc;==>_Open
Func _Open2 ()

send("Yes f2 wrote this.")
EndFunc;==>_Open2

That's it

Edited by zerocool60544

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites
I can run f1-f12 as hotkeys. However I would like to add a ctrl+whatever alt+whatever, as hotkeys too. example ctrl+q or ctrl+qw Or Alt+Q or Ctrl+QW. could someone tell me how to add that to the script?

Share this post


Link to post
Share on other sites

use {ctrl}{f1} or ^{f1}

READ YOUR HELP FILE


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites
That worked for Ctrl, just need to find out alt, thanks zerocool.

Share this post


Link to post
Share on other sites

Read your helpfile and stop repeating questions.

Share this post


Link to post
Share on other sites

This is a very bad way to write a program.

A basic skeletton would be :

HotKeySet("{F1}", "_yourfunc")
HotKeySet("{F2}", "_yourfunc")
HotKeySet("{F2}", "_yourfunc")
....

While 1
WEnd

Func _yourfunc()
Switch @HotKeyPressed
  Case "{F1}"
    Send("F1 pressed")
  Case "{F2}"
    Send("F2 pressed")
  Case "{F3}"
    Send("F3 pressed")
EndSwitch
EndFunc

I wrote it just here, not tested, but it should work with few debug.

Apzo

Share this post


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
Sign in to follow this  
Followers 0