Sign in to follow this  
Followers 0
Zohar

[Solved] How to Change Current Folder in File Open/Save Dialog Window?

6 posts in this topic

#1 ·  Posted (edited)

Hello

I am using Windows XP,

and I want to make some HotKeys that will automatically Change the Current Folder when a File Open/Save Dialog window is displayed.

For example, Ctrl-1 will Change the current folder to "D:\DLoad".

What would be the best way to tell the window to change its current folder?

I can think of a basic solution, which is to Set the TextBox content to the Folder I wish to change to,

and then Simulate a Click on the "Open" button.

It will work, but the problem with it, is that it overrides the content of the TextBox, if the user wrote something there before.

Is there a better way to tell the window to change its current folder?

Thank you

Edited by Zohar

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Hello

I am using Windows XP,

and I want to make some HotKeys that will automatically Change the Current Folder when a File Open/Save Dialog window is displayed.

For example, Ctrl-1 will Change the current folder to "D:\DLoad".

What would be the best way to tell the window to change its current folder?

I can think of a basic solution, which is to Set the TextBox content to the Folder I wish to change to,

and then Simulate a Click on the "Open" button.

It will work, but the problem with it, is that it overrides the content of the TextBox, if the user wrote something there before.

Is there a better way to tell the window to change its current folder?

Thank you

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F1}", "FileSave_Dialog")
HotKeySet("{F2}", "ChangeDir")

Global $DIR = @MyDocumentsDir


While 1

WEnd

Func ChangeDir()
$Patch = InputBox("Testing", "Enter the Dir Patch", "Dir Patch", "", _
    -1, -1, 0, 0)
If Not @error Then $DIR = $Patch
EndFunc



Func FileSave_Dialog()
    $var = FileSaveDialog( "Choose a name.", $DIR , "File (*.RTF;*.TXT)", 2)
    If Not @error Then
    If StringRight(StringUpper($var),4) = ".RTF" Then
    SaveFile($var)
    ElseIf StringRight(StringUpper($var),4) = ".TXT" Then
    SaveFile($var)
    Else
    SaveFile($var & ".RTF")
    EndIf
    EndIf
   FileChangeDir ( @ScriptDir ) ;Look Her
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func SaveFile($var)
MsgBox(0,"",$var)
EndFunc
Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi and Thank you for the replies!

maybe I should've clarify 1 thing:

The application opening the File Open/Save Dialog Window, is another application - a third party application.

Not an application of mine.

And it can be any application, as long as it uses the standard File Open/Save Dialog window.

For example,

Open Notepad.exe,

Choose Menu:File\Open (or "Save As...")

and now I want to be able to press Ctrl-1, or Ctrl-2, etc., to switch the folder, to certain predefined folders that I often use....

Thank you

Edited by Zohar

Share this post


Link to post
Share on other sites

Hi TurionAltec :)

Thank you very much.

What you wrote, is my current temporary implementation, which works nice, but I still see it as a workaround,

because it flickers.

For comparison, If you click the vertical toolbar buttons on the Left, where you have preset custom folders like

Desktop, My Documents, My Computer, etc,

you see how neatly it switches between them.

The only question is, is my request possible - to change the currently displayed folder in the dialog, without going thru the TextBox(Edit1)?

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