Sign in to follow this  
Followers 0
Markus

Hotkeyset on array

4 posts in this topic

I have an keyarray with the hotkeys to set ($keys) and files to be executed ($files)

i have no idea how to build such a thing:

For $i=1 To $numberkeys
   Hotkeyset($keys[$i],afunction($files[$i]))
Next

"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Share this post


Link to post
Share on other sites



I have an keyarray with the hotkeys to set ($keys) and files to be executed ($files)

i have no idea how to build such a thing:

For $i=1 To $numberkeys
   Hotkeyset($keys[$i],afunction($files[$i]))
Next
Your reference to $keys[$i] should work, but you can't pass any parameters to the function, so it needs to be just "afunction". Then inside the function, you can use @HotKeyPressed to determine which key sent you there and perform the appropriate operation.

:)


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

Share this post


Link to post
Share on other sites

Your reference to $keys[$i] should work, but you can't pass any parameters to the function, so it needs to be just "afunction". Then inside the function, you can use @HotKeyPressed to determine which key sent you there and perform the appropriate operation.

:)

I agree with that.

There is also a way to pass parameters to functions with hot keys.

This is how your code would look

For $i=1 To $numberkeys
   SetOnEvent($keys[$i], "afunction", 1, $ParambyVal, $files[$i])
Next
.
.
. 
Func afunction($someVar)
.
..
EndFunc

This sets the hotkey sequence $key[$i] to call the function "afunction" with one parameter, which has the value of $files[$i].

SetOnEvent is in the UDF in my signature for passing parameters to functions with OnEvent and HotKeys.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

ty its quite easy with @hotkeypressed


"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

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