Problems with point and comma.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Humanetico
Newbie
Posts: 4
Joined: Tue Aug 16, 2011 6:03 am

Problems with point and comma.

Post by Humanetico » Tue Aug 16, 2011 6:59 am

Please, help me. I wrote this code in Macroscheduler:

Code: Select all

ReadIniFile>c:\Parâmetros.ini,PorcentagemStop Robô,PorcentagemDoStop,PorcentagemStop
Let>PorcentagemStop=%PorcentagemStop%/100
MessageModal>%PorcentagemStop%
The value in parameter PorcentagemDoStop in .ini file is 0.1. Sometimes the MessageModal instruction show me 0.001 (with point) and sometimes 0,001 (with comma). When the value of variable PorcentagemStop turns to 0,001 (instead 0.001) this cause a error in my calculations with the variable, for example: 'Line: 123 Operator OpMult incompatible with String'. If I close and restart Macrosheduler again, for a while the bug disapear. I'm using the version 12.1.4e from Macroscheduler. I'm doing something wrong? Thank you.

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

hello

Post by PepsiHog » Thu Aug 18, 2011 11:17 pm

Just use StringReplace.

Code: Select all

ReadIniFile>c:\Parâmetros.ini,PorcentagemStop Robô,PorcentagemDoStop,PorcentagemStop
let>comma=,
let>point=.
StringReplace>PorcentagemStop,%comma%,%point%,PorcentagemStop
Let>PorcentagemStop=%PorcentagemStop%/100
MessageModal>%PorcentagemStop%

That should do it. Ofcourse, are you using a new enough version that you'd have StringReplace?

edit - I see you are using a new enough version. Didn't initially read the last bit. Sorry.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Humanetico
Newbie
Posts: 4
Joined: Tue Aug 16, 2011 6:03 am

Post by Humanetico » Fri Aug 19, 2011 7:59 am

Thank you, PepsiHog, for your Help. Your solution bypass Macroscheduler strange behavior.

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