FileOpenBox action - Forum

Forum Navigation
You need to log in to create posts and topics.

FileOpenBox action

The FileOpenBox action allows me to set an Intital Directory. But when the user switches to another directory, FileOpenBox does not return to the Initial Directory. Is there a way to force it always open in the initial directory?

@fkapnist

How about trying to save the path to the source directory in a variable the first time you open it, and use the path specified in the variable the next time you open it?

Quote from Vadim on May 22, 2023, 8:47 pm

@fkapnist

How about trying to save the path to the source directory in a variable the first time you open it, and use the path specified in the variable the next time you open it?

Do you mean something like this?

Setvar "[CurrentDir]" "C:/folderA/"

 

@fkapnist

On the startup tab (in the project properties), write the desired start folder, for example, the project directory:

SetVar "[start_folder]" "[CurrentDir]"

And this way you can force opening of the same specified folder (by example of project folder) already after the project start:

FileOpenBox "" "" "[start_folder]" "[selected_file]" ""
SetVar "[start_folder]" "[CurrentDir]"

 

fkapnist has reacted to this post.
fkapnist
Quote from Vadim on May 23, 2023, 10:46 am

@fkapnist

On the startup tab (in the project properties), write the desired start folder, for example, the project directory:

SetVar "[start_folder]" "[CurrentDir]"

And this way you can force opening of the same specified folder (by example of project folder) already after the project start:

FileOpenBox "" "" "[start_folder]" "[selected_file]" ""
SetVar "[start_folder]" "[CurrentDir]"

 

This works in the debugger Test, but not in the compiled pub...

 

Quote from Vadim on May 23, 2023, 10:46 am

@fkapnist

On the startup tab (in the project properties), write the desired start folder, for example, the project directory:

SetVar "[start_folder]" "[CurrentDir]"

And this way you can force opening of the same specified folder (by example of project folder) already after the project start:

FileOpenBox "" "" "[start_folder]" "[selected_file]" ""
SetVar "[start_folder]" "[CurrentDir]"

 

Even if I use :

FolderBox "Select a Folder" "[start_folder]"
to change directory
FileOpenBox still opens in the last used directory, not the assigned [start_folder]
Is this a Windows setting that over-rides the pub variable?
.

@fkapnist

Yes, indeed, you're right, it doesn't work in the compiled project. I did a little googling. It turns out that this is a property of the current Windows directory. The operating system remembers the current directory for each process and for all the threads in it. It is possible to override this property, but apparently only at plugin level. So far I don't know how to force FileOpenBox to open the directory which was specified by the programmer using VisualNEO Win. Maybe a new command FileOpenBoxEx will be needed, with the ability to prohibit the system dialog to change the current dialog.

fkapnist has reacted to this post.
fkapnist
Quote from Vadim on May 23, 2023, 6:10 pm

@fkapnist

Yes, indeed, you're right, it doesn't work in the compiled project. I did a little googling. It turns out that this is a property of the current Windows directory. The operating system remembers the current directory for each process and for all the threads in it. It is possible to override this property, but apparently only at plugin level. So far I don't know how to force FileOpenBox to open the directory which was specified by the programmer using VisualNEO Win. Maybe a new command FileOpenBoxEx will be needed, with the ability to prohibit the system dialog to change the current dialog.

I tried DOS commands "cd\" with CMD, which does change the directory.... but as soon as FileOpenBox is activated it again returns to the last used folder. Probably something in the Windows Registry could be changed to fix it, but it is not worth it.... "Microsoft knows best?"

.

Hi @fkapnist,

Take a look of NeoDialogs Plugin.

Forces the initial folder for Open and Save files.

Check the debugger for generated variables.

My 0.01

Uploaded files:
  • You need to login to have access to uploads.
fkapnist has reacted to this post.
fkapnist
Quote from DaviddeArgentina on May 23, 2023, 7:01 pm

Hi @fkapnist,

Take a look of NeoDialogs Plugin.

Forces the initial folder for Open and Save files.

Check the debugger for generated variables.

My 0.01

@daviddeargentina

I tried the plugin but it does not force the initial folder.

The compiled app always opens the last folder used.

Is there a way to force the initial folder?

.

When the app is opened and used for the first time, it does in fact force the initial folder that I specified. But if the user changes directory, the app does not force the intital folder any more....

.

 

A FileOpen Dialog can be written in VBscript or another language but the behavior is always the same:

It opens to the initial folder the first time, but if the user changes directory the initial folder is not displayed again.

Oh well, Microsoft knows best?....

.

@fkapnist

Unfortunately, I haven't found a workaround. Windows stores the path to the last folder for each application somewhere.

I think we will have to wait for a plugin that can call the file selection dialog with the desired setting.

I told Andrei Solodyankin about this idea. He is busy for now, but in the future may well do it. Maybe some other plugin makers will also be interested in this idea.

 

fkapnist has reacted to this post.
fkapnist
Quote from Vadim on May 24, 2023, 3:50 pm

@fkapnist

Unfortunately, I haven't found a workaround. Windows stores the path to the last folder for each application somewhere.

I think we will have to wait for a plugin that can call the file selection dialog with the desired setting.

I told Andrei Solodyankin about this idea. He is busy for now, but in the future may well do it. Maybe some other plugin makers will also be interested in this idea.

 

@vadim

This small app (HMFiles.exe) from Glyn Hughes "HelpMate for Neobook 4" is another way of selecting a file in a forced initial folder by using a simple list box. Set your list filter (index*.html) in the HMFiles.dat file and copy both HMFiles.exe and HMFiles.dat to the initial directory. The user's selection will be saved in the updated HMFiles.dat.

https://awareware.com/NEOWINPLUGINS/HMFiles.zip

 

I want to always go directly to the user's Downloads folder to open files, since this is where HTML5 browser apps will "save" their files....

.

 

Uploaded files:
  • You need to login to have access to uploads.
Vadim has reacted to this post.
Vadim

Hi @vadim

Take a look of this:

https://stackoverflow.com/questions/4353487/what-does-the-filedialog-restoredirectory-property-actually-do

 

and

https://social.msdn.microsoft.com/Forums/vstudio/en-US/2b720c00-6952-4705-a646-8f5469fd93b1/savefiledialog-restoredirectory-doesnt-work-properly-for-temp?forum=csharpgeneral

 

 

I don't have idea about C#

My  0.01

Vadim has reacted to this post.
Vadim

This PS1 program works fine into PowerShell ISE

Uploaded files:
  • You need to login to have access to uploads.

Hi @fkapnist,

I needed the same behavior for a project too, so I made something to solve the problem..

Give this new plugin a try and let me know..

https://visualneo.com/forum/topic/new-plugin-ezfileopenbox#postid-19189

luishp, Gaev and 2 other users have reacted to this post.
luishpGaevfkapnistiretz
Quote from Darbdenral on May 31, 2023, 11:22 am

Hi @fkapnist,

I needed the same behavior for a project too, so I made something to solve the problem..

Give this new plugin a try and let me know..

https://visualneo.com/forum/topic/new-plugin-ezfileopenbox#postid-19189

Your plugin does just what I want.

But I am using "skins" (asNeoVisual) to change the color theme of my app, and I don't know if the File Open Box will have the same look as the rest of my app...

.