I have variables set:
yy_Var_Name = FolderName
yy_Var_Content = Dropbox
Using these 2 variables how do I do:
SET VARIABLE FolderName = Dropbox
Thanks.
I have variables set:
yy_Var_Name = FolderName
yy_Var_Content = Dropbox
Using these 2 variables how do I do:
SET VARIABLE FolderName = Dropbox
Thanks.
I'm afraid I'm not exactly sure what you mean, but you can set one variable to another variable's contents like this:
And you can similar set a variable to a combination of other variables like this:
The latter of which will give you:
If this doesn't answer your question, please respond with more detail, ideally including
The name of the actual variable I want set is assigned in #1
yy_Var_Name = FolderName -------(#1)
yy_Var_Content = Dropbox
Scenario 1:
yy_Var_Name = FolderName
yy_Var_Content = Dropbox
SET VARIABLE FolderName = Dropbox
Scenario 2:
yy_Var_Name = NEW-FolderName
yy_Var_Content = XYZ
I then need to:
SET VARIABLE NEW-FolderName = XYZ
I'm afraid I'm still not following you. When you say
Do you mean something like this:
or like this?
I'll also ask again:
In your example I mean the former.
Okay, great, that’s what I initially thought. But in that case, I’m still not sure what it is you want to know, since I already showed you in my first response how to set one variable to the contents of another, and how to combine two variables into a new one. I hate to sound like a broken record, but if my earlier responses don’t answer your question, it would really help if you shared more details about
You aren’t getting the point of my question. Can you please see my 2 scenarios described below.
The variable name I want to set is variable. It’s not fixed like usual.
Okay, I think I understand what you mean now. The counter-intuitive trick is to use the %Variable%[VARIABLE NAME]%
syntax in the Set Variable field:
###Results
This lets you set a variable as the name of another variable. If anything is still unclear, feel free to ask more questions or create a new topic. In the future, it would be very helpful if you provide more details on what you want to accomplish, including posting screenshots, but for now, hopefully this answers your question!
It’s still unclear.
Your third box (with the ORANGE text) indicates it’s an error and won’t actually run.
It doesn’t run when I try it on my KM either.
Can anyone else pass an opinion on my OP and my post #2 please?
I'm aware of the orange text, but in this case, it's not an error; it's more like a warning that there could be an error (at least, that's my understanding of it). Set Variable TO fields expect straight variable names, i.e. without the %Variable%[VARIABLE NAME]%
syntax that is needed to use them in standard text fields; it shows up as orange here because that's obviously not what we're doing. By using %Variable%yy_Var_Name%
in the third box's Set Variable TO field, we're telling KM to first process the yy_Var_Name
variable (which is set to "FolderName" as per the first box) so that it ends up setting the FolderName
variable rather than the yy_Var_Name
variable. Essentially, when the macro is run, the third box changes from this:
to this:
If you haven't been able to replicate my example, you can try my macro (which I have tested and verified as working) for yourself:
Yes, that’s working now. Thanks for your help.
That works for fields that expect a variable, but I can't figure out how to do a similar thing in a text field. Specifically, I'd like to set the default value of a Prompt For User Input action to the value of the variable that another variable is pointing to. For instance, if %Variable%PointerVar% = ActualVar, then I'd like the value of %Variable%ActualVar% to show up as the default by evaluating something like %Variable%%Variable%PointerVar%%, but I cant figure out a way to do it. I've tried several different adornments as well as the %Calculate% token. Have you ever done this?
Not in a Prompt for User Input action, but yes. The action you're looking for is the Filter to Value of Named Variable. In your example, you would just need to run PointerVar
through that filter before using it in the prompt:
Many thanks. I’d forgotten that filter existed, so that’s useful in its own right.
When you said not in a prompt, did you mean that you hadn’t done it for a prompt, or did you mean it’s not possible (directly) for a prompt?
No problem. I meant I hadn't used it in a prompt for my own personal use case before.