I have this line of code
WriteLn>WriteFilePath,result,Let>X=X+%OffsetX%
the + is seen as concantenate how can I end up writing X=X+67 ?
(67 as ex of a variable number)
no matter what I try i end up with x=x67
inserting a plus sign into a text string
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Strange - it works for me. I don't see how the + would be seen as a concatinator for two reasons 1) it is NOT a concatinator in MacroScript and 2) you have it in a string in a WriteLn command - there is no variable assignation or processing going on there.
The following script:
Let>OffsetX=67
Let>WriteFilePath=d:\test.txt
WriteLn>WriteFilePath,result,Let>X=X+%OffsetX%
Gives me a file that looks like this:
Let>X=X+67
The issue you are seeing must be caused by something else - not these lines of code.
The following script:
Let>OffsetX=67
Let>WriteFilePath=d:\test.txt
WriteLn>WriteFilePath,result,Let>X=X+%OffsetX%
Gives me a file that looks like this:
Let>X=X+67
The issue you are seeing must be caused by something else - not these lines of code.
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?
In the help it does say + is used for concanenation
But apparently there is something in the code, I cannot get the if statement If>OffsetX>=0,PosX to go to label PosX, I have tried several variations . I inserted a message box to verify the variable OffsetX is
positive. I have used this type if statement branching to labels elsewhere
in the macro without trouble. I have tried everything I can possibly think of (used % around the variable used{} ect, tried , you name it I tried it)
I appreciate your help
Let>OffsetX=Xstring-StartXat
Let>OffsetY=Ystring-StartYat
Message>OffsetX
Wait>0.3
If>OffsetX>=0,PosX
WriteLn>WriteFilePath,result,Let>X=X%OffsetX%
Goto>DoneWithX
Label>PosX
WriteLn>WriteFilePath,result,Let>X=X+%OffsetX%
Label>DoneWithX
IF>OffsetY>=0,PosY
WriteLn>WriteFilePath,result,Let>Y=Y%OffsetY%
Goto>DoneWithY
Label>PosY
WriteLn>WriteFilePath,result,Let>Y=Y%+OffsetY%
Label>DoneWithY
But apparently there is something in the code, I cannot get the if statement If>OffsetX>=0,PosX to go to label PosX, I have tried several variations . I inserted a message box to verify the variable OffsetX is
positive. I have used this type if statement branching to labels elsewhere
in the macro without trouble. I have tried everything I can possibly think of (used % around the variable used{} ect, tried , you name it I tried it)
I appreciate your help
Let>OffsetX=Xstring-StartXat
Let>OffsetY=Ystring-StartYat
Message>OffsetX
Wait>0.3
If>OffsetX>=0,PosX
WriteLn>WriteFilePath,result,Let>X=X%OffsetX%
Goto>DoneWithX
Label>PosX
WriteLn>WriteFilePath,result,Let>X=X+%OffsetX%
Label>DoneWithX
IF>OffsetY>=0,PosY
WriteLn>WriteFilePath,result,Let>Y=Y%OffsetY%
Goto>DoneWithY
Label>PosY
WriteLn>WriteFilePath,result,Let>Y=Y%+OffsetY%
Label>DoneWithY
Me_again is correct, you can't do >= in a simple If> but you can use it in a complex If>
If>{%OffsetX%>=0},PosX
will work.
I have also seen the + to concatenate in the help for Complex Expressions, String Operators. In fact its the only thing there. But I have yet to find a way to make it work. Nothing you have posted makes a plus sign concatenate text for me.
I have altered the script that you have posted to make it function properly. I've highlighted the changes in red
Let>WriteFilePath=C:\esuohlluf_test.txt
Let>Xstring=33
Let>Ystring=33
Let>StartXat=20
Let>StartYat=20
Let>OffsetX=Xstring-StartXat
Let>OffsetY=Ystring-StartYat
If>{%OffsetX%>=0},PosX
WriteLn>WriteFilePath,result,Let>X=X%OffsetX%
Goto>DoneWithX
Label>PosX
WriteLn>WriteFilePath,result,Let>X=X+%OffsetX%
Label>DoneWithX
IF>{%OffsetY%>=0},PosY
WriteLn>WriteFilePath,result,Let>Y=Y%OffsetY%
Goto>DoneWithY
Label>PosY
WriteLn>WriteFilePath,result,Let>Y=Y+%OffsetY%
Label>DoneWithY
With the values I've supplied for Xstring, Ystring, StartXat and StartYat, Viewing the file C:\esuohlluf_test.txt with notepad, I see:
Let>X=X+13
Let>Y=Y+13
Hope this helps,
Dick
If>{%OffsetX%>=0},PosX
will work.
I have also seen the + to concatenate in the help for Complex Expressions, String Operators. In fact its the only thing there. But I have yet to find a way to make it work. Nothing you have posted makes a plus sign concatenate text for me.
I have altered the script that you have posted to make it function properly. I've highlighted the changes in red
Let>WriteFilePath=C:\esuohlluf_test.txt
Let>Xstring=33
Let>Ystring=33
Let>StartXat=20
Let>StartYat=20
Let>OffsetX=Xstring-StartXat
Let>OffsetY=Ystring-StartYat
If>{%OffsetX%>=0},PosX
WriteLn>WriteFilePath,result,Let>X=X%OffsetX%
Goto>DoneWithX
Label>PosX
WriteLn>WriteFilePath,result,Let>X=X+%OffsetX%
Label>DoneWithX
IF>{%OffsetY%>=0},PosY
WriteLn>WriteFilePath,result,Let>Y=Y%OffsetY%
Goto>DoneWithY
Label>PosY
WriteLn>WriteFilePath,result,Let>Y=Y+%OffsetY%
Label>DoneWithY
With the values I've supplied for Xstring, Ystring, StartXat and StartYat, Viewing the file C:\esuohlluf_test.txt with notepad, I see:
Let>X=X+13
Let>Y=Y+13
Hope this helps,
Dick
I found a error in the code...Y%+OffsetY% should be ....Y+%OffsetY%
BUT that still didnt give me a correct result
I began by try to use the { } as suggested and everytime i have done this running the code shows an unknown identifier ,i eliminate the { ]
and the code runs
I appreciate everyones help and hope you can help me solve this
it is becoming one of those things i get stuck on and refuse to give up
BUT that still didnt give me a correct result
I began by try to use the { } as suggested and everytime i have done this running the code shows an unknown identifier ,i eliminate the { ]
and the code runs
I appreciate everyones help and hope you can help me solve this
it is becoming one of those things i get stuck on and refuse to give up