AlomWare Toolbox Forum

General Category => Help and Support => Topic started by: oblivion on May 07, 2026, 09:57:13 PM

Title: IDs and using multiple user variables at once
Post by: oblivion on May 07, 2026, 09:57:13 PM
My current automation project is about rewrapping and requoting text-format emails. The detail doesn't much matter, but my query is if I can use an ID to capture the parameter I want to feed to the 
String: Word wrap at function.

So I tried to write my action so I could choose a right margin for the text when I invoked it. I collected a response, stored it in an ID I called margin, then after I'd finished getting the text ready to be rewrapped, fed the word wrap function the current string$ with the right margin set to my stored margin variable.

String: Word wrap at "margin"
And it didn't work. It dropped an error saying that my margin needed to be greater than zero and stopped.

I tried again, thinking maybe that "margin" might have needed to be "margin$".

Still nothing.

So I looked for an alternative way to hold a number for later use, remembered about 
Counter: Assign "string$"[which is far from being its intended use but necessity is the mother of invention and all that]

so used counter$ to hold the collected right margin and All Is Now Well. :)

The current, working, form of the action is at the end.

So I've clearly misunderstood the use of the IDs for variable storage. Can you set me right, please?

And how should I have tackled this issue?

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Action: Comment "Remove quote chevrons, rewrap then replace chevrons"
0002 Action: Abort if no clipboard text ""
0003 Alert: Ask for a choice "#Wrap to what width?~20~30~40~50~60~70"
0004 String: Assign "alert$"
0005 Action: Do next step if "string$=blank$"
0006   String: Assign "68"
0007 Counter: Assign "string$"
0008 String: Assign from clipboard text ""
0009 String: Replace text "~>>=~"
0010 String: Replace text "~>=~"
0011 String: Replace text "~~=[para]"
0012 String: Replace text "~=space$"
0013 String: Replace text "[para]=~~"
0014 String: Word wrap at "counter$"
0015 String: Replace text "~=~>space$"
0016 Clipboard: Assign text "string$"
0017 Action: Do this block if "clip$<>"""
0018   Wait: For milliseconds to pass "200"
0019   Keyboard: Paste ""
0020 Action: End of block ""
(End)
Title: Re: IDs and using multiple user variables at once
Post by: Paul (Lead Developer) on May 07, 2026, 11:41:15 PM
Quote from: oblivion on May 07, 2026, 09:57:13 PMI've clearly misunderstood the use of the IDs for variable storage. Can you set me right, please?

String IDs are just a way of saving the string to disk with a name (the ID). You can later assign it back into the string, like this:

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 String: Assign from random number "1-6"
0002 String: Save as ID "dice"
0003 String: Clear ""
0004 String: Assign from ID "dice"
0005 Alert: Show a message "The saved string was: string$"
(End)

So, they're used for string permanence for when you might need to use the string's content again in future. They're not used as a string variable per se, but as a way to assign a string variable.

For your action, it's good if it's working for you. I personally might use the "data$" variable instead of "counter$" (below), but it's up to you.

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at [url="http://alomware.com/paste.png"]alomware.com/paste.png[/url]
0001 Action: Comment "Remove quote chevrons, rewrap then replace chevrons"
0002 Action: Abort if no clipboard text ""
0003 Alert: Ask for a choice "#Wrap to what width?~20~30~40~50~60~70"
0004 Data: Assign "alert$"
0005 Action: Do next step if "data$=blank$"
0006   Data: Assign "68"
0007 String: Assign from clipboard text ""
0008 String: Replace text "~>>=~"
0009 String: Replace text "~>=~"
0010 String: Replace text "~~=[para]"
0011 String: Replace text "~=space$"
0012 String: Replace text "[para]=~~"
0013 String: Word wrap at "data$"
0014 String: Replace text "~=~>space$"
0015 Clipboard: Assign text "string$"
0016 Action: Do this block if "clip$<>"""
0017   Wait: For milliseconds to pass "200"
0018   Keyboard: Paste ""
0019 Action: End of block ""
(End)