While the addition of scripting will allow programmers to more easily add looping constructs to their modules, I also see a need for a basic looping facility for the non-programmers among us. I don’t want to force people into using Scripting to basic functions.
My idea is to add a looping option to ‘Trigger action’ for counter loops and to ‘Multi-action button’ for component loops.
Loop? Y/N
Hotkey before loop:
Loop X times OR Loop until property match is true
Hotkey after loop:
For Trigger Action, the before/after Hotkeys would be sent to the current counter. For the Mutlti-action button, the Hotkeys would be sent to the top level Component Hotkey handler.
I think this should allow you to implement the basic looping structures far more easily than the various complex schemes people have created to date.
Yep, that’s what I meant - allow the CP interrogate the key command.
Essentially this is similar to a passive TA where you would listen for a
certain key before performing another key, but instead we have two path
options we can follow instead of just the one, true - do this, false - do
that.
To do that today we need 2 similar secondary triggers and rely on 2
different PME’s in the trait stack after the primary trigger, so the
sequence goes down the right path.
By “will future scripting allow…” I meant you had mentioned something
before about you would be able to insert/use the key command into future
scripting somehow - not exactly sure what you intended. There is nothing
currently. It was in a thread here somewhere or email, will have to dig it
up
I don’t really see this as part of Calculated Property. I had envision this sort of thing more in stage 2 where you would fire off a ‘Script’ trait which would have a complete Java script in it that can do any sort of fancy stuff - Enquire on Control keys, fire off hot keys and key commands etc.
B.
*********** REPLY SEPARATOR ***********
On 28/06/2009 at 11:57 PM Tim McCarron wrote:
[quote]
Yep, that’s what I meant - allow the CP interrogate the key command.
Essentially this is similar to a passive TA where you would listen for a
certain key before performing another key, but instead we have two path
options we can follow instead of just the one, true - do this, false - do
that.
To do that today we need 2 similar secondary triggers and rely on 2
different PME’s in the trait stack after the primary trigger, so the
sequence goes down the right path.
By “will future scripting allow…” I meant you had mentioned something
before about you would be able to insert/use the key command into future
scripting somehow - not exactly sure what you intended. There is nothing
currently. It was in a thread here somewhere or email, will have to dig it
up
Yes, that is the idea. That the set of KeyStrokes in the ‘Perform these KeyStrokes’ will get repeatly run. The Hotkey before and after loop are additional keystrokes that will be performed prior and after running the loop section, even if the loop section does not run at all because the loop condition is not true.
I will need to play with the wording and layout to make sure it is clear. The references to ‘Hotkey’ should be to ‘KeyStrokes’ to keep things consistent.
How about this, immediately below the ‘Perform these Keystrokes’ section:
Repeatedly perform these Keystrokes? [checkbox, hides other repeat options when not checked[
Repeat KeyStrokes a specific number of times: [
Repeat KeyStrokes while property match is true: [ 3 types of loop to choose from ]
Repeat KeyStrokes until a property match is true: [
Perform this KeyStroke before repeating:
Perform this KeyStroke after repeating:
The while/until distinction will be a little unclear to non-programmers, but this can be explained in the reference manual. An Until loop is guaranteed to repeat the keystrokes at least once. A while loop may not repeat the keystrokes at all if the condition is already false.
I’d also like to get an index variable in there to make life easier. You can create this using the before/after keystroke and setting up a seperate Dynamic property, but it such a common requirement in a loop scenario that I think it should be included. How do you say ‘Loop Index Variable’ in non-programmer speak? The direct translation is a ‘Repeat counter Property’. How about:
Create a Property to count repeats? [Checkbox, hide next 3 options if unchecked]
Count Property Name:
Before repeating, set Count Property to: [integer]
At end of each repeat, Count Property by: [integer]