Leading Zeros get removed

Advanced Macro Recorder/Editor.

Moderator: Pulover

Posts: 3
Joined: 05 Apr 2018, 01:56

Leading Zeros get removed

05 Apr 2018, 05:23

Hi again,

I have a problem with leading zeros that get removed when using "subStr". That only happens when run from within PMC. The exported script runs correctly. What can I do to keep my leading zeros with PMC?
Here is some example Code:

Code: Select all

[PMC Code v5.0.5]|||1|Window,2,Fast,0,1,1,InputThenPlay,-1,-1,1|1|Macro1
1|[Assign Variable]|testvar := substr("0000001",-2)|1|0|Variable|Expression||||
2|[MsgBox]|testvar is: %testvar%|1|0|MsgBox|0||||
Content of "testvar" is "1"

Code: Select all

; This script was created using Pulover's Macro Creator
; www.macrocreator.com

SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode InputThenPlay
#SingleInstance Force
SetTitleMatchMode 2
AutoTrim On
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1

testvar := substr("0000001",-2)
MsgBox, 0, , testvar is: %testvar%
Content of "testvar" is "001"
User avatar
Posts: 2401
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY

Re: Leading Zeros get removed

05 Apr 2018, 09:04

SetFormat, float,7.0
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
If you have forum suggestions please submit a pull request
Posts: 3
Joined: 05 Apr 2018, 01:56

Re: Leading Zeros get removed

09 Apr 2018, 09:38

Hello Tank,
SetFormat, float,7.0
Thx for this try, bit it seems like this is another command that cannot be selected with Pulovers Macro Creator - at least I didn't find a way to use "SetFormat". Am I just blind?

Kind regards,


Return to “Pulovers Macro Creator”

Who is online

Users browsing this forum: No registered users and 5 guests