Processing hotkey as action ?

Discuss RoboTask here
Post Reply
llubse
Posts: 2
Joined: Sun Mar 18, 2007 6:08 am

Processing hotkey as action ?

Post 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
 
 
Last edited by llubse on Sun Mar 18, 2007 10:20 am, edited 1 time in total.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Processing hotkey as action ?

Post by Oleg »

Why do you not want to have two different tasks with different hotkeys? IMHO, this is simpler and more clearly.
llubse
Posts: 2
Joined: Sun Mar 18, 2007 6:08 am

Processing hotkey as action ?

Post 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.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Processing hotkey as action ?

Post 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"
Last edited by Oleg on Sun Mar 18, 2007 11:53 am, edited 1 time in total.
Post Reply