topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 3:05 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Save/Load list of hotstrings in ini autohotkey  (Read 5347 times)

stophereareyou

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 14
    • View Profile
    • Donate to Member
Save/Load list of hotstrings in ini autohotkey
« on: February 11, 2018, 07:51 AM »
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.
« Last Edit: February 11, 2018, 09:14 AM by wraith808 »

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Save/Load list of hotstrings in ini autohotkey
« Reply #1 on: February 11, 2018, 12:06 PM »
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

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Save/Load list of hotstrings in ini autohotkey
« Reply #2 on: February 12, 2018, 01:39 PM »
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)

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)

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

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Save/Load list of hotstrings in ini autohotkey
« Reply #3 on: February 12, 2018, 01:48 PM »
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.
« Last Edit: February 12, 2018, 05:30 PM by mouser »

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Save/Load list of hotstrings in ini autohotkey
« Reply #4 on: February 12, 2018, 05:25 PM »
@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
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?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Save/Load list of hotstrings in ini autohotkey
« Reply #5 on: February 12, 2018, 05:31 PM »
I have improved my post.