Sign in to follow this  
Followers 0
sumitvc9

Wrong FileOpenDialog directory after creating exe

5 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

I copied exe to another directory and then it started working fine.  :thumbsup:

Strange, what can possibly cause such problem. o:)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0