I was wondering if there is any way to trigger a script with a global variable or another KM internal method without using the check if an external file has changed method trigger.
To provide some background, we presently use KM on a regular basis on our small business office on about three computers. For KM script library maintenance we maintain the library on our server and then allow it to sync to the user computers. Since all scripts are then passed to each computer, we have a global script that triggers at KM engine launch or user login on the user computer which enables and disables script groups based on the reference computer name which we make part of the script group name. Doing so, prevents trigger conflicts with scripts which are appropriate to another computer but have the same trigger, and also eliminates performance issues, since only the resulting enabled groups are being called when a trigger is activated. We have been using this method for years and so far all has been going great.
In addition to the above, recently, I was looking to develop a computer specific startup script to manage a startup procedure for the particular computer the script was running on, such as what apps to turn on, how to layout the app windows, etc... However, since this script must only run after the initial global script is finished, because the global script needs to first enable it, there is no clean way, that I am aware of, of triggering it outside of using the check if an external file has changed method trigger. I have considered putting the trigger on a timer but, depending on the amount of script groups, the initial global script needs to enable and disable, will cause the time to either be too long for some computers and too short for others.
I feel the cleanest solution would be to trigger the startup script with a global variable which is filed at the end of the initial global script.
Is such a method possible?
Thank you in advance for looking into it and the support.
Thanks for the quick follow up. The execute macro action at the end of the global script would not be suitable since the computer specific start up script would vary due to the computer name. As far as I am aware the execute macro action requires the script to be specifically specified and can not use a variable.
...believe it or not I actually had not considered triggering the macro with a script at the end of the global macro. Sometimes things do really just need another set of eyes or in this case mind.
The solution works perfectly. Thank you both for the support.
OK, to be clear, I think you are using "script" when you mean "macro". That will be my assumption. It is very important to use the correct term, since KM supports BOTH Macros and Scripts.
So, in your case, when you call another Macro (known as "Sub-Macro") using an Execute a Macro action, you can provide a parameter which would identify the Computer it is being run on.
Actually, since there is a token for MacName, you could just have a Switch Action in the Sub-Macro with a case for each MacName you need to handle.
I am sorry, I should have been clearer with the terminology. But, you are correct with your assumption.
Concerning the Execute a Macro action, please correct me if I am wrong, but I believe the only options under the action are a drop down in which you must specifically specify the macro that will need to run.
I am aware, I can create a macro with a Switch Action that will only runs based on the MacName. But I find such a method not so versatile since I would like the overall setup to be easily scalable, especially if additional computers are added, with the least amount of macro editing and adjustments as possible.
At the present time, if a new computer is added, I just duplicate an existing group of macro groups and use a separate macro to update the group names with the name of the new computer. Once the group name has been updated, unless the user of the computer would like any of existing macros to run differently or would like additional macros added, outside of the group name update, there is no additional editing required since the global macro discussed above handles the macro group activity.