Announcement

Collapse
No announcement yet.

Browse to folder and save path to ini

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Browse to folder and save path to ini

    I've been trying to set an app so that when I browse to a folder, it remembers where the app previously browsed to.

    Thus, I presume that the selected folder path is converted to a string, which is then saved to an INI file or to the registry, so that next time Dialog.FolderBrowse reads from that entry and then goes directly to the previous folder.

    So far I have been unsuccessful in doing this.

    I'm wondering if someone has an example of this. Thanks.
    Classic IT Support
    https://www.classicit.net
    https://www.message7.org

  • #2
    storage_path = Dialog.FolderBrowse("Open Folder", My_Docs);
    result_path = TextFile.ReadToString(storage_path);
    Application.SaveValue("Folder", "LastVisited", result_path);

    -- or

    INIFile.SetValue("C:\\path.log", "Data", "Last_Path", ""..result_path.."")

    This is the code I've played with but I think I fail to understand why storage_path doesn't reflect the browsed-to-folder-path data I'd hoped for.
    Classic IT Support
    https://www.classicit.net
    https://www.message7.org

    Comment


    • #3
      Hi JK
      I have a attached a small example on how to use a INI file, you can change paths to suit your needs.P2 has folder example

      Example 2 - Saving Button State [INI File] (License Agreement).apz

      Cheers

      Comment


      • #4
        Thank you C.

        In the end, I chose to write/read the path to the registry, although an INI file would have done the same. I'll study your example, which will be helpful. Thanks.



        PreviousFolderPath = Application.LoadValue("FolderPath", "LastVisited");

        if PreviousFolderPath == "" then

        storage_path = Dialog.FolderBrowse("Open Folder", My_Docs);

        else

        storage_path = Dialog.FolderBrowse("Open Folder", PreviousFolderPath);
        Classic IT Support
        https://www.classicit.net
        https://www.message7.org

        Comment

        Working...
        X