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

Not recognizing working directory #1

Closed
Sprinkle-Master opened this issue Jun 17, 2014 · 4 comments

Comments

@Sprinkle-Master
Copy link

commented Jun 17, 2014

I have been working a lot with TF_RemoveBlankLines, TF_RemoveLines and TF_CountLines. While the count seams to recognize the current working directory, the remove functions don't.

Here are a few details of my application:
Script location: %A_ProgramFiles%\program\script.exe
File location: %A_AppData%\program\file.txt
SetWorkingDir, %A_AppData%\program
script has #include TF.ahk built in (v3.4)

When script.exe uses a TF function relying on the working directory, I get mixed results. The CountLines seams to work fine while RemoveBlankLines and RemoveLines seam to fail.

If I force a hard path to the files I have no problem getting the functions to work but that isn't feasible when creating a program for distribution. I need to rely on system variables to locate properly stored files.

If the Script, files and working directory are all in the same folder, I have no problem accessing the files without a hard path. This is not feasible because the script is a program and belongs in ProgramFiles. Since ProgramFiles is a restricted folder, a text file can't be edited in that directory unless the user is logged in as an admin.

I tried to do a work-around by using the apropriate system variable as the path for the file name within the TF function call. This didn't work either because TF functions can't contain variables as a part of a file name or because I have been unable to work out the syntax on it. Either way, the TF functions should be using the WorkingDir anyway.

I tried going into the TF code to determine the problem but I am still learning and it was a bit over my head for now.

Any help for this bug or a work-around would be greatly appreciated.

Thanks.

@Sprinkle-Master

This comment has been minimized.

Copy link
Author

commented Jun 17, 2014

I forgot to mention: Thanks for the tools! I can see you put a LOT of work into this and it was kind of you to share it with the world! :)

@hi5

This comment has been minimized.

Copy link
Owner

commented Jun 23, 2014

If you always pass on the full path to the TF functions that always works - I never run into any such problems myself but as noted by ozzii changing A_ScriptDir to A_WorkingDir might work for you - let me know how this works for you. It has been present from the very beginning, never had any reports / user feedback on this. Might consider changing it.

@Sprinkle-Master

This comment has been minimized.

Copy link
Author

commented Jun 23, 2014

I did take ozzii's advice and made the correction to the TF file. Not
sure why it wasn't made that way to start but it works great now! Thanks
for the reply! :)

On 2014-06-23 10:56, hi5 wrote:

If you always pass on the full path to the TF functions that always works - I never run into any such problems myself but as noted by ozzii [1] changing A_ScriptDir to A_WorkingDir might work for you - let me know how this works for you.

Reply to this email directly or view it on GitHub [2].

Links:

[1]
http://www.autohotkey.com/board/topic/42547-tf-text-file-variablesstring-library-v34-lib/page-16#entry656273
[2] #1 (comment)

hi5 pushed a commit that referenced this issue Aug 3, 2014
Changelog v3.5

- Changed A_ScriptDir to A_WorkingDir in TF_ReturnOutPut -
#1
- Fixed: TF_ColGet negative startcolumn and sections now work correctly
@hi5

This comment has been minimized.

Copy link
Owner

commented Aug 3, 2014

Changed A_ScriptDir to A_WorkingDir to in TF 3.5

@hi5 hi5 closed this Aug 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.