dbohdan / initool

Manipulate INI files from the command line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work with Windows?

Simon-Weel opened this issue · comments

Initools 0.12 for Windows.
No matter what I do, every command returns "ror: invalid line: " ■
Any clues?

Please share your INI file. Could it be in UTF-16? Initool does not support UTF-16.

Initool is EXTREMELY picky about capitalization. If what you tell it to look for isn't capitalized EXACTLY the way it is in the INI file, it won't find it.

May I respectfully suggest that you add an option for case-insensitive matching? Case usually doesn't matter under the Windows command line, and in the situations where it does, the command/program will usually have a dedicated option to disable it. People get in the habit of not really paying that much attention to the case of what they're typing, and with Initool not printing anything when it fails, it gives the impression that it's just not working.

Also, I'd like to suggest adding an option to make all the commands global, rather than being limited to specific sections of the file. Some users may assume that the default behavior is to search the whole file for the key, and that adding a section title is just an optional way to limit the search. It's not explicitly clear that a section title is absolutely REQUIRED if the key you're searching for is under a section.

When I downloaded Initool to test it, I didn't think it was working either, because I was making many of the above mistakes. It took me a little while to figure out that you have to be absolutely exact in what you tell it to search for, and where to find it.

@Rekrullurker Thank you for your suggestions and also for sharing your reasoning and initial experience with initool. It is useful to hear how someone learned your program and thinks about its behavior. (It didn't cross my mind that initool could be seen as "extremely picky" about case. To me it is just "case-sensitive". That someone sees this as pickiness is bad user experience.) I will try to make the hierarchical model of the INI file more clear in the readme.

I agree with you that people generally expect case to not matter on the Windows command line. To address this, I have implemented an option to ignore case. It will be in the next release, which should be coming soon. The option will only apply to the English letters "A" through "Z", since initool has no internationalization or awareness of Unicode. (Turning case insensitivity on by default on Windows would be too inconsistent with other platforms, and then you'd need an option to not ignore case.)

I have also implemented "wildcards": setting the section or key name to * will match every section and every key, respectively. I think it is the best simple way to add "global commands" to initool's interface. This feature will also be in the next release.

Sounds good. :)

I was actually inspired to test out Initool because of Simon-Weel's post on the SS64 forum saying that he couldn't get it to work. I downloaded it, tried it, and then found my way here, where I saw he had posted here as well. Hopefully, he sees my responses.

I'll admit that I've gotten used to being careless about the case of letters. I wrote a Windows Batch script that looked perfect, but it kept failing. Then I realized that I had set a variable to "Yes" or "No" and it was checking for "yes" and "no". Oops!

I was actually inspired to test out Initool because of Simon-Weel's post on the SS64 forum saying that he couldn't get it to work.

Oh, I see. (For reference, here is the thread.)

I have published a new release with the new features I mentioned.

Right, so made sure to use the right case for the texts, like "initool get revit.ini Directories ProjectPath" but nope. See attached an example file (rename to revit.ini) I try to edit.
Revit.txt

Edit: just noticed the ini file is encoded as UTF-16 LE BOM. When changed to UTF-8 it works. But the application writes it as UTF-16 LE BOM.

Right, the original file is UTF-16, which initool doesn't support. You can convert it and use initool or try another program. I have several listed in the INI section of my list of structured text tools.

IniFile (which inspired proto-initool) works. It prints a line to set the corresponding variable in the Windows Command Prompt. It may be more or less convenient depending on your usage.

> inifile.exe Revit.txt '[Directories]' ProjectPath
set ProjectPath=P:\!ABN AMRO!\- GREENE en Yello\Revit Buildingblocks\Texturen\|L:\Revit_Support\NLRS_release_2.5.2\Materials\160222_NLRSv2.5.2_textures\

Closing as answered.