hiepxuan2008 Posted April 6, 2013 Share Posted April 6, 2013 (edited) Hi, I'm build my soft.And I catch a trouble with Open Folder and Select FileIt likes Internet Download ManagerLike The Picture, When I open folder, It will open folder and select file.Other forums also discuss about it, but I don't have knowledge for C#http://stackoverflow.com/questions/334630/open-folder-and-select-the-fileSo, How to Open And Select File with autoit Edited April 6, 2013 by hiepxuan2008 Link to comment Share on other sites More sharing options...
Chimaera Posted April 6, 2013 Share Posted April 6, 2013 Are you talking about the built in internet download manager that is within Internet Explorer? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
water Posted April 6, 2013 Share Posted April 6, 2013 (edited) Is it just me that can't see the images you included? Edited April 6, 2013 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
MuchTex Posted April 6, 2013 Share Posted April 6, 2013 Is it just me that can't see the images you included?You don't see the posted image? Just kidding I'm pretty sure that's everyone. Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 (edited) Are you talking about the built in internet download manager that is within Internet Explorer?Reply: I don't mean built IDM, I just give example about open folder and select file.Example: I have a path of a file "C:hiepit.jpg" and I want to open the folder with a file is selectedIs it just me that can't see the images you included?Oh! I have just reupdated it!The first Pic, I choose a file and click Open FolderThe second picture is a result, Explore open Folder contain its file, and select its file. Edited April 6, 2013 by hiepxuan2008 Link to comment Share on other sites More sharing options...
water Posted April 6, 2013 Share Posted April 6, 2013 Looks like you need function FileOpenDialog. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 (edited) @Water: Can you give me a code for it. (Code open folder and select it, if we have path 'C:/hiepit') Edited April 6, 2013 by hiepxuan2008 Link to comment Share on other sites More sharing options...
water Posted April 6, 2013 Share Posted April 6, 2013 You want to select the folder or a file in the folder? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 You want to select the folder or a file in the folder?A file.$PATH='C:/hiepit.jpg' Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 (edited) We had a PATH 'C:hiepit.jpg' And we write The program auto open folder contain its file and select its file. Not we choose the path for it ( I gave example about IDM) Edited April 6, 2013 by hiepxuan2008 Link to comment Share on other sites More sharing options...
water Posted April 6, 2013 Share Posted April 6, 2013 Something like: $sSelectedFile = FileOpenDialog("Please select a file", "C:\", "Images (*.jpg)", 3, "hiepit.jpg") MsgBox(0, "Selected file", $sSelectedFile) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 (edited) Something like: $sSelectedFile = FileOpenDialog("Please select a file", "C:\", "Images (*.jpg)", 3, "hiepit.jpg") MsgBox(0, "Selected file", $sSelectedFile) This code mean we choose path for it. It's not my mind: I gave example about IDM , Have you ever used IDM. Edited April 6, 2013 by hiepxuan2008 Link to comment Share on other sites More sharing options...
water Posted April 6, 2013 Share Posted April 6, 2013 I don't fully get it. You want to select the file in the list of files (that's how I understand your screenshot). What should the user or your script do then? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
KaFu Posted April 6, 2013 Share Posted April 6, 2013 The contains a function called _WinAPI_ShellOpenFolderAndSelectItems(). OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 _WinAPI_ShellOpenFolderAndSelectItems(). is my mind.Thanks you! KaFu Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 (edited) Thanks ! I found solution for it #Include <WinAPIEx.au3> _WinAPI_ShellOpenFolderAndSelectItems('C:\hiepit.jpg') Edited April 6, 2013 by hiepxuan2008 Link to comment Share on other sites More sharing options...
KaFu Posted April 6, 2013 Share Posted April 6, 2013 Good to hear it worked . hiepxuan2008 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 I'm trying make it short, because I only use a function _WinAPI_ShellOpenFolderAndSelectItems Link to comment Share on other sites More sharing options...
hiepxuan2008 Posted April 6, 2013 Author Share Posted April 6, 2013 (edited) Wow, I'm sucess . THanks all. It can do work independently expandcollapse popup_WinAPI_ShellOpenFolderAndSelectItems('C:\hiepit.jpg') Func _WinAPI_ShellOpenFolderAndSelectItems($sPath, $aNames = 0, $iStart = 0, $iEnd = -1, $iFlags = 0) Local $PIDL, $Ret, $tPtr = 0, $Count = 0, $Obj = 0 $sPath = _WinAPI_PathRemoveBackslash(_WinAPI_PathSearchAndQualify($sPath)) If IsArray($aNames) Then If ($sPath) And (Not _WinAPI_PathIsDirectory($sPath)) Then Return SetError(1, 0, 0) EndIf EndIf $PIDL = _WinAPI_ShellILCreateFromPath($sPath) If @error Then Return SetError(1, 0, 0) EndIf If IsArray($aNames) Then If $iStart < 0 Then $iStart = 0 EndIf If ($iEnd < 0) Or ($iEnd > UBound($aNames) - 1) Then $iEnd = UBound($aNames) - 1 EndIf $tPtr = DllStructCreate('ptr[' & ($iEnd - $iStart + 1) & ']') If @error Then ; Nothing Else For $i = $iStart To $iEnd $Count += 1 If $aNames[$i] Then DllStructSetData($tPtr, 1, _WinAPI_ShellILCreateFromPath($sPath & '\' & $aNames[$i]), $Count) Else DllStructSetData($tPtr, 1, 0, $Count) EndIf Next EndIf EndIf If _WinAPI_CoInitialize() Then $Obj = 1 EndIf $Ret = DllCall('shell32.dll', 'uint', 'SHOpenFolderAndSelectItems', 'ptr', $PIDL, 'uint', $Count, 'ptr', DllStructGetPtr($tPtr), 'dword', $iFlags) If @error Then $Ret = 0 Else If $Ret[0] Then $Ret = $Ret[0] EndIf EndIf If $Obj Then _WinAPI_CoUninitialize() EndIf _WinAPI_CoTaskMemFree($PIDL) For $i = 1 To $Count $PIDL = DllStructGetData($tPtr, $i) If $PIDL Then _WinAPI_CoTaskMemFree($PIDL) EndIf Next If Not IsArray($Ret) Then Return SetError(1, $Ret, 0) EndIf Return 1 EndFunc ;==>_WinAPI_ShellOpenFolderAndSelectItems Func _WinAPI_PathSearchAndQualify($sPath, $fExists = 0) Local $Ret = DllCall('shlwapi.dll', 'int', 'PathSearchAndQualifyW', 'wstr', $sPath, 'wstr', '', 'int', 4096) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, '') EndIf If ($fExists) And (Not FileExists($Ret[2])) Then Return SetError(2, 0, '') EndIf Return $Ret[2] EndFunc ;==>_WinAPI_PathSearchAndQualify Func _WinAPI_PathRemoveBackslash($sPath) Local $Ret = DllCall('shlwapi.dll', 'ptr', 'PathRemoveBackslashW', 'wstr', $sPath) If @error Then Return SetError(1, 0, '') Else If Not $Ret[0] Then Return $sPath EndIf EndIf Return $Ret[1] EndFunc ;==>_WinAPI_PathRemoveBackslash Func _WinAPI_ShellILCreateFromPath($sPath) Local $Ret = DllCall('shell32.dll', 'uint', 'SHILCreateFromPath', 'wstr', $sPath, 'ptr*', 0, 'dword*', 0) If @error Then Return SetError(1, 0, 0) Else If $Ret[0] Then Return SetError(1, $Ret[0], 0) EndIf EndIf Return $Ret[2] EndFunc ;==>_WinAPI_ShellILCreateFromPath Func _WinAPI_CoInitialize($iFlags = 0) Local $Ret = DllCall('ole32.dll', 'uint', 'CoInitializeEx', 'ptr', 0, 'dword', $iFlags) If @error Then Return SetError(1, 0, 0) Else If $Ret[0] Then Return SetError(1, $Ret[0], 0) EndIf EndIf Return 1 EndFunc ;==>_WinAPI_CoInitialize Func _WinAPI_CoUninitialize() DllCall('ole32.dll', 'none', 'CoUninitialize') If @error Then Return SetError(1, 0, 0) EndIf Return 1 EndFunc ;==>_WinAPI_CoUninitialize Func _WinAPI_CoTaskMemFree($pMemory) DllCall('ole32.dll', 'none', 'CoTaskMemFree', 'ptr', $pMemory) If @error Then Return SetError(1, 0, 0) EndIf Return 1 EndFunc ;==>_WinAPI_CoTaskMemFree Func _WinAPI_PathIsDirectory($sPath) Local $Ret = DllCall('shlwapi.dll', 'int', 'PathIsDirectoryW', 'wstr', $sPath) If @error Then Return SetError(1, 0, 0) EndIf Return $Ret[0] EndFunc ;==>_WinAPI_PathIsDirectory Edited April 6, 2013 by hiepxuan2008 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