Issue with Writeln

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Issue with Writeln

Post by kpassaur » Thu Aug 09, 2007 2:01 pm

I am trying to do something very simple. Add two slashes to a line of text to comment it out. I have 800 lines of a script, I wish to import into another one and each line needs to be checked. So, I copied the lines to a text file in Notepad and saved it as dirty.txt, and ran the following script (which was for the most part copied out of the help files) and it locks up.

IfFileExists>c:\commented.txt
DeleteFile>c:\commented.txt
Endif
Let>k=1
Label>start
ReadLn>c:\dirty.txt,k,line
If>line=##EOF##,finish
WriteLn>c:\commented.txt,result,//%line%
Let>k=k+1
Goto>start
Label>finish
MDL>Done

It locks up after it writes this line

//If>line=,skipblanklineinprofile

This is the next line that it reads
Iffileexists>%root%\%LoanNumber%\%Lastname%_%Firstname%-%line%.pdf

And is not written

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Thu Aug 09, 2007 2:33 pm

EDIT: misleading line removed by author.

WriteLn>c:\commented.txt,result,//%line%


WriteLn>c:\commented.txt,result,%ABBA%%line%

After all the words ABBA have been entered, do a search and replace, replacing the ABBA with //

I also usually add some kind of wait> after the writeln> command. It just seems to work better with my own system.
Last edited by Snickers on Fri Aug 10, 2007 1:53 am, edited 1 time in total.

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

Post by Marcus Tettmar » Thu Aug 09, 2007 2:42 pm

The //%line% is going to be understood as a comment itself.
No, it isn't.

Keith, you haven't provided the full script - your post is vague because key information appears missing. What does the debugger tell you? Log file?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Read and Write script

Post by kpassaur » Thu Aug 09, 2007 8:26 pm

That is the full script. It just reads a text file and creates another with each line beginnig with a // at the beginnning of the line


The text file it is reading is acutally a Macro Scheduler Scp file saved as a text file. That is why I put the last line written in the posting as well as the line that stopped it.

Think of it like this, you have hundreds of lines of a MS Script file that you want to use in another Script. You could just copy and paste and hopefully check each line. Or you could copy and paste to a text file, save the text file, run this script and copy and paste the text in this processed new file with each line commented out. That forces you to check each line.

So, I have not stepped though it with debugger, as the text file is hundreds of lines long and this script was simply to be run once - you know easily modify a text file to save time. It has not turned out to be that. It is at the point where it is not worth doing.

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

Post by Marcus Tettmar » Thu Aug 09, 2007 8:40 pm

Perhaps you could email me the files which cause the "lock up" on your PC. Send me your copy of dirty.txt and commented.txt and the .scp file. Then I can see if I get the same issue, and, if so, why.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Fri Aug 10, 2007 1:50 am

Another thing you might consider:

Instead of using the writeLn> command, simply type two /'s and then copy them into your clipboard, maximize notepad:

setfocus>notepad*
Let>k=0
Label>Start
Press Down
GetCaretPos>X,Y
If>X=0
Press CTRL
wait>.05
Send Character/text>V
wait>.05
Release CTRL
wait>.05
Let>k=%k%+1
endif

If>k>799
goto>END
endif
Goto>Start

Label>END

This script is ugly but will get the job done just as it is.

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