Jump to content

FileopenDialog() InitDir Behavior Question


Recommended Posts

Greetings,

wow, it's been a while since i've posted in here (4+ years). it's good to be back and to see that AutoIt is going on strong.

Here's the behavior i'm trying to understand.

background: I have a specific Autoit application that invokes a fileopendialog. The initdir parameter is set to @scriptdir.

When running a single instance of the application, the fileopendialog behaves as expected. The fileopendialog window opens and the folder location is correctly set to the @scriptdir location (of that instance).

When running a second or third instance (where the exes themselves are located in a different location), the fileopendialog sets the initdir to one of the first two initdir (aka @scriptdir) locations.

this is a little frustating, and im not sure how to control this behavior, since i dont exactly know when and where @scriptdir is technically fetching its information.

I've tried assigning the @scriptdir setting to a user defined variable @curfolder in the begining of my script, which works well in scite, but not when compiled. I have several theories (one is that multiple instances somehow share the same variables/PID) but would like to get confirmation on what is driving this behavior.

I've also tried using @scriptfullpath.

Any help is appreciated. hopefully i've described the situation well enough, let me know if have not.

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

  • Moderators

blademonkey,

Welcome (back) to the AutoIt forum! :)

I cannot reproduce the problem - when I run separate instances of a script using FileOpenDialog I always get the required initial folder regardless of what the other instances have selected or are using as a default:

HotKeySet("{ESC}", "On_Exit")

While 1
        $sInitDir = @ScriptDir
        $sPath = FileOpenDialog("Test", $sInitDir, "AU3 files (*.au3)")
WEnd

Func On_Exit()
    Exit
EndFunc

Can you see if this script acts correctly for you - and try to produce a reproducer script which shows your problem. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...