Dialog unable to read from file

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
nskd
Newbie
Posts: 15
Joined: Wed May 29, 2019 2:02 pm

Dialog unable to read from file

Post by nskd » Tue Jun 25, 2019 10:11 am

Hi Guys,

In my program I have two separate Dialog boxes,

1st Dialog box will ask user to input some string and store the info using WriteLn to store into a text file01.
2nd Dialog (memo) box will use ReadFile to read the contents from text file01.

Unfortunately, the file contents cannot be displayed on the MEMO box. If I create a new text file and input some string and without attempting to use "WriteLn" command, the 2nd dialog (Memo) box is able to Read the file contents.

I'd narrowed down the issue to the possibility that "WriteLn" is still accessing that text file01. Therefore ReadFile will have issue reading the contents. Is there any way to kill the WriteLn process or gracefully close the file01 process after strings are written into file01?

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

Re: Dialog unable to read from file

Post by JRL » Thu Jun 27, 2019 4:13 pm

Without seeing your code I can't even speculate why you can't read the file data. Since Writeln> closes the file immediately after it finishes writing the data, I doubt the file is in use.

If the two dialogs are in the same script, there is no need to write and read to a file. Just set a variable to the data typed into dialog 1 then add that to the memo box of dialog 2.

If the two dialogs are in separate scripts, you could use the technique I've outlined HERE where you use GetControlText or SetControlText to pass data between fields in separate dialog boxes in separate scripts. Again, no file or clipboard needed.

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