Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF_GetData() bug #4

Closed
stealzy opened this issue Apr 8, 2017 · 3 comments
Closed

TF_GetData() bug #4

stealzy opened this issue Apr 8, 2017 · 3 comments

Comments

@stealzy
Copy link

stealzy commented Apr 8, 2017

TF_GetData(byref OW, byref Text, byref FileName) {
  If (text = 0) ; v3.6
  {
    MsgBox, 48, TF Lib Error, % "Read Error:``npossible reason: perhaps you used ! vs ""!"" ?"
Some newbie try to use this lib, but failed.
His text contain only one line: "000000".
I dont know that you mean here, possibly you mean text = "" ?

@hi5
Copy link
Owner

hi5 commented Apr 8, 2017

You don't use TF_GetData() in a script on its own. TF_GetData is called by all other TF functions to test if a variable or a file has been passed on to a TF_... function.

That particular line/error message is shown if a user makes a syntax error:

TF_...(! "file.txt",...) vs TF_...("!file.txt",...). The ! before a filename is used to write back the result of the TF function to the source file instead of a copy (file_copy.txt). I noticed that some users tried to use it like ! "file.txt" instead of "!file.txt" and I show the MsgBox as a reminder.

I can read/work with a file with one line containing "000000" without any problems.

What function are you using and how are you calling it, if you post it I might spot a syntax error (below each TF command there is a short example in the readme.md

@stealzy
Copy link
Author

stealzy commented Apr 9, 2017

TF_GetData() is called first in many user function.

msg =
(
000000
)
MsgBox % TF_TrimLeft(msg, 1, 1, 3)
— Error msgbox.

msg =
(
C:\users\desktop.ini
)
MsgBox % TF_TrimLeft(msg, 1, 1, 3)
— I get 1 here, because I have this file on disk.

msg =
(
!C:\
)
MsgBox % TF_TrimLeft(msg, 1, 1, 3)
— Error msgbox.

IMHO, from such type of function I expected behavior like SubStr().
No hidden parameters, no undefinied try read file, no error msgbox.
A good tool should be simple.
Of course, I understand that it's too late change it here.

@hi5
Copy link
Owner

hi5 commented Apr 9, 2017

Sorry but only the last one gives an error message, the first two work fine here.

Your second example should have created a file C:\users\desktop_copy.ini, it should be there.
The 1 indicates it hasn't been able to make a backup - There is little point in using MsgBox with files as, well it writes back the result to a file and does NOT return the changed content to a variable which you can display in a MsgBox.

The last one tries to read a file "C:" which of course doesn't exist (there is no such file) so it gives an error message saying it can't read it. You can pass on a variable as a filename which is what you are doing here in the second and third example.

So as far as I can see: no bugs and it works as intended.

Edit: v3.7 (April 16, 2017)

@hi5 hi5 closed this as completed Apr 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants