When I use the Set Variable, I would like to have this text used as plain text:
%ICUDateTime%yyyy-MM-d, hh.mm.ss a%
Right now when I run this macro, it automatically converts it to the current date as seen below:
I would like to use this variable globally, but the way it is now, it always gets stuck with the date of when I ran the macro. How to make %ICUDateTime%yyyy-MM-d, hh.mm.ss a% be seen as just plain text? I tried using single and double quotes, but that doesn't change it.
I want to create a variable that I can use with other macros so I don't have to type that date format over and over again, so if I set the variable currentTime, for example, then I just need to use that whenever I want to use the current time when creating new folder actions.
Or for example, if I decide to change the format, I just need to change the variable, not all actions across multiple macros
This is the format I want to use, which is not available as a "default" format: 2022-05-12, 11.17.24 PM
When using certain formats, they use : and that it not allowed when creating folders or files, that's why I use a dot to separate the hour, minute, second.
That's what I tried initially and what made me start this thread. It's not working, because when I run the action it doesn't use the current date, it uses the date of the last time I ran the variable. Meaning, I can run it once, but the second time I run it, it doesn't do anything, because it's trying to create a folder with the exact same name as the one I created first.
But the goal of a variable is that you can change it and it will change the value everywhere. As much as a favorite action could make things easier, it doesn't allow future updates while updating every macro where the action is. Unless I'm missing something, because I've never used favorites.
When the Set Variable to Text action is set to process text, it sets the variable currentDate to the data that the '%ICUDateTime%` token represents at run-time:
"2022-05-13, 02.09.22 am"
When it is set to "Process Nothing", it sets currentDate to the literal string:
"%ICUDateTime%yyyy-MM-d, hh.mm.ss a%"
The Create New Folder action specifies a path at which to create a folder. Whatever currentDate is set as will make up part of that path, and that will either be the time captured when the variable was set or the literal string.
But you are asking for a Variable that is created by a maths, formula, token and want that “formula” to automatically change everywhere and to recalculate a new Value rather than use the original value that the formula arrived at, when the variable was created.
There is no mechanism for that (other than trying to break the formula down into every single mathematical element and number and making variables for each).
That could work for 1 + 2 where 1 and 2 are replaced by variables. But even in that case you would not be able to make “+” into a Variable directly. You would need to have a separate routine that looks to see if a Variable was say “+” or “-“ and applies the appropriate maths.
This would be completely impractical for your Date example and would anyway be too much work to make and too complex to use.
So, the answer to your question is, no you can’t do what you are asking.
But isn't this the exact same process when creating a variable? A variable sets a text and then when you call that variable, it uses that text.
I understand that we can have 2 formats:
1 - The variable gets assigned the date of when it was ran (Process Text Normally)
2 - The variable gets assigned a string/text (Process Nothing)
So in my mind, using the second option would be the right way to do it.
The issue here is that the New Folder action is not processing %ICUDateTime%yyyy-MM-d hh.mm.ss a% properly (in my opinion).
It should use the text based on the variable and then the action itself would interpret that as a variable and replace %ICUDateTime%yyyy-MM-d hh.mm.ss a% with the actual date. Pretty much the same when we manually type/paste %ICUDateTime%yyyy-MM-d hh.mm.ss a% into the field.
I think we could have an option to set this as a string, for example, if instead of Text Here - %Variable%VarName% (which would result, for example, in Text Here - The Sun is Shinning)
we used Text Here - "%Variable%VarName%" (look at the quotes)
then we would have the folder/file name as Text Here - %Variable%VarName%
@drdrang and @noisneil, what you guys are missing here, is that the goal is to use a variable that can easily be changed and used. The issue is not (only) that I need to remember this long string. yes, it helps, but I don't want to paste something that if needs to be changed in the future, then I have to go and open each macro, then each action, and change it. Let's say that one day I decide that instead of
2022-05-12, 11.17.24 PM
I want this
2022---05---12 - 11-17-24 PM
With a variable I just need to change it in one place.
The only way I found that this works (but I wanted to avoid that extra action) is to include an Execute Macro action before the New Folder action. This will execute the Variable macro (if it's set to Process Text) and update it to the current date. Will this be super accurate when it comes to the date, by the second or millisecond? Probably not, but in this particular case, not relevant. It gives me a pretty accurate date, different enough to create a new folder right away and end up with a new current date.
But yeah, my goal was to have variables work as they should (or what I think is the right way this should work)
Not sure I totally understand what you mean...
From what I'm reading, you are probably misunderstanding what I mean, maybe because I'm using the wrong wording?
When you use the Create Folder action and you type for example: New Folder Name - %ICUDateTime%yyyy-MM-d, hh.mm.ss a%
the Create Folder action itself will interpret this as New Folder Name - 2022-05-12, 11.17.24 PM
right? And that's the name of the folder
Now when I'm using a variable currentDate that has this value assigned %ICUDateTime%yyyy-MM-d, hh.mm.ss a%
(maybe this is what is causing the issue, that I use the word "value"?)
the end result should be exactly the same as when I manually type New Folder Name - %ICUDateTime%yyyy-MM-d, hh.mm.ss a%
So typing New Folder Name - %Variable%currentDate%
should be, at least in theory, the same as manually typing New Folder Name - %ICUDateTime%yyyy-MM-d, hh.mm.ss a%
because that's what a variable is for.
I understand that we could set the variable "type" when using the Process Text vs Process Nothing, but to me Process Nothing should just use plain text and then the New Folder action would create the conversion between currentDate and the %ICUDateTime%yyyy-MM-d, hh.mm.ss a% "code" (or whatever that's proper name that thing has...)
Is it making sense what I'm trying to explain?
Are we talking about the same end result and same workflow? Let me know
But when you set the variable to Process Nothing, it stops being a math, formula, token, and it becomes plain text, right? At least that's what I'm getting from that. That being said, when the variable becomes plain text, the New Folder action should interpret that as plain text so when using %Variable%currentDate%, the action should interpret this: New Folder Name - %Variable%currentDate%
as this New Folder Name - %ICUDateTime%yyyy-MM-d, hh.mm.ss a%
so when it processes that information, the end result should be: New Folder Name - 2022-05-12, 11.17.24 PM
Right now, when set to Process Nothing it ends up creating a folder with this name: New Folder Name - %ICUDateTime%yyyy-MM-d, hh.mm.ss a%