Stuck with padding a number with zeroes.
Moderator: Pulover
Stuck with padding a number with zeroes.
I saw the topic in StackOverflow "Add leading zero to make a 4-digit number in Autohotkey" but it simply does not work for me in Pulover Macro Creator.
The expression "Format("{:o}", 255) returns 377" works fine. But I need "Format("{:04}", Number)" and it does not work!
Can anybody help me with this, please!
The expression "Format("{:o}", 255) returns 377" works fine. But I need "Format("{:04}", Number)" and it does not work!
Can anybody help me with this, please!
- Attachments
-
- Pulover Macro Creator Format leading zeroes.jpg (61.84 KiB) Viewed 2055 times
Re: Stuck with padding a number with zeroes.
Verify you are using AHK v1.1.17+
Your code looks fine:
If you are using 1.1.17+ and it still does not work there could be an issue with the pulover tool.
(I don't use pulovers just trying to help)
Your code looks fine:
Code: Select all
var1 := 5
var1 := Format("{:04}", var1)
SendRaw %Var1%
(I don't use pulovers just trying to help)
Re: Stuck with padding a number with zeroes.
Thanks, it is 1.1.33.09... Tried to run it in just AHK and it works correctly. So this is a bug..
Re: Stuck with padding a number with zeroes.
This cannot work on PMC because of the way math expressions are held. Eval() can't tell if the given number parameter is supposed to be a string, so it must trim leading zeros. If I change that behavior, it will break math operations. There are other ways to accomplish that using string commands, but it's going to take more then one line.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Re: Stuck with padding a number with zeroes.
Does FormatTime function work? Substr function seems not to work either.
I need to take the time value from Excel, like 0800 or 1200, and pass it to a text field. What could be these lines of code..?
Anyway, it is very sad all this is not documented.
I need to take the time value from Excel, like 0800 or 1200, and pass it to a text field. What could be these lines of code..?
Anyway, it is very sad all this is not documented.
Re: Stuck with padding a number with zeroes.
Sometimes I think people expect too much from this free tool maintained by a single coder.
I've wrote a help file and I still get questions about things that are explained there... I'm not so much motivated as to write down as many details as possible about it.
I would give you an example if I could but I'm way too busy lately.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Re: Stuck with padding a number with zeroes.
Your are doing a great job! Thank you for that!
Re: Stuck with padding a number with zeroes.
Managed to do it with the Functions dialog box, it's Ok! Just needed some time to familiarize with the software:
- Attachments
-
- Format function - Ok.png (33.58 KiB) Viewed 1762 times
Re: Stuck with padding a number with zeroes.
Well done!
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)