cracksys Posted May 3, 2009 Share Posted May 3, 2009 hi all, here's the thing, i wanted to unrar specific file (xxx.rar) by using it context menu -- right clicking. question is, how do i get the file selected (click once)? i can't continue with MouseCoord because that file's position within a folder is constantly changing. thanks Link to comment Share on other sites More sharing options...
JackDinn Posted May 3, 2009 Share Posted May 3, 2009 (edited) $file_name="ver 1.7.txt" $folder="C:\Documents and Settings\Greg\Desktop\ClipCatch Pack" WinActivate($folder) WinWaitActive ($folder) $item=ControlListView ($folder,"","SysListView321","FindItem",$file_name) $count=ControlListView ($folder,"","SysListView321","GetItemCount") ControlListView ($folder,"","SysListView321","deSelect",0,$count) ControlListView ($folder,"","SysListView321","Select",$item) if you know what the name of the file is then you can do this. (folder will have to be open already) if not just use ShellExecute($folder) - open folder Edited May 3, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 3, 2009 Moderators Share Posted May 3, 2009 cracksys,An Explorer list is a ListView, so you can use the _GUIListView UDF to get the contents and their positions:#Include <GuiListView.au3> #include <Array.au3> $sFolder_Name = "Your_Folder_Name" $hExplorer_List = ControlGetHandle($sFolder_Name, "", "[CLASS:SysListView32;INSTANCE:1]" ) ; Save the listview items and positions to an array Global $aExplorer_Contents[_GUICtrlListView_GetItemCount($hExplorer_List)][5] For $i = 0 to _GUICtrlListView_GetItemCount($hExplorer_List) - 1 ; Name $aExplorer_Contents[$i][0] = _GUICtrlListView_GetItemText($hExplorer_List, $i) ; If you use icons $aPos = _GUICtrlListView_GetItemPosition($hExplorer_List, $i) ; Left $aExplorer_Contents[$i][1] = $aPos[0] ; Top $aExplorer_Contents[$i][2] = $aPos[1] ; If you use lists $aPos = _GUICtrlListView_GetItemRect($hExplorer_List, $i) ; Left $aExplorer_Contents[$i][3] = $aPos[0] ; Top $aExplorer_Contents[$i][4] = $aPos[1] Next ; Show the contents and their positions _ArrayDisplay($aExplorer_Contents)This will give you a list of the contents and their positions within the Explorer ListView. Over to you to click on the one you want.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...
cracksys Posted May 3, 2009 Author Share Posted May 3, 2009 @JackDinnthanks. i tested and both of $count, $item variable contained 0 in the endcould it be that because i'm using vista?@Melba23haven't had time to test it yet. maybe tomorrow. but thanks. Link to comment Share on other sites More sharing options...
Yashied Posted May 3, 2009 Share Posted May 3, 2009 cracksys, An Explorer list is a ListView, so you can use the _GUIListView UDF to get the contents and their positions:#Include <GuiListView.au3> #include <Array.au3> $sFolder_Name = "Your_Folder_Name" $hExplorer_List = ControlGetHandle($sFolder_Name, "", "[CLASS:SysListView32;INSTANCE:1]" ) ; Save the listview items and positions to an array Global $aExplorer_Contents[_GUICtrlListView_GetItemCount($hExplorer_List)][5] For $i = 0 to _GUICtrlListView_GetItemCount($hExplorer_List) - 1 ; Name $aExplorer_Contents[$i][0] = _GUICtrlListView_GetItemText($hExplorer_List, $i) ; If you use icons $aPos = _GUICtrlListView_GetItemPosition($hExplorer_List, $i) ; Left $aExplorer_Contents[$i][1] = $aPos[0] ; Top $aExplorer_Contents[$i][2] = $aPos[1] ; If you use lists $aPos = _GUICtrlListView_GetItemRect($hExplorer_List, $i) ; Left $aExplorer_Contents[$i][3] = $aPos[0] ; Top $aExplorer_Contents[$i][4] = $aPos[1] Next ; Show the contents and their positions _ArrayDisplay($aExplorer_Contents) This will give you a list of the contents and their positions within the Explorer ListView. Over to you to click on the one you want. M23Melba23, I see you are the master of "SysListView32". Good example again. 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... Link to comment Share on other sites More sharing options...
cracksys Posted May 3, 2009 Author Share Posted May 3, 2009 i'm sorry but i couldn't find any EDIT button in here@JackDinni managed to get your example up and running. it worked well if $file_name is a sub-folder name but it won't if i changed it to any file name within that folder.any thought on this? Link to comment Share on other sites More sharing options...
Yashied Posted May 3, 2009 Share Posted May 3, 2009 Why you do not want to simply add your item to the context menu of Windows using the registry? 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... Link to comment Share on other sites More sharing options...
JackDinn Posted May 3, 2009 Share Posted May 3, 2009 (edited) @JackDinni managed to get your example up and running. it worked well if $file_name is a sub-folder name but it won't if i changed it to any file name within that folder.any thought on this?pass, it works fine for me with both $File_name = "subfolder" or "file name". if you can select a folder then it should be no problem to select a file in same location.have you misspelt or left of the suffix from the file name or to many back slashes in path?what does $item return?what does $count return?whats your full path ?whats your file name ?and show me what you got so far (just this bit of script) Edited May 3, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
cracksys Posted May 4, 2009 Author Share Posted May 4, 2009 @JackDinni had a quick rewrite and found out that $file_name="File1.rar" won't work if my explorer setting is set to Hide Known Extensions.i could just set $file_name="File1" but problem arise when there's a folder called File1 in the same directory. so how do i make sure $item, $count point to File1 not the folder called File1?i'll post my script when i get back home.@Yashiedi'm sorry but i think you misunderstood my question. here's the situation -- i have a bunch of portable apps within 1 folder that i RAR-ed whenever i left home for office & vice versa. this RAR file will be transited on a removable drive. when i arrived at my destination, i will unRAR it back.i just want to automate the process of -- copying File.rar to computer, unRAR it then RAR it back and copying it to the removable drive when i'm finished. Link to comment Share on other sites More sharing options...
JackDinn Posted May 4, 2009 Share Posted May 4, 2009 (edited) ahh , have to be difficult , lol$file_type = "Text Document" $file_name = "ver 1.5.txt" $folder = "C:\Documents and Settings\Greg\Desktop\ClipCatch Pack" $file = _select_file_in_folder($file_name, $folder, $file_type) MsgBox(0, "File Selected", $file) Func _select_file_in_folder($file_name, $folder, $file_type) ShellExecute($folder);open folder WinActivate($folder) WinWaitActive($folder) ControlListView($folder, "", "SysListView321", "SelectClear") For $x = 1 To ControlListView($folder, "", "SysListView321", "GetItemCount") If ControlListView($folder, "", "SysListView321", "GetText", $x) = $file_name Then If ControlListView($folder, "", "SysListView321", "GetText", $x, 2) = $file_type Then ControlListView($folder, "", "SysListView321", "Select", $x) Return $x EndIf EndIf Next Return 0 EndFunc;==>_select_file_in_foldernote:- $file_type -- (as in "Text Document" or "Compressed (zipped) Folder") in your case, i think "WinRAR archive"thing is that there are much better ways of doing what your describing (moving files around, basically and a bit of archiving see :- zip UDF) but this should do ya 4 now try out. good luck Edited May 4, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
dexto Posted May 12, 2009 Share Posted May 12, 2009 ControlListView ($folder,"","SysListView321","Select",$item) Selects the file ok but is it possible to make sure the selected file is visible? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 12, 2009 Moderators Share Posted May 12, 2009 dexto,Look at _GUICtrlListView_EnsureVisible in the Help file.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...
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