sumitvc9 Posted July 23, 2014 Share Posted July 23, 2014 Hi, I am using fileopendilog to pick a file from directory. Directory location is stored in a file, after reading file I am storing this location in a variable. And I am passing this variable to a function triggers FileOpenDialog. This works fine if I run the script directly from scite. But once I create an executable it's picking up the last accessed directory location. Any idea what might be going wrong. Here is sample code: $SMEBrowseB = GUICtrlCreateButton("Browse", $BX, $IBY, $BW, $BH) GUICtrlSetOnEvent($SMEBrowseB,"_GetSMEBrowseB") func _GetSMEBrowseB() $SMELoc = GetSMEPath("SME Location", $SMEDir, "SME (*.sme_exe;*.sme_proj)" ) WinActivate($MainForm) ControlSetText("","",$SMEPath,$SMELoc) EndFunc Func GetSMEPath ($Title,$Dir,$Ext) MsgBox("","Dir",$Dir) ; Geting right location Local $Path=0 Local $FilesList="" $Path = FileOpenDialog($Title, $Dir, $Ext,1 ) $Title="" $Dir="" $Ext="" return $Path EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 23, 2014 Share Posted July 23, 2014 FileChangeDir have a look at the WorkingDir. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
sumitvc9 Posted July 23, 2014 Author Share Posted July 23, 2014 @Workingdir is correctly set to the location where my executable resides. Another observation is, issue only observed while using exe file; if I create a3x file it's picking-up the right start-up directory. Link to comment Share on other sites More sharing options...
Solution sumitvc9 Posted July 24, 2014 Author Solution Share Posted July 24, 2014 I copied exe to another directory and then it started working fine. Strange, what can possibly cause such problem. Link to comment Share on other sites More sharing options...
KaFu Posted July 24, 2014 Share Posted July 24, 2014 I think it's maybe related to this? http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx OPENFILENAME structure lpstrInitialDir Windows 7: If lpstrInitialDir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now