WriteLn problem

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

WriteLn problem

Post by Rain » Mon Dec 12, 2005 6:19 pm

rfl>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,result
if>result=##NOFILE##
wln>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,1,testing
goto>dialog
endif
///other codes here that have nothing to with the problem
label>dialog
Dialog>reg
Caption=Project
Width=280
Height=87
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label= ,64,0,true
Button=Go,96,16,75,25,1
EndDialog>reg
show>reg
label>pre loop
///I have dialog label changes here
rda>reg
label>loop
wait>.0005
gda>reg,r
if>r=1,go to project
if>r=2,2
goto>loop
label>go to project
rda>reg
///do something
goto>pre loop
label>2


Why is rda>reg not resetting the dialog action? After it writes the file and goes to the loop it goes to label>go to project then to pre loop and back to label>go to project
It does that over and over until I press shift and esc.

What am I doing wrong?
I'm using version 8.0 beta 006

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Dec 12, 2005 7:06 pm

How is this a WriteLn problem?

I can't say why.... but I didn't see a need for the first dialog reset so I remarked it out and the dialog reset properly after that

label>dialog
Dialog>reg
Caption=Project
Width=280
Height=87
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label= ,64,0,true
Button=Go,96,16,75,25,1
EndDialog>reg
show>reg
label>pre loop
///I have dialog label changes here
//rda>reg
label>loop
wait>.0005
gda>reg,r
if>r=1,go to project
if>r=2,2
goto>loop
label>go to project
rda>reg
///do something
goto>pre loop
label>2

Hope this helps,
Dick

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Tue Dec 13, 2005 10:31 am

Thanks Dick but that didn't solve the problem either. How ever, I fixed it by adding a variable to tell the script the line number.

This script will not work without the variable to tell it what line number it has to write. Simply using 1 is messing with the reset dialog action command, I have no idea why.


rfl>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,result
if>result=##NOFILE##
wln>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,1,testing
goto>dialog
endif
///other codes here that have nothing to with the problem
label>dialog
Dialog>reg
Caption=Project
Width=140
Height=87
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label=&,8,8,true
Button=GO,8,24,113,25,1
EndDialog>reg

show>reg
label>pre loop
let>reg.msLabel0=Click OK when ready
let>reg.msButton1=GO
rda>reg
label>loop
wait>.0005
gda>reg,r
if>r=1,go to project
if>r=2,2
goto>loop
label>go to project
let>reg.msLabel0=Beginning of project
let>reg.msButton1=STOP
rda>reg
wait>2
let>reg.msLabel0=End of project
rda>reg
wait>2
goto>pre loop
label>2

This script wil work just fine if I add the variable Line in front of wln>

rfl>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,result
if>result=##NOFILE##
let>Line=1
wln>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,Line,testing
goto>dialog
endif
///other codes here that have nothing to with the problem
label>dialog
Dialog>reg
Caption=Project
Width=140
Height=87
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label=&,8,8,true
Button=GO,8,24,113,25,1
EndDialog>reg

show>reg
label>pre loop
let>reg.msLabel0=Click OK when ready
let>reg.msButton1=GO
rda>reg
label>loop
wait>.0005
gda>reg,r
if>r=1,go to project
if>r=2,2
goto>loop
label>go to project
let>reg.msLabel0=Beginning of project
let>reg.msButton1=STOP
rda>reg
wait>2
let>reg.msLabel0=End of project
rda>reg
wait>2
goto>pre loop
label>2

Now it's working the way it's supposed to, thanks for your time and help Dick.

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Dec 14, 2005 3:50 pm

Rain,

My apologies, now I think this is/was a WriteLn problem. My mistake was creating the test.txt file on my desktop before testing your script. I believe I now I see your problem.

If there is no file C:\Documents and Settings\%USER_NAME%\Desktop\test.txt then your script executes the line:

wln>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,1,testing

From help for the WriteLn command:
WriteLn>file_name,result,line

You can see that the "1" is in the position of the variable to be set as the "result" of running WriteLn. Since the WriteLn command processes correctly the result variable is set to "0". By having "1" as the variable to be set you effectively set 1=0.

Now when you select the GO button in your dialog you have set the variable r to 1. Since 1=0, r also = 0.

When you made the change and added:
Let>Line=1
wln>C:\Documents and Settings\%USER_NAME%\Desktop\test.txt,Line,testing


The variable getting set to "0" is now "line" so your variable "r" is no longer affected.

Hope this helps,
Dick

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Dec 14, 2005 4:22 pm

Nice work Dick. Well explained. Do you want a job!?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Dec 14, 2005 4:38 pm

:) Are you trying to take all the fun out of this?

Thanks for the compliment. I'm just hoping its a correct diagnosis.

Later.

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