MrCreatoR Posted March 6, 2008 Share Posted March 6, 2008 Hi, I am wondering, how to integrate a shell context menu for a specific file type inside my own GUI menu? I have created a simple menu with few items, i need that after some seperater will goes all context menu from the shell. I mean the menu that triggered after you press right (secondary) mouse button on some file in the explorer. In particulary i am intresting in the menu for *.js file type. I know it's possible because Opera browser for example, able to do this for the items menu in Transfers Menager, it shows menu items from his own, and all shell menu for selected file (that is downloading) after seperater. I only hope that this is possible using AutoIt. And btw, Opera was written on C++ Thanks. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
GEOSoft Posted March 6, 2008 Share Posted March 6, 2008 Hi,I am wondering, how to integrate a shell context menu for a specific file type inside my own GUI menu?I have created a simple menu with few items, i need that after some seperater will goes all context menu from the shell. I mean the menu that triggered after you press right (secondary) mouse button on some file in the explorer. In particulary i am intresting in the menu for *.js file type.I know it's possible because Opera browser for example, able to do this for the items menu in Transfers Menager, it shows menu items from his own, and all shell menu for selected file (that is downloading) after seperater.I only hope that this is possible using AutoIt.And btw, Opera was written on C++ Thanks.Look in the registry for HKEY_CLASSES_ROOT\JSFile\ShellYou can enumerate that key using RegEnumKey() and you could add a function to the key with RegWrite(). Just make sure that you follow the same format as used in there. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 6, 2008 Author Share Posted March 6, 2008 Look in the registry for HKEY_CLASSES_ROOT\JSFile\ShellYou can enumerate that key using RegEnumKey() and you could add a function to the key with RegWrite().Thanks, but i have no enough items there, only the basics (Open, Edit etc.). I need the whole menu, with icons and submenus if there is one.And also i need somehow to pass my filename instead of %1 to the selected function from that menu Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
GEOSoft Posted March 6, 2008 Share Posted March 6, 2008 (edited) Thanks, but i have no enough items there, only the basics (Open, Edit etc.). I need the whole menu, with icons and submenus if there is one.And also i need somehow to pass my filename instead of %1 to the selected function from that menu That's riight. There are other handlers for other functions and you will have to look in the registry to see where each of those is handled. For example look at HKEY_CLASSES_ROOT\*\Shellex. It's all a matter of digging deep enough in the registry. At some point you will also come across the default icons.For the %1 problem. No problem, thats where ShellExecute() comes into it's own.Example:ShellExecute("MyFile.txt, "", "", "Print") will pass the filename to the default application for printing text files. If you wanted to play an .mp3 file then it would be ShellExecute("My.mp3", "", "", "Play") Edited March 6, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 6, 2008 Author Share Posted March 6, 2008 That's riight. There are other handlers for other functions and you will have to look in the registry to see where each of those is handled. For example look at HKEY_CLASSES_ROOT\*\Shellex. It's all a matter of digging deep enough in the registry. At some point you will also come across the default icons.Well, i am sure that Opera does not parse the half of the registry to display just that menu I thought (and still believe in this) that this menu can be pooled by API calls, but i really have no idea where to start looking...For the %1 problem. No problem, thats where ShellExecute() comes into it's own.I know about ShellExecute capabilities, thanks, but as i said, i need it more practical, more original, and of course more (very) stable Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 6, 2008 Author Share Posted March 6, 2008 I found this thread, it's for C#, but maybe someone could translate it to AutoIt? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
ReFran Posted March 6, 2008 Share Posted March 6, 2008 (edited) "........ but maybe someone could translate it to AutoIt?" Perhaps translating some few VBS lines are more simple. What you need you will find in the shell.application object. With "Verbs" you can list all contextmenu commands from the folderitem object. Then you can execute it with InvokeVerb or simple with shellexecute. HTH, Reinhard ' VBS Code ' Get all Verbs from contextmenu of folderitem file = "C:\Test.txt" set shell = CreateObject("Shell.Application") set folder = shell.NameSpace(0) set folderitem = folder.ParseName(file) set folderitemverbs = folderitem.Verbs for each folderitemverb in folderitemverbs list = list & folderitemverb & vbCr next MsgBox list Edited March 6, 2008 by ReFran Link to comment Share on other sites More sharing options...
GEOSoft Posted March 7, 2008 Share Posted March 7, 2008 "........ but maybe someone could translate it to AutoIt?" Perhaps translating some few VBS lines are more simple. What you need you will find in the shell.application object. With "Verbs" you can list all contextmenu commands from the folderitem object. Then you can execute it with InvokeVerb or simple with shellexecute. HTH, Reinhard ' VBS Code ' Get all Verbs from contextmenu of folderitem file = "C:\Test.txt" set shell = CreateObject("Shell.Application") set folder = shell.NameSpace(0) set folderitem = folder.ParseName(file) set folderitemverbs = folderitem.Verbs for each folderitemverb in folderitemverbs list = list & folderitemverb & vbCr next MsgBox listAnd that translates to $file = "C:\Test.txt" $List - "" $shell = ObjCreate("Shell.Application") $folder = $shell.NameSpace(0) $folderitem = $folder.ParseName(file) $folderitemverbs = $folderitem.Verbs for $folderitemverb in $folderitemverbs $list &= $folderitemverb & @CR next MsgBox(0,"Verbs", $list) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
ReFran Posted March 7, 2008 Share Posted March 7, 2008 " ..... And that translates to" Mmmmh, the VBS works somehow better for me. Reinhard Link to comment Share on other sites More sharing options...
ReFran Posted March 7, 2008 Share Posted March 7, 2008 Hi, I've tried to get it to work, but without luck. Other properties works fine, but ".verbs" used in AutoIT deliver only blanks. I think it's an interesting function especially in connection with Shellexecute(.....Verb) Perhaps someone else can take over. Best regards, Reinhard $file = "Test.txt" $Ordner ="c:\" $oShell = ObjCreate("Shell.Application") DIM $aVerbs GetShellFolderNM() GetItem() GetVerbs() func GetShellFolderNM() $folder = $oShell.NameSpace($Ordner) MsgBox(0,"", $Ordner & " shell-name is: " & $folder.Title) endfunc func GetItem() $folder = $oShell.NameSpace($Ordner) $GetItem = $folder.ParseName($file) msgbox(0,"",$GetItem.Name) endfunc func GetVerbs() DIM $list = "" $folder = $oShell.NameSpace($ordner) $folderitem = $folder.ParseName($file) $aVerbs = $folderitem.Verbs For $i in $aVerbs $list = $list & $i & @CR next MsgBox(0,"", $list) endfunc Link to comment Share on other sites More sharing options...
Holger Posted March 7, 2008 Share Posted March 7, 2008 Dim $sFile = "boot.ini" Dim $sFolder = "c:\" Dim $oShell = ObjCreate("Shell.Application") GetVerbs() Func GetVerbs() Dim $sList = "" $oFolder = $oShell.NameSpace($sFolder) $oFolderItem = $oFolder.ParseName($sFile) $oFolderItemVerbs = $oFolderItem.Verbs For $i = 0 To $oFolderItemVerbs.Count - 1 $sList = $sList & $i & ": " & $oFolderItemVerbs.Item($i).Name & @LF Next MsgBox(0, "", $sList) EndFunc Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
ReFran Posted March 8, 2008 Share Posted March 8, 2008 (edited) Vielen Dank, Holger. Works now great and is very useable with your own explorer and with Shellexecute. Grüße an's Hofbräuhaus, Reinhard PS: I've at least one good WSH scripting book from Tobias Weltner as PDF with many examples. If you are interested PM me. Edited March 8, 2008 by ReFran 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