Quote from
Gaev on September 2, 2021, 12:01 am
@m-burdess
I can't recall a tip/trick I saw on the forum for converting string variable (containing numeric characters) to a number variable ... but the following code (using javascript) works ...
SetVar "[ImageNamePrefix]" "Image"
SetVar "[currentImage]" "[ImagenamePrefix]230"
... subroutine
StrReplace "[currentImage]" "[ImageNamePrefix]" "" [ImageSuffix] ""
BeginJS
var newSuffixNumber = parseInt($App.ImageSuffix) + 1;
$App.ImageSuffixString = newSuffixNumber.toString();
EndJS
SetVar "[newImage]" "[ImageNamePrefix][ImageSuffixString]"
AlertBox "newImage" "[newImage]" ""
Hope this is what you were looking for.
You should be able to use similar code for subtracting suffixes; of course, you may have to enhance it to take care of suffixes ending in 000.
@m-burdess
I can't recall a tip/trick I saw on the forum for converting string variable (containing numeric characters) to a number variable ... but the following code (using javascript) works ...
SetVar "[ImageNamePrefix]" "Image"
SetVar "[currentImage]" "[ImagenamePrefix]230"
... subroutine
StrReplace "[currentImage]" "[ImageNamePrefix]" "" [ImageSuffix] ""
BeginJS
var newSuffixNumber = parseInt($App.ImageSuffix) + 1;
$App.ImageSuffixString = newSuffixNumber.toString();
EndJS
SetVar "[newImage]" "[ImageNamePrefix][ImageSuffixString]"
AlertBox "newImage" "[newImage]" ""
Hope this is what you were looking for.
You should be able to use similar code for subtracting suffixes; of course, you may have to enhance it to take care of suffixes ending in 000.