home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Products
IR Server Suite (IRSS)
Macros: Variables available?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="and-81" data-source="post: 224673" data-attributes="member: 11844"><p>I can tell you now that the next version of the IR Server Suite <em>will have</em> variables, it will be a pretty simple implementation but it will actually be quite powerful if used imaginatively.</p><p></p><p>Here are the commands it will support to begin with:</p><p></p><p>(this stuff is really for those people who already understand it, but I'll try to explain it for everyone)</p><p></p><p><strong>Label</strong></p><p>Labels are just markers within the macro that you can jump to with a "goto" or "if" command. Usually a macro is run one command at a time starting at the top and working it's way down. Labels let you mark out different areas of the macro so you can jump around inside the macro and change the order that commands are executed in, or jump past areas of the macro all-together.</p><p></p><p><strong>Goto ( Label )</strong></p><p>The goto label command lets you use the labels you have marked out to jump around inside your macro, changing the order the commands are executed in. By itself this is not very useful at all, but combined with a couple of other commands it becomes quite powerful.</p><p></p><p><strong>Set Variable ( Variable Name, Value )</strong></p><p>With Set Variable you can assign a value to a variable that will hold that value until you shut down the program/plugin that created it. All variable names must start with "var_" so the macro can tell the difference between a variable and a value you want to compare/assign.</p><p></p><p>The Value assigned to a variable can be anything you like, and it will be up to you, the macro programmer, to keep track of what the different variables you create mean. When assigning a value to a variable you can use escape codes, environment variables (eg. "%PATH%"), and a few special codes that will be described in more detail later but which include "%$CLIPBOARD_TEXT$%", "%$DATE$%", "%$TIME$%" and a few more. If you have any suggestions for data you'd like to store in a variable then please let me know.</p><p></p><p><strong>If ( Value1, Comparison Type, Value2, Goto Label )</strong></p><p>This is a simple "if statement" that will execute a Goto command if the condition is met.</p><p>Available comparison types are:</p><p>== (equals)</p><p>!= (does not equal)</p><p>> (greater than)</p><p>< (less than)</p><p>>= (greater than or equal to)</p><p><= (less than or equal to)</p><p>contains (Value1 contains the text in Value2)</p><p>starts with (Value1 starts with the text in Value2)</p><p>ends with (Value1 ends with the text in Value2)</p><p></p><p>All variables and values are considered to be strings (eg. "hello") unless you use a >, <, >=, or <= comparison in which case they are converted to a number and then compared. If the string does not translate to a number then the if statement will fail but will not interrupt the macro.</p><p></p><p>Some examples:</p><p></p><p><em>If "10" > "8" goto foo</em></p><p>This command will always goto the label "foo" because 10 and 8 are numbers and 10 is greater than (>) 8.</p><p></p><p><em>If "10" <= "goodbye" goto bar</em></p><p>This command will not work because "hello" and "goodbye" have no number representation, this if command (and any if command that tries to compare a number with a non-number) can never evaluate true and so will never execute the goto portion of the command.</p><p></p><p><em>If "var_test" contains "hello" goto hello</em></p><p>Now we see the use of a variable (var_test) and the "contains" comparison. There is no way to predict the outcome of this command without knowing what is contained within the variable var_test. If var_test = "I say, <strong>hello</strong> world." then the goto command would be executed because the "contains" comparison would be true.</p><p></p><p><em>If "var_ABC" != "var_XYZ" goto ABYZ</em></p><p>Here we see the use of two variables (var_ABC and var_XYZ) and the "does not equal" comparison type (!=). If var_ABC = "true" and var_XYZ = "false" then the goto command will execute because var_ABC does not equal var_XYZ.</p><p></p><p><em>if "var_notset" == "" goto NotSetYet</em></p><p>If you try to use a variable in an if statement and that variable has not been Set then it will evaluate and the variable will be considered to be empty. So the above example will execute the goto portion.</p><p></p><p></p><p></p><p>What's left to do:</p><p></p><p>The first release of variables will probably only include the above commands, but I plan to add some more commands ... as follows (please suggest any you think I'm missing) ...</p><p></p><p><em>Clear Variables</em> - To completely wipe clean the variables list that is in memory.</p><p><em>Save Variables ( file )</em> - To save all variables to a file so that they can be loaded back at another time.</p><p><em>Load Variables ( file )</em> - To load variables that were previously saved with the Save Variables command.</p><p><em>Swap Variables (var1, var2)</em> - Takes two variables and swaps their values.</p><p><em>String operations</em> - Concatenate two strings, To Upper Case, To Lower Case, etc ...</p><p><em>Integer maths</em> - Add, Subtract, Multiply, Divide, Modulo, etc...</p><p></p><p>More advanced programming statements (switch, while...do, for loop, etc ...) might get included later but are already able to be created through clever use of the existing functions. So I will most likely concentrate on adding commands that are not currently available. The most important commands to include are probably the Integer maths commands because they can make looping (especially) a lot easier to code.</p><p></p><p>I will post back a few example macros when I release the next version, I'm not at home right now so I can't attach my first example (a toggle macro) until later.</p><p></p><p>All feedback welcome.</p><p></p><p>Cheers,</p></blockquote><p></p>
[QUOTE="and-81, post: 224673, member: 11844"] I can tell you now that the next version of the IR Server Suite [I]will have[/I] variables, it will be a pretty simple implementation but it will actually be quite powerful if used imaginatively. Here are the commands it will support to begin with: (this stuff is really for those people who already understand it, but I'll try to explain it for everyone) [B]Label[/B] Labels are just markers within the macro that you can jump to with a "goto" or "if" command. Usually a macro is run one command at a time starting at the top and working it's way down. Labels let you mark out different areas of the macro so you can jump around inside the macro and change the order that commands are executed in, or jump past areas of the macro all-together. [B]Goto ( Label )[/B] The goto label command lets you use the labels you have marked out to jump around inside your macro, changing the order the commands are executed in. By itself this is not very useful at all, but combined with a couple of other commands it becomes quite powerful. [B]Set Variable ( Variable Name, Value )[/B] With Set Variable you can assign a value to a variable that will hold that value until you shut down the program/plugin that created it. All variable names must start with "var_" so the macro can tell the difference between a variable and a value you want to compare/assign. The Value assigned to a variable can be anything you like, and it will be up to you, the macro programmer, to keep track of what the different variables you create mean. When assigning a value to a variable you can use escape codes, environment variables (eg. "%PATH%"), and a few special codes that will be described in more detail later but which include "%$CLIPBOARD_TEXT$%", "%$DATE$%", "%$TIME$%" and a few more. If you have any suggestions for data you'd like to store in a variable then please let me know. [B]If ( Value1, Comparison Type, Value2, Goto Label )[/B] This is a simple "if statement" that will execute a Goto command if the condition is met. Available comparison types are: == (equals) != (does not equal) > (greater than) < (less than) >= (greater than or equal to) <= (less than or equal to) contains (Value1 contains the text in Value2) starts with (Value1 starts with the text in Value2) ends with (Value1 ends with the text in Value2) All variables and values are considered to be strings (eg. "hello") unless you use a >, <, >=, or <= comparison in which case they are converted to a number and then compared. If the string does not translate to a number then the if statement will fail but will not interrupt the macro. Some examples: [I]If "10" > "8" goto foo[/I] This command will always goto the label "foo" because 10 and 8 are numbers and 10 is greater than (>) 8. [I]If "10" <= "goodbye" goto bar[/I] This command will not work because "hello" and "goodbye" have no number representation, this if command (and any if command that tries to compare a number with a non-number) can never evaluate true and so will never execute the goto portion of the command. [I]If "var_test" contains "hello" goto hello[/I] Now we see the use of a variable (var_test) and the "contains" comparison. There is no way to predict the outcome of this command without knowing what is contained within the variable var_test. If var_test = "I say, [B]hello[/B] world." then the goto command would be executed because the "contains" comparison would be true. [I]If "var_ABC" != "var_XYZ" goto ABYZ[/I] Here we see the use of two variables (var_ABC and var_XYZ) and the "does not equal" comparison type (!=). If var_ABC = "true" and var_XYZ = "false" then the goto command will execute because var_ABC does not equal var_XYZ. [I]if "var_notset" == "" goto NotSetYet[/I] If you try to use a variable in an if statement and that variable has not been Set then it will evaluate and the variable will be considered to be empty. So the above example will execute the goto portion. What's left to do: The first release of variables will probably only include the above commands, but I plan to add some more commands ... as follows (please suggest any you think I'm missing) ... [I]Clear Variables[/I] - To completely wipe clean the variables list that is in memory. [I]Save Variables ( file )[/I] - To save all variables to a file so that they can be loaded back at another time. [I]Load Variables ( file )[/I] - To load variables that were previously saved with the Save Variables command. [I]Swap Variables (var1, var2)[/I] - Takes two variables and swaps their values. [I]String operations[/I] - Concatenate two strings, To Upper Case, To Lower Case, etc ... [I]Integer maths[/I] - Add, Subtract, Multiply, Divide, Modulo, etc... More advanced programming statements (switch, while...do, for loop, etc ...) might get included later but are already able to be created through clever use of the existing functions. So I will most likely concentrate on adding commands that are not currently available. The most important commands to include are probably the Integer maths commands because they can make looping (especially) a lot easier to code. I will post back a few example macros when I release the next version, I'm not at home right now so I can't attach my first example (a toggle macro) until later. All feedback welcome. Cheers, [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Products
IR Server Suite (IRSS)
Macros: Variables available?
Contact us
RSS
Top
Bottom