LeHuynhNam Posted August 10, 2010 Share Posted August 10, 2010 (edited) Hello, i have some problem with my small scriptsI want to Customize FileOpenDialog like: I will change the Text Open or Save into other text i want such as Import, Export etx How can i do that?Thanks in advanced! Edited August 11, 2010 by LeHuynhNam Link to comment Share on other sites More sharing options...
saywell Posted August 10, 2010 Share Posted August 10, 2010 Hello, i have some problem with my small scripts I want to Customize FileOpenDialog like: I will change the Text Open or Save into other text i want such as Import, Export etx How can i do that? Thanks in advanced! You should look at the help files before asking here! FileOpenDialog -------------------------------------------------------------------------------- Initiates a Open File Dialog. FileOpenDialog ( "title", "init dir", "filter" [, options [, "default name" [, hwnd]]] ) Parameters title | Title text of the Dialog GUI. William Link to comment Share on other sites More sharing options...
taietel Posted August 10, 2010 Share Posted August 10, 2010 saywell, I think LeHuynhNam just looked in the help file. He wants to change the text from the buttons (e.g. replace Open with Export) Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
LeHuynhNam Posted August 10, 2010 Author Share Posted August 10, 2010 Yeah, i want to Replace Open Text in Button with other Text I like eg: Export, Import Link to comment Share on other sites More sharing options...
LeHuynhNam Posted August 11, 2010 Author Share Posted August 11, 2010 Bump Link to comment Share on other sites More sharing options...
Bert Posted August 11, 2010 Share Posted August 11, 2010 OK, I see what you want to do. In what you are describing, you would need to make a GUI with the controls and labels you need to suit your purposes. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
saywell Posted August 11, 2010 Share Posted August 11, 2010 Yeah, i want to Replace Open Text in Button with other Text I like eg: Export, Import Sorry, misunderstood you. The ExtMsgBox.au3 UDF lets you do this for message box buttons - maybe you can find a similar for fileOpen? But as posted above, a small GUI would probably do the trick for you. I generally word the text in the title bar [which is what I erroneously thought you wanted to change] to suit the button options! William Link to comment Share on other sites More sharing options...
LeHuynhNam Posted August 11, 2010 Author Share Posted August 11, 2010 Thanks for all reply, Im trying to solve this problem Link to comment Share on other sites More sharing options...
Bert Posted August 11, 2010 Share Posted August 11, 2010 Do a search in the forum for what you have in mind. Odds are someone has already done something close to what you need so there is no need to reinvent the wheel. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
saywell Posted August 11, 2010 Share Posted August 11, 2010 (edited) I think I misunderstood you a second time!From your edits with added screenshot, it seems it's the Windows dialogue that you want to change, not the Autoit bit.that might be harder unless you're into Windows objects etc. Which I'm certainly not!William Edited August 11, 2010 by saywell Link to comment Share on other sites More sharing options...
KaFu Posted August 11, 2010 Share Posted August 11, 2010 Siao posted some useful stuff on this topic long time ago, take a look at his File Open/Save Dialogs customization example. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
LeHuynhNam Posted August 12, 2010 Author Share Posted August 12, 2010 Thanks for replying @KaFu: i have to download AutoIT ver 3.2.10.0 to run Siao's Script and i think Siao use Notepad's Save Dialog and then Customize it by use ControlCommand. I've tried to use ControlSetText to change the Save text to other text but failed Someone can give me a point? Link to comment Share on other sites More sharing options...
KaFu Posted August 12, 2010 Share Posted August 12, 2010 Updated it to 3.3.6.1, though I can't get the WM_COMMAND working (quickly )... #include "_FileDialogsEx.au3" Global Const $CBN_SELCHANGE = 1 $Output = _FileSaveDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_OVERWRITEPROMPT, $OFN_PATHMUSTEXIST, $OFN_DONTADDTORECENT), "", 0, "_FileSave_HookProc") Func _FileSave_HookProc($hWnd, $Msg, $wParam, $lParam) Switch $Msg Case $WM_INITDIALOG Local $hDlg = _WinAPI_GetParent($hWnd) _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $IDOK, "Export", 0, "int", "wstr") _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $IDCANCEL, "Not", 0, "int", "wstr") ControlCommand($hDlg, "", '[CLASS:ComboBox;Instance:3]', "AddString", 'ANSI') $aWinSize = WinGetPos($hDlg, "") WinMove($hDlg, "", @DesktopWidth / 2 - $aWinSize[2] / 2, @DesktopHeight / 2 - $aWinSize[3] / 2) WinSetTitle($hDlg,"","Export to") Case $WM_COMMAND Local $hComboEnc = ControlGetHandle($hWnd, "", '[CLASS:ComboBox;Instance:3]') Local $iCode = BitShift($wParam, 16) If $lParam = $hComboEnc And $iCode = $CBN_SELCHANGE Then $sEncoding = ControlCommand($hWnd, "", '[CLASS:ComboBox;Instance:3]', "GetCurrentSelection", "") EndIf ConsoleWrite($sEncoding & @crlf) EndSwitch EndFunc ;==>_FileSave_HookProc_FileDialogsEx.zip OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
LeHuynhNam Posted August 12, 2010 Author Share Posted August 12, 2010 (edited) Thanks KaFu So much Im stuck with it for some days ( i still have a question, i want to change Func _FileSave_HookProc($hWnd, $Msg, $wParam, $lParam) to a Function like _FileSave_HookProc($TxtOKBtn,$TxtCancelBtn,$TitleOfDialog,$hWnd, $Msg, $wParam, $lParam) but when i edit this and change the Text in _FileSave_HookProc() "Import", "Cancel", "Import To"... to $TxtOKBtn.... nothing happen and it change to default OpenDialog Edited August 12, 2010 by LeHuynhNam Link to comment Share on other sites More sharing options...
KaFu Posted August 12, 2010 Share Posted August 12, 2010 You're welcome, will sure need it someday myself ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
LeHuynhNam Posted August 14, 2010 Author Share Posted August 14, 2010 Hey Kafu, My program have to Display many Open or Save Dialogs one is Import Dialog, One is Export Dialog,etc And my question is: how can i make _FileSaveDialogEx() as a function which i can modify the Button Text to the text i like whenever i call it? Like that _FileSaveDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_OVERWRITEPROMPT, $OFN_PATHMUSTEXIST, $OFN_DONTADDTORECENT), "", 0, "_FileSave_HookProc",$BtnText) $BTnText is the Text to replace Save text Link to comment Share on other sites More sharing options...
KaFu Posted August 14, 2010 Share Posted August 14, 2010 Most easy way would be with a global variable. Be aware that there is a function_FileOpenDialogEx() and _FileSaveDialogEx(). First one can be forced to do some additional checks, like e.g. look-up if file exists or allow multi-select. expandcollapse popup#include "_FileDialogsEx.au3" Global Const $CBN_SELCHANGE = 1 Global $__aDialogDef[3] $__aDialogDef[0] = "Export to" $__aDialogDef[1] = "Export" $__aDialogDef[2] = "Cancel" $Output = _FileSaveDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_OVERWRITEPROMPT, $OFN_PATHMUSTEXIST, $OFN_DONTADDTORECENT), "", 0, "_FileSave_HookProc") $__aDialogDef[0] = "Save as" $__aDialogDef[1] = "Save" $__aDialogDef[2] = "Cancel" $Output = _FileSaveDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_OVERWRITEPROMPT, $OFN_PATHMUSTEXIST, $OFN_DONTADDTORECENT), "", 0, "_FileSave_HookProc") $__aDialogDef[0] = "Open File" $__aDialogDef[1] = "Open" $__aDialogDef[2] = "Cancel" $Output = _FileOpenDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_FILEMUSTEXIST, $OFN_PATHMUSTEXIST, $OFN_ALLOWMULTISELECT), "", 0, "_FileSave_HookProc") $__aDialogDef[0] = "Import File" $__aDialogDef[1] = "Import" $__aDialogDef[2] = "Cancel" $Output = _FileOpenDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_FILEMUSTEXIST, $OFN_PATHMUSTEXIST, $OFN_ALLOWMULTISELECT), "", 0, "_FileSave_HookProc") Func _FileSave_HookProc($hWnd, $Msg, $wParam, $lParam) Switch $Msg Case $WM_INITDIALOG Local $hDlg = _WinAPI_GetParent($hWnd) _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $IDOK, $__aDialogDef[1], 0, "int", "wstr") _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $IDCANCEL, $__aDialogDef[2], 0, "int", "wstr") ControlCommand($hDlg, "", '[CLASS:ComboBox;Instance:3]', "AddString", 'ANSI') $aWinSize = WinGetPos($hDlg, "") WinMove($hDlg, "", @DesktopWidth / 2 - $aWinSize[2] / 2, @DesktopHeight / 2 - $aWinSize[3] / 2) WinSetTitle($hDlg, "", $__aDialogDef[0]) Case $WM_COMMAND Local $hComboEnc = ControlGetHandle($hWnd, "", '[CLASS:ComboBox;Instance:3]') Local $iCode = BitShift($wParam, 16) If $lParam = $hComboEnc And $iCode = $CBN_SELCHANGE Then $sEncoding = ControlCommand($hWnd, "", '[CLASS:ComboBox;Instance:3]', "GetCurrentSelection", "") EndIf ConsoleWrite($sEncoding & @CRLF) EndSwitch EndFunc ;==>_FileSave_HookProc OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
LeHuynhNam Posted August 14, 2010 Author Share Posted August 14, 2010 Thanks KaFu so much I did it. i cant think it is so easy like that 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