hi5 / tf Goto Github PK
View Code? Open in Web Editor NEWAutoHotkey library for Text files & Variables (strings)
Home Page: https://autohotkey.com/boards/viewtopic.php?f=6&t=576
License: GNU General Public License v2.0
AutoHotkey library for Text files & Variables (strings)
Home Page: https://autohotkey.com/boards/viewtopic.php?f=6&t=576
License: GNU General Public License v2.0
In "myfile.xml", I want to replace FALSE with TRUE on Line 1, so I used your library as follows:
TF_ReplaceInLines("!%A_AppData%\Roaming\myfile.xml""1","","False","True")
This does not work for me. The value is not changed.
If I put in the full file address like this:
TF_ReplaceInLines("!C:\Users\USERNAME\Roaming\myfile.xml""1","","False","True") it works.
Is there a way to get this function working with %AppData% or %A_AppData% as I will be distributing this file to my family, and I dont know their USERNAMEs.
Thanks in advance.
Fix readme (+figure out why GH now messes it up)
Hi @hi5. I'm wondering if you'd be interested in publishing TF as an ahkpm package?
ahkpm is a package manager built specifically for AutoHotkey libraries.
I've written a guide on how to publish ahkpm packages and it likely wouldn't take much time at all.
The main thing I noticed that you might need to change is to start tagging new versions with the appropriate semantic version number. e.g. git tag 1.3.18
.
I'd be happy to open up a PR adding the ahkpm.json
file if you're interested.
I don't understand why but functions like TF_LineNumber aren't working, as in, they do absolutely nothing. If I have a sample file with a bunch of lines (around 45 lines) of "asdf", called File.txt, and I copy and paste the example line:
TF_LineNumber("File.txt",1,15,A_Space)
Nothing happens to the file - the file is not changed at all. And this is copied from the example so there is absolutely no way I could have messed it up.
It's not a permission issue either, since I can write to the file with normal AHK code.
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 = ""
?
I have uploaded the ahk and txt file I using. It seems to be unable to detect .mp3 when I include $.
Test.zip
I have uploaded the script and outputs. Line 13 from Music.ahk is causing "e" from the last line of Artist - Song.txt to be deleted.
Music.zip
Using TF_Sort deletes the last character in the sorted file, e.g.
Zetta - Cybercrime - 122291598
In Music list_copy.txt, it shows as
Zetta - Cybercrime - 12229159
Error at line 151 in #include file
"C:\Sysinternal\AutoHotkey\Library\TF\tf.ahk"
Line Text:
data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://github.com/hi5/TF/blob/master/tf.ahk","user_id":null}}" data-hydro-click-hmac="9bfa7217bce64129a14fd6cd3fec393f409275859f7468c3ec0b29ca2aa0588c"
Error: This line does not contain a recognized action.
The program will exit.
I'm on 1.1.30.03 and I'm using SciTE4AutoHotKey as my editor, when I try to run my application with the ahk in the Lib folder I get the following error message:
I will admit that this is the first time I'm using a Lib file so maybe I'm doing something wrong or I'm running a build of AutoHotKey that isn't compatible with this Lib but any assistance would be greatly appreciated.
Hello, great tool and I see much potential for this. I am trying to get it to read lines from a file. But, everytime I run the following code, all I get in the popup box is C:\Users\kyelc\Desktop\ahkscripts\todolist.txt which isn't correct. I have tried hard coded paths like below, relative paths and setting bounds on the ReadLines. What else can I do?
Code:
Lines:=TF_ReadLines("C:\Users\kyelc\Desktop\ahkscripts\todolist.txt")
MsgBox %Lines%
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.
Currently TF_RemoveDuplicateLines only removes the additional duplicates, so 1 of the duplicate is always left behind. Could an option be added to remove all instances of the duplicate so none of them show? This would be useful for comparing 2 lists when you only want to see the non-duplicate items.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.