How to convert number to string?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mpsinfo
Junior Coder
Posts: 20
Joined: Mon Apr 19, 2021 1:31 pm

How to convert number to string?

Post by mpsinfo » Sat Aug 28, 2021 8:32 am

Sorry for the trivial question. I should enter a number converted to text into a URL.

Let>CC=0
Input>CC,Insert number (es. 100,70)

Let>CC=CC+10,20

Also I wanted to know if there is a more elegant way to insert URLs in a website window already open.
I currently use this system which works but I don't like it at all.

Msg>Vado su url
Wait>3

MouseMove>700,55 // barra in alto
Wait>0.5
LClick
Wait>0.5
Press Backspace * 100 // delete current url

Send>https://www.xxxxxx.com/%CC% // (CC is = 110,90 and not 110.90 this is the correct format with point)
Wait>1
Press Enter
Wait>2

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1378
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: How to convert number to string?

Post by Dorian (MJT support) » Sat Aug 28, 2021 10:32 am

If you want the URL to be something like https://www.xxxxxx.com/100,70 and the user enters 100,70, couldn't it simply be something like this?

Code: Select all

Let>TheURL=https://www.xxxxxx.com
Input>CC,Insert number

Let>NewURL=%TheURL%/%CC%
Regarding navigation, by far the best way is IENavigate / ChromeNavigate / EdgeNavigate. Chrome and Edge would only be possible if you'd started the Chrome / Edge session with ChromeStart or EdgeStart. IENavigate can either be started with IECreate or if you've started IE manually, you can use IEGetFromURL.

So if you're already at xxx.com in IE :

Code: Select all

IEGetFromURL>xxx.com,IE[0]
IENavigate>IE[0],https://www.xxxxxx.com/%CC%
If those are not an option for you, you can select the address bar in IE or Chrome with Ctrl + l or Alt + d.

So set focus to your browser, CTRL-l or ALT-d, then send the URL.
Yes, we have a Custom Scripting Service. Message me or go here

mpsinfo
Junior Coder
Posts: 20
Joined: Mon Apr 19, 2021 1:31 pm

Re: How to convert number to string?

Post by mpsinfo » Sat Aug 28, 2021 2:17 pm

Thanks for answer, but the number change and not is fix.

Code: Select all

Let>CC=0
Input>CC,Insert number (es. 100,70)

Let>CC=CC+10,20 // CC= 100,90


Send>https://www.xxxxxx.com/%CC%  // CC=100,90 and not point 100.90 !! 

with comma website non answer.
_______________________________________

Furthermore why:

Let>CC=0
Input>CC,Insert number (es. 100.70)

Add>CC,10.5
Msg>%CC%  // visual 111.20 with point
Wait>5
Let>CC=CC+10.20
Msg>%CC% // visual 121,40 with comma
Wait>5
Add and Let= +
are not the same command?

There is no command to remove?
example Minus>CC,10.5


Resend me please command for Chrome if this is for Internet Explorer

IEGetFromURL>xxx.com,IE[0]
IENavigate>IE[0],https://www.xxxxxx.com/%CC%
Last edited by mpsinfo on Sat Aug 28, 2021 3:31 pm, edited 2 times in total.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1378
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: How to convert number to string?

Post by Dorian (MJT support) » Sat Aug 28, 2021 2:31 pm

If you're simply trying to replace the comma with a dot, use stringreplace.
Yes, we have a Custom Scripting Service. Message me or go here

mpsinfo
Junior Coder
Posts: 20
Joined: Mon Apr 19, 2021 1:31 pm

Re: How to convert number to string?

Post by mpsinfo » Sat Aug 28, 2021 3:11 pm

Error why ?

Code: Select all

Let>SPX=150
Let>SPX=SPX+0,001
Msg>%SPX%
Wait>1

Let>string=%SPX%
Msg>%string%
Wait>1

StringReplace>string,1,9,pippo
Msg>%string% %pippo%  // screen 150,001 950,009  is OK

StringReplace>string,,,.,pippo // error access violation in address 0041991D in module msched.exe Read of address 00000000

Msg>%string% %pippo%
//Wait>1

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1378
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: How to convert number to string?

Post by Dorian (MJT support) » Sat Aug 28, 2021 5:16 pm

If you're replacing a comma, you have to use the system variable "comma" because commas are what separate the parameters in Macro scheduler commands.

Code: Select all

Let>SPX=150
Let>SPX=SPX+0,001
Msg>%SPX%
Wait>1
Let>string=%SPX%
Msg>%string%
Wait>1
StringReplace>string,1,9,pippo
Msg>%string% %pippo%
StringReplace>string,comma,.,pippo
Msg>%string% %pippo%
I see you like to use Input, so here's an example for if you wanted to use a comma in your question :

Code: Select all

Input>TheText,Fish%comma% Chips%comma% and peas,something
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts