OhBobSaget Posted August 11, 2015 Share Posted August 11, 2015 Hi,I am wondering if it is possible to change the text displayed on the buttons on the FileOpenDialog window. Do you guys have any idea ?Do i need to code a brand new FileOpenDialog function in order to do this ? Is there some alternative FileOpenDialog solutions ?Thank you Link to comment Share on other sites More sharing options...
Danyfirex Posted August 11, 2015 Share Posted August 11, 2015 (edited) I Edit a Guinness code and got this:expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIEx.au3> Global Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ;Must be global to allow compare HotKeySet("{F8}", "_ShowDialog") Example() Func Example() Local $hGUI = GUICreate('An(other) example by guinness - 2013', Default, Default) ; Create a GUI. GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_DeregisterShellHookWindow($hGUI) GUIDelete($hGUI) EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) If WinGetProcess($lParam) = @AutoItPID And $sTitle=$sMessage Then ControlSetText($sTitle, "", "Button1", "AutoIt") ControlSetText($sTitle, "", "Button2", "Danyfirex") EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _ShowDialog() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>_Dialog Saludos Edited August 11, 2015 by Danyfirex Update code OhBobSaget 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 11, 2015 Moderators Share Posted August 11, 2015 (edited) OhBobSaget,Or use my ChooseFileFolder UDF and then you can make your own buttons.M23Edit: 24k Edited August 11, 2015 by Melba23 OhBobSaget 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
OhBobSaget Posted August 13, 2015 Author Share Posted August 13, 2015 OhBobSaget,Or use my ChooseFileFolder UDF and then you can make your own buttons.M23Edit: 24kThank you for your input I tried ChooseFileFolder and unfortunately this is not exactly what i want. I want to have a window to select single or multiple files in a folder ( with a root specified in the OpenFileDialog ). I also need this window to look-alike the windows open file dialog. Link to comment Share on other sites More sharing options...
BrewManNH Posted August 13, 2015 Share Posted August 13, 2015 You can build your own and make it look however you'd like. FileOpenDialog is a standard Windows GUI, so it won't be very modifiable. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 13, 2015 Moderators Share Posted August 13, 2015 OhBobSaget, I want to have a window to select single or multiple files in a folder ( with a root specified in the OpenFileDialog ). Which the UDF can do for you very simply - and the user cannot navigate to other folders (unlike the Windows version). I also need this window to look-alike the windows open file dialogWhich the UDF cannot, but is the visual appearance really so important? Surely functionality comes first?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
OhBobSaget Posted August 13, 2015 Author Share Posted August 13, 2015 I Edit a Guinness code and got this:expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIEx.au3> Global Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ;Must be global to allow compare HotKeySet("{F8}", "_ShowDialog") Example() Func Example() Local $hGUI = GUICreate('An(other) example by guinness - 2013', Default, Default) ; Create a GUI. GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_DeregisterShellHookWindow($hGUI) GUIDelete($hGUI) EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) If WinGetProcess($lParam) = @AutoItPID And $sTitle=$sMessage Then ControlSetText($sTitle, "", "Button1", "AutoIt") ControlSetText($sTitle, "", "Button2", "Danyfirex") EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _ShowDialog() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>_Dialog Saludos Sounds good ! This is was i needed Thank you very much!!! Link to comment Share on other sites More sharing options...
Danyfirex Posted August 13, 2015 Share Posted August 13, 2015 You're wellcome. Look out with $sMessage. I declared it twice lol. Just keep the global one. Saludos OhBobSaget 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
OhBobSaget Posted August 14, 2015 Author Share Posted August 14, 2015 Hopefully i will be able to implement parts of your code. The problem is i don't have a GUI or parent GUI to register.I have a couple options available in the Tray Menu. When selecting a specific entry in the Tray menu you launch the following function :While 1 Switch TrayGetMsg() Case $fileTransfer getFileToTransfer() EndSwitch Wend Func getFileToTransfer() $fTDialog = FileOpenDialog( "Please select the files you want to transfer", VerifUSBconnect() , "All Files (*.*)|Word Documents (*.docx)|PDF Documents (*.pdf)", 7 ) If @error Then getFileToTransfer() EndIf return StringSplit($fTDialog, "|") ; EndFuncI think i can't set the button text using this way of doing things right ? Link to comment Share on other sites More sharing options...
Danyfirex Posted August 14, 2015 Share Posted August 14, 2015 (edited) of couse yes. just create a dummy gui (hidden)expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIEx.au3> Global Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ;Must be global to allow compare HotKeySet("{F8}", "_ShowDialog") Example() Func Example() Local $hGUI = GUICreate('Just a Dummy GUI', Default, Default) ; Create a dummy gui no need to be visible GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. _ShowDialog() _WinAPI_DeregisterShellHookWindow($hGUI) GUIDelete($hGUI) EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) If WinGetProcess($lParam) = @AutoItPID And $sTitle=$sMessage Then ControlSetText($sTitle, "", "Button1", "AutoIt") ControlSetText($sTitle, "", "Button2", "Danyfirex") EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _ShowDialog() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>_Dialog Saludos Edited August 14, 2015 by Danyfirex edit OhBobSaget 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Danyfirex Posted August 14, 2015 Share Posted August 14, 2015 A better example. expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIEx.au3> #include <MsgBoxConstants.au3> #include <TrayConstants.au3>; Required for the $TRAY_ICONSTATE_SHOW constant. Global Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ;Must be global to allow compare Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Example() Func Example() Local $hGUI = GUICreate("My Dummy GUI", 0, 0) Local $idShowDlg = TrayCreateItem("ShowDialog") TrayCreateItem("") ; Create a separator line. GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch TrayGetMsg() Case $idShowDlg ; Display a message box about the AutoIt version and installation path of the AutoIt executable. _ShowDialog() Case $idExit ; Exit the loop. _WinAPI_DeregisterShellHookWindow($hGUI) ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) If WinGetProcess($lParam) = @AutoItPID And $sTitle = $sMessage Then ControlSetText($sTitle, "", "Button1", "AutoIt") ControlSetText($sTitle, "", "Button2", "Danyfirex") EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _ShowDialog() ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>_ShowDialogSaludos OhBobSaget 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
OhBobSaget Posted August 14, 2015 Author Share Posted August 14, 2015 Excellent Thank you for your time Dany ! Much appreciated Link to comment Share on other sites More sharing options...
Danyfirex Posted August 14, 2015 Share Posted August 14, 2015 You're wellcome mate.Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut 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