hello,
i am fighting all day with strings and integer, a simple string2int or working CInt(string) funtion would solve the problem, but it doesnt work, so plese help me in another way.
I want to measure the elapsed time, and i do the following operations:
==============
VBSTART
VBEND
VBEval>Timer,opened
label>start
//200 lines of code, but not a single word include "open" or "close", there are no hidden characters
VBEval>Timer,closed
let>diff=closed-opened
if>diff>3000
goto>start
endif
=================
unfortunatelu the diff variable is recognized as STRING, i tried to do
if>{%closed%-%opened%}start
endif
and some parse errors occured, but it worked. Nevertheless i do not want any errors to occur.
I tried to use
VBEval>Timer-%opened%,elapsed
but i got complie errors when using that line
I am using Macro Sheduller 11
PLEASE HELP! I AM REALLY FED UP WITH THIS PROBLEM AND UNPROPER NUMBERS RECOGNITION
VB Timer returns string?? i need integer!
Moderators: Dorian (MJT support), JRL
Try:
Code: Select all
VBSTART
VBEND
VBEval>Timer,opened
label>start
//200 lines of code, but not a single word include "open" or "close", there are no hidden characters
VBEval>Timer,closed
//Percents around the variables
let>diff=%closed%-%opened%
let>diff=closed-opened
if>diff>3000
goto>start
endif
There are no "strings" or "integers" in Macro Scheduler. The individual functions deal with text and decide correctly what the text format might be. There is no requirement nor any method to declare a format.a simple string2int or working CInt(string) funtion would solve the problem,
then why i keep getting the error:deal with text and decide correctly
"Line: 138 Operator opMinus incompatible with String
Line: 138 Internal parser error. Code 10"
and line 138 and 137 are the followin ones:
Code: Select all
//Percents around the variables
let>diff=%closed%-%opened%
if>diff>3000
goto>start
endif
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
I have no problems with your code, copied below.
Works fine for me. I'm running Macro Scheduler 12.0.5.
Code: Select all
VBSTART
VBEND
VBEval>Timer,opened
label>start
//200 lines of code, but not a single word include "open" or "close", there are no hidden characters
VBEval>Timer,closed
let>diff=closed-opened
if>diff>3000
goto>start
endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hi rblack,
Make sure you have used Edit>Remove Trailing Spaces to ensure all of your variable names and variable values are what you expect.
Sometimes a contaminated variable value can be fixed as follows:
I ran your code in debug mode and got these values:
DIFF=3
CLOSED=29340.67578125
OPENED=29337.67578125
For some reason the results are not coming back as integers, but as a decimal number with a very unrealistic precision.
Please check the syntax of the CLOSED and OPENED values returned by the Timer. Do they contain the commas (the THOUSANDS_SEPARATOR). That will cause the error you see.
Your posts of code should not remove the percent signs if you use the Code button and click the Disable HTLM in this post checkbox.
Make sure you have used Edit>Remove Trailing Spaces to ensure all of your variable names and variable values are what you expect.
Sometimes a contaminated variable value can be fixed as follows:
Code: Select all
//variables intended to be numeric but may contain some extra characteres causing MS to interpret it as a string.
//remove extra characters by forcing a numeric interpretation
Let>opened=%opened%+0
Let>closed=%closed%+0
//Now the calculation should work
Let>diff=%closed%-%open%
DIFF=3
CLOSED=29340.67578125
OPENED=29337.67578125
For some reason the results are not coming back as integers, but as a decimal number with a very unrealistic precision.
Please check the syntax of the CLOSED and OPENED values returned by the Timer. Do they contain the commas (the THOUSANDS_SEPARATOR). That will cause the error you see.
Your posts of code should not remove the percent signs if you use the Code button and click the Disable HTLM in this post checkbox.