Stamp

New Here ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Hello, 

I have a custom stamp that increase a number or letter like: 1,2,3 or A, B, C
I want to upgrade the code of the stamp for increase like this: A1, A2, A3 or B1, B2, B3

how can i do this?

 

this is the code:

if( event.source.forReal && event.source.stampName == "#qT1ZWzIPGprVS_jnLHz-tB") {
if ("aincState" in event.source.source.info) {
if (!isNaN(event.source.source.info.aincState)) {
event.source.source.info.aincState = String(Number(event.source.source.info.aincState)+1);
} else if (event.source.source.info.aincState.length == 1) {
var ascii = event.source.source.info.aincState.charCodeAt(0);
if ((ascii >= 65 && ascii < 90) || (ascii >= 97 && ascii < 122)) {
event.source.source.info.aincState = String.fromCharCode(ascii+1)
} else if (ascii == 122) {
event.source.source.info.aincState = "a";
} else
event.source.source.info.aincState = "A";
} else {
event.source.source.info.aincState = "A";
}
} else {
event.source.source.info.aincState = app.response("Enter number or letter:", "Initialize State");
}
event.value = event.source.source.info.aincState;
}

TOPICS
JavaScript

Views

23

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation