Page 1 of 1
Processing hotkey as action ?
Posted: Sun Mar 18, 2007 6:15 am
by llubse
I can define several hotkeys in one task.
If i have a task with two hotkeys, i.e. "A" and "B". Is it possible to program different actions depending on the pressed hotkey?
"A" pressed -> do action 1
"B" pressed -> do action 2
Processing hotkey as action ?
Posted: Sun Mar 18, 2007 6:29 am
by Oleg
Why do you not want to have two different tasks with different hotkeys? IMHO, this is simpler and more clearly.
Processing hotkey as action ?
Posted: Sun Mar 18, 2007 6:33 am
by llubse
Oleg wrote:Why do you not want to have two different tasks with different hotkeys? IMHO, this is simpler and more clearly.
Because it is for one application. I gave an example for two hotkeys. But it will eventually be 6 of 7 hotkeys. For me it is more clearly if it is one task. Especially when you have to disable the task so you can't forget one.
Processing hotkey as action ?
Posted: Sun Mar 18, 2007 7:46 am
by Oleg
If you attach a few hotkeys to the task, RoboTask can't determine, what hotkey has been pressed. Therefore you have to use the different tasks. But you can use a small trick.
Suppose we have a big task, but we want to do some different actions when we pressed different hotkeys ( or use the different triggers at all).
Create the main task with the following algorithm:
Do some general steps
if {TriggerFlag} = 1 then
Actions for 1-st hotkey
end if
if {TriggerFlag} = 2 then
Actions for 2-nd hotkey
end if
....
Do some general steps
Remove variable TriggerFlag
We use the TriggerFlag variable in order to tell to task what trigger has been fired.
Next, we have to create a few auxiliary tasks with different hotkeys or triggers like this:
Set variable TriggerFlag to 1 // 2 - for second trigger, 3 - for third, and so on.
Start task "Main task"