LogMeTT.com • FileOpen command bug
Page 1 of 1

FileOpen command bug

Posted: Mon Mar 13, 2017 11:42 pm
by boris
Hi,

I just discovered strange behavior of fileopen macro command which is in the 1st line in my macro script. The following line works fine:

Code: Select all

  1. fileopen fhandle 'C:\Temp\List.txt' 0

but the line below

Code: Select all

  1. fileopen fhandle 'C:\Temp\List.txt' 1

causes macro script not to run. No error message, nothing at all, like if I've never run the macro.

Tested on Windows 7 Professional by opening .TTL file from Control->Macro menu of Tera Term 4.94.

Re: FileOpen command bug

Posted: Tue Mar 14, 2017 11:39 am
by Yutaka Hirata
Hi Boris,

Thank you for your feedback.
However, I can not reproduce your problem. I have tested your script
by using Tera Term 4.94 on Windows 7.

Thanks.

Re: FileOpen command bug

Posted: Tue Mar 14, 2017 5:23 pm
by boris
Hi Yutaka,

I stripped down my script to the following and did few more tests

Code: Select all

  1. fileopen fhandle 'C:\TMP\IP_List.txt' 0
  2. while 1
  3.    ; Read a line containing the IP address from the file
  4.     filereadln fhandle ip_address
  5.     if result=1 then
  6.         break
  7.     endif
  8.     ;
  9.     ; My other code here
  10.     ;
  11. endwhile    
  12. fileclose fhandle

And I found the problem. When append flag is set to 1 the file pointer is moved to the end of the file and the result value in line 5 returns 1 and breaks the loop right away. So, the macro exits without doing anything and gives the impression that it never run. This means there is no bug here. Thanks for checking.