levanduyet Posted October 4, 2011 Posted October 4, 2011 (edited) Dear All, When I use the following code: $FolderPath = FileSelectFolder("Chose folder","") How can I change the caption of SelectFolder window and button. Tks, LVD Edited October 4, 2011 by levanduyet
BrewManNH Posted October 4, 2011 Posted October 4, 2011 I don't think that you can mainly because it's using a built-in Windows function, and secondarily because it pauses the script until you close out of it so even a WinSetTitle won't work because it won't be called until after the window is closed. You'd have to create your own dialog if you wanted something else for the title, although I've been proven wrong about that many times in the past. 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
Syed23 Posted October 4, 2011 Posted October 4, 2011 There is a function to change the title "WinSetTitle()". I tried for an example from my side but i couldn't . Please have a try with this function. Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
BrewManNH Posted October 4, 2011 Posted October 4, 2011 There is a function to change the title "WinSetTitle()". I tried for an example from my side but i couldn't . Please have a try with this function.I'm pretty sure my description of the problem explains why WinSetTitle won't work for a modal dialog box like this. 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
Syed23 Posted October 4, 2011 Posted October 4, 2011 (edited) I'm pretty sure my description of the problem explains why WinSetTitle won't work for a modal dialog box like this. i apologize for posting answer without verification i had a multiple tries and BrewManNH completely right. Edited October 4, 2011 by Syed23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
rover Posted October 4, 2011 Posted October 4, 2011 (edited) How can I change the caption of SelectFolder window and button. Tested with XP/Vista x86 AdlibRegister does not work here, so timer API calls used. This can also be done with the UDF version of openfolder /w callback that Siao? posted, or using the method Ward posted recently, and a thousand others on the forum. Issue with FileSelectFolder and title with flag option. WinTitleMatchMode lower case match required, because... flag option: 0, 4 = 'Browse for Folder' flag option: 1, 2, 6, 7 = 'Browse For Folder' Opt("MustDeclareVars", 1) ;vars for _OpenFolder Global $CallBack, $sFSFTitle = "Set Title", $sBtnOK = "OK Then", $sBtnCANCEL = "Well, Maybe", $sStc3Folder = "YourText" Global $sFolder = _OpenFolder("Choose your folder", "", 6, "", 0) If Not @error Then MsgBox(0, "Folder Name", $sFolder) Func _OpenFolder($sText, $sRootDir = "", $iFlag = 0, $sInitDir = "", $hParent = 0) Local $iOpt = Opt("WinTitleMatchMode", -1) ; force lower case match - Browse for Folder or Browse For Folder $CallBack = DllCallbackRegister("_FolderCallback", "int", "hwnd;uint;uint_ptr;dword") Local $aRet = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $hParent, "uint_ptr", 24681012, _ "uint", 50, "ptr", DllCallbackGetPtr($CallBack)) If @error Or $aRet[0] = 0 Then DllCallbackFree($CallBack) Local $sTemp = FileSelectFolder($sText, $sRootDir, $iFlag, $sInitDir, $hParent) Local $iError = @error Opt("WinTitleMatchMode", $iOpt) If $CallBack <> 0 Then DllCallbackFree($CallBack) If $CallBack <> 0 Then DllCall("user32.dll", "int", "KillTimer", "hwnd", $hParent, "uint_ptr", $aRet[0]) Return SetError($iError, 0, $sTemp) EndFunc Func _FolderCallback($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $Msg, $dwTime Local $aWin = WinList("[TITLE:Browse for Folder; CLASS:#32770]") If @error Or $aWin[0][0] = 0 Then Return For $i = 1 To $aWin[0][0] If Not IsHWnd($aWin[$i][1]) Or WinGetProcess($aWin[$i][1]) <> @AutoItPID Then ContinueLoop WinSetOnTop($aWin[$i][1], "", 1) WinSetTitle($aWin[$i][1], "", $sFSFTitle) ;ControlSetText($aWin[$i][1], "", 14150, $sBtnFolder, 1) ;[CLASS:Button; INSTANCE:1] ;Make New Folder ControlSetText($aWin[$i][1], "", 1, $sBtnOK, 1);[CLASS:Button; INSTANCE:2] ;1 ;OK ControlSetText($aWin[$i][1], "", 2, $sBtnCANCEL, 1) ;[CLASS:Button; INSTANCE:3] ;2 ;CANCEL ControlSetText($aWin[$i][1], "", 14152, $sStc3Folder, 1) ;"[CLASS:Static; INSTANCE:3]" ;Folder DllCallbackFree($CallBack) $CallBack = 0 DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "uint_ptr", $iIDTimer) ExitLoop Next EndFunc Edited October 4, 2011 by rover I see fascists...
Yashied Posted October 4, 2011 Posted October 4, 2011 expandcollapse popup#Include <APIConstants.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global Const $InitDir = @ProgramFilesDir Global $hBrowseProc, $pBrowseProc, $tData, $Path $hBrowseProc = DllCallbackRegister('_BrowseProc','int', 'hwnd;uint;long;ptr') $pBrowseProc = DllCallbackGetPtr($hBrowseProc) $Path = _WinAPI_BrowseForFolderDlg(_WinAPI_PathStripToRoot($InitDir), 'Select a folder from the list below.', BitOR($BIF_RETURNONLYFSDIRS, $BIF_EDITBOX, $BIF_VALIDATE), $pBrowseProc, _WinAPI_CreateString($InitDir, $tData)) If $Path Then ConsoleWrite('--------------------------------------------------' & @CR) ConsoleWrite($Path & @CR) EndIf DllCallbackFree($hBrowseProc) Func _BrowseProc($hWnd, $iMsg, $wParam, $lParam) Local $Path Switch $iMsg Case $BFFM_INITIALIZED _SendMessage($hWnd, $BFFM_SETSELECTIONW, 1, $lParam) _WinAPI_SetWindowText($hWnd, 'My Title') Case $BFFM_SELCHANGED $Path = _WinAPI_ShellGetPathFromIDList($wParam) If Not @error Then ConsoleWrite($Path & @CR) EndIf Case $BFFM_VALIDATEFAILED MsgBox(16, 'Error', _WinAPI_GetString($wParam) & ' is invalid.', 0, $hWnd) Return 1 EndSwitch Return 0 EndFunc ;==> _BrowseProc My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Syed23 Posted October 4, 2011 Posted October 4, 2011 Hi Yashield, i am getting below error messages when i execute the above example. can you tell me where i can get the correct Include folders C:\Users\Q03200\Desktop\2.au3(28,52) : WARNING: $BFFM_SETSELECTIONW: possibly used before declaration. _SendMessage($hWnd, $BFFM_SETSELECTIONW,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Users\Q03200\Desktop\2.au3(28,52) : ERROR: $BFFM_SETSELECTIONW: undeclared global variable. _SendMessage($hWnd, $BFFM_SETSELECTIONW,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Users\Q03200\Desktop\2.au3(14,221) : ERROR: _WinAPI_CreateString(): undefined function.$Path = _WinAPI_BrowseForFolderDlg(_WinAPI_PathStripToRoot($InitDir), 'Select a folder from the list below.', BitOR($BIF_RETURNONLYFSDIRS, $BIF_EDITBOX, $BIF_VALIDATE), $pBrowseProc, _WinAPI_CreateString($InitDir, $tData)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Users\Q03200\Desktop\2.au3(36,58) : ERROR: _WinAPI_GetString(): undefined function. MsgBox(16, 'Error', _WinAPI_GetString($wParam) Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
Yashied Posted October 4, 2011 Posted October 4, 2011 You must download My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
levanduyet Posted October 9, 2011 Author Posted October 9, 2011 Hi Happy in Moscow, How about changing the caption of button "OK" or "Cancel"? Tks, LVD
Yashied Posted October 9, 2011 Posted October 9, 2011 (edited) Hi Member, _WinAPI_SetWindowText(ControlGetHandle($hWnd, '', '[CLASS:Button;INSTANCE:1]'), ':-)') _WinAPI_SetWindowText(ControlGetHandle($hWnd, '', '[CLASS:Button;INSTANCE:2]'), ':-(') Edited October 9, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
levanduyet Posted October 11, 2011 Author Posted October 11, 2011 Hi Yashied, How can I start with the folder: "My Computer"? Tks, LVD
Mat Posted October 11, 2011 Posted October 11, 2011 SHGetSpecialFolderLocation (with CSIDL_DRIVES, or SHGetKnownFolderIDList to be correct with vista+) to get the PIDL for My Computer, then _SendMessage with BFFM_SETSELECTION to set it as the selection. AutoIt Project Listing
BrewManNH Posted October 11, 2011 Posted October 11, 2011 How can I start with the folder: "My Computer"?Tks, Look in the Help file for AutoIt for "CLSIDs of Special Folders", the most common ones are in there. 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
levanduyet Posted October 14, 2011 Author Posted October 14, 2011 Look in the Help file for AutoIt for "CLSIDs of Special Folders", the most common ones are in there.Hi,I know this: FileSelectFolder("Xin chọn thư mục để cài đặt","::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")But I want to use the function of Yashied. LVD
levanduyet Posted October 14, 2011 Author Posted October 14, 2011 SHGetSpecialFolderLocation (with CSIDL_DRIVES, or SHGetKnownFolderIDList to be correct with vista+) to get the PIDL for My Computer, then _SendMessage with BFFM_SETSELECTION to set it as the selection.Hi Mat,Tks, but it look so complicated for me. LVD
Yashied Posted October 14, 2011 Posted October 14, 2011 Use the following (I replace it in the next release). expandcollapse popupFunc _WinAPI_BrowseForFolderDlg($sRoot = '', $sText = '', $iFlags = 0, $pBrowseProc = 0, $lParam = 0, $hParent = 0) Local $tBROWSEINFO = DllStructCreate('hwnd;ptr;ptr;ptr;int;ptr;uint_ptr;int;wchar[' & (StringLen($sText) + 1) & '];wchar[260]') Local $PIDL = 0, $Path, $Result = '' $Path = _WinAPI_PathSearchAndQualify($sRoot, 1) If @error Then $Path = $sRoot EndIf $PIDL = _WinAPI_ShellILCreateFromPath($Path) If @error Then ; Nothing EndIf DllStructSetData($tBROWSEINFO, 1, $hParent) DllStructSetData($tBROWSEINFO, 2, $PIDL) DllStructSetData($tBROWSEINFO, 3, DllStructGetPtr($tBROWSEINFO, 10)) DllStructSetData($tBROWSEINFO, 4, DllStructGetPtr($tBROWSEINFO, 9)) DllStructSetData($tBROWSEINFO, 5, $iFlags) DllStructSetData($tBROWSEINFO, 6, $pBrowseProc) DllStructSetData($tBROWSEINFO, 7, $lParam) DllStructSetData($tBROWSEINFO, 8, 0) DllStructSetData($tBROWSEINFO, 9, $sText) Local $Ret = DllCall('shell32.dll', 'ptr', 'SHBrowseForFolderW', 'ptr', DllStructGetPtr($tBROWSEINFO)) If @error Then Return SetError(1, 0, '') Else If Not $Ret[0] Then Return '' EndIf EndIf $Result = _WinAPI_ShellGetPathFromIDList($Ret[0]) _WinAPI_CoTaskMemFree($Ret[0]) If $PIDL Then _WinAPI_CoTaskMemFree($PIDL) EndIf If Not $Result Then Return SetError(1, 0, '') EndIf Return $Result EndFunc ;==>_WinAPI_BrowseForFolderDlg And $Path = _WinAPI_BrowseForFolderDlg('::{20D04FE0-3AEA-1069-A2D8-08002B30309D}', 'Select a folder from the list below.', BitOR($BIF_RETURNONLYFSDIRS, $BIF_EDITBOX, $BIF_VALIDATE), $pBrowseProc, _WinAPI_CreateString($InitDir, $tData)) My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
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