ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Save/Load list of hotstrings in ini autohotkey

(1/2) > >>

stophereareyou:
I want to Save/Load list of hotstrings in ini.
I can save with iniwrite but how to load saved list so they work as hotstrings is my problem.
I have tried #include, list.ini
this works. Loads list and saved list can be loaded with script reload in .ahk file.
But when I compile to .exe, list.ini get compiled and embedded in same exe file, iniwrite writes new hotstring in local directory list.ini but only load hotstrings from embedded file.

IainB:
Not an answer to this post, but just a thought:
We could consider having a special board or discussion thread (at least) - e.g., "Autohotkey corner", or something - for posting/curating  these types of AHK-related questions and the answers. It could become quite a useful resource/collection. There are loads of good AHK coding examples amongst DC donationware, and various discussions about aspects of AHK, scattered around the forum. With a bit of effort we could consolidate (index) that into a potentially more useful repository. Not suggesting that we try to duplicate the AHK website here, though we could link to it where relevant.

skwire:
I want to Save/Load list of hotstrings in ini.
I can save with iniwrite but how to load saved list so they work as hotstrings is my problem.-stophereareyou (February 11, 2018, 07:51 AM)
--- End quote ---

In AutoHotkey, you load INI values with IniRead.

I have tried #include, list.ini
this works. Loads list and saved list can be loaded with script reload in .ahk file.
But when I compile to .exe, list.ini get compiled and embedded in same exe file, iniwrite writes new hotstring in local directory list.ini but only load hotstrings from embedded file.-stophereareyou (February 11, 2018, 07:51 AM)
--- End quote ---

You cannot write INI values directly to the executable file.  Typically, INI values are written to, and read from, a separate INI file.

mouser:
This is not specific to ahk, just a general reminder that for portable programs, it is safe to save an ini (or other) file in the same directory as the script, but for programs that you will want to use an installer to install into the "C:\Program Files\" or similar directory, you will have to save ini files into a different directory -- one under the user's home directory.

IainB:
@mouser:
This is not specific to ahk, just a general reminder that for portable programs, it is safe to an ini (or other) file in the same directory as the script, but for programs that you will want to install into Program Files\ directory with an installer, you will have to save ini files into a directory in an appropriate user directory
-mouser (February 12, 2018, 01:48 PM)
--- End quote ---
Does that say what you thought you wanted it to say?
Not sure I fully understand it, anyway, though I think I can see what you probably intended to mean. May be a typo?

Navigation

[0] Message Index

[#] Next page

Go to full version