Zohar Posted October 2, 2009 Posted October 2, 2009 (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 October 5, 2009 by Zohar
Mison Posted October 2, 2009 Posted October 2, 2009 try this: HotKeySet("^{1}", "func1") $dir = @WindowsDir FileOpenDialog("Test, Initial directory = Win Dir",$dir,"Images (*.jpg;*.bmp)") MsgBox(0,"","now press Ctrl + 1") Sleep(3000) FileOpenDialog("Test, Initial directory = C:\",$dir,"Images (*.jpg;*.bmp)") Func func1() $dir = "C:\" EndFunc is this what you want? Hi ;)
wolf9228 Posted October 2, 2009 Posted October 2, 2009 (edited) On 10/2/2009 at 4:49 AM, 'Zohar said: 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 expandcollapse popupHotKeySet("{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 October 2, 2009 by wolf9228 صرح السماء كان هنا
Zohar Posted October 3, 2009 Author Posted October 3, 2009 (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 October 3, 2009 by Zohar
TurionAltec Posted October 3, 2009 Posted October 3, 2009 HotKeySet("^1","opendialog") While 1 sleep(500) WEnd Func opendialog() $oldtext=ControlGetText("Open","","Edit1") ControlSetText("Open","","Edit1","c:\") ControlSend("Open","","Edit1","{enter}") ControlSetText("Open","","Edit1",$oldtext) EndFunc
Zohar Posted October 3, 2009 Author Posted October 3, 2009 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)?
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