Sign in to follow this  
Followers 0
FireFox

ContextMenuIcon

2 posts in this topic

#1 ·  Posted (edited)

Hi,

I want to add Icon on contextmenu like this :

Posted Image

Ive made script for create or delete contextmenu items :

$choice = InputBox("ContextMenu <d3montools>", "1 = File Contextmenuitem" & @CRLF _
         & "2 = Folder Contextmenuitem" & @CRLF _
         & "3 = Folder && File Contextmenuitem" & @CRLF _
         & "4 = Delete created Contextmenuitem" & @CRLF _
         & "x = Exit", "1", "", 250, 175)

If $choice = 1 Then
    _File()
ElseIf $choice = 2 Then
    _Folder()
ElseIf $choice = 3 Then
    _File()
    _Folder()
ElseIf $choice = 4 Then
    _Delete()
EndIf

Func _Delete()
    $choice = InputBox("ContextMenu <d3montools>", "1 = Delete File Contextmenuitem" & @CRLF _
             & "2 = Delete Folder Contextmenuitem" & @CRLF _
             & "3 = Delete File && Folder Contextmenuitem", "1", "", 250, 175)

    If $choice = 1 Then
        $delfilecm = InputBox("ContextMenu <d3montools>", "Enter name of contextmenuitem you want to delete", "New ContextItem", "", 280, 75)
        If Not @error Then
            RegDelete("HKEY_CLASSES_ROOT\*\shell\" & $delfilecm)
            If Not @error Then
                MsgBox(64, "Context Menu", "Context menu successfully deleted !")
            Else
                MsgBox(16, "Context Menu", "Error while deleting context menu !")
                Exit
            EndIf
        EndIf
    ElseIf $choice = 2 Then
        $delfoldercm = InputBox("ContextMenu <d3montools>", "Enter name of contextmenuitem you want to delete", "New ContextItem", "", 280, 75)
        If Not @error Then
            RegDelete("HKEY_CLASSES_ROOT\Folder\shell\" & $delfoldercm)
            If Not @error Then
                MsgBox(64, "Context Menu", "Context menu successfully deleted !")
            Else
                MsgBox(16, "Context Menu", "Error while deleting context menu !")
                Exit
            EndIf
        EndIf
    ElseIf $choice = 3 Then
        $delbothcm = InputBox("ContextMenu <d3montools>", "Enter name of contextmenuitem you want to delete", "New ContextItem", "", 280, 75)
        If Not @error Then
            RegDelete("HKEY_CLASSES_ROOT\*\shell\" & $delbothcm)
            RegDelete("HKEY_CLASSES_ROOT\Folder\shell\" & $delbothcm)
            If Not @error Then
                MsgBox(64, "Context Menu", "Context menu successfully deleted !")
            Else
                MsgBox(16, "Context Menu", "Error while deleting context menu !")
                Exit
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_Delete


Func _File()
    $file = FileOpenDialog("Select file to execute in context menu", "", "Application (*.exe)", 1 + 2, @SystemDir & "\Notepad.exe")

    If Not @error Then
        $text = InputBox("ContextMenu <d3montools>", "Enter name for context menu item", "New ContextItem", "", 250, 75)
        If Not @error Then
            RegWrite("HKEY_CLASSES_ROOT\*\shell")
            RegWrite("HKEY_CLASSES_ROOT\*\shell\" & $text)
            RegWrite("HKEY_CLASSES_ROOT\*\shell\" & $text & "\command")
            RegWrite("HKEY_CLASSES_ROOT\*\shell\" & $text & "\command", "", "REG_SZ", $file & " %1")
            If Not @error Then
                MsgBox(64, "Context Menu", "Context menu successfully created !")
            Else
                MsgBox(16, "Context Menu", "Error while creating context menu !")
                Exit
            EndIf
        Else
            Exit
        EndIf
    Else
        Exit
    EndIf
EndFunc   ;==>_File

Func _Folder()
    $folder = FileOpenDialog("Select file to execute in context menu", "", "Application (*.exe)", 1 + 2, @SystemDir & "\Notepad.exe")

    If Not @error Then
        $text = InputBox("ContextMenu <d3montools>", "Enter name for context menu item", "New ContextItem", "", 250, 75)
        If Not @error Then
            RegWrite("HKEY_CLASSES_ROOT\Folder\shell")
            RegWrite("HKEY_CLASSES_ROOT\Folder\shell\" & $text)
            RegWrite("HKEY_CLASSES_ROOT\Folder\shell\" & $text & "\command")
            RegWrite("HKEY_CLASSES_ROOT\Folder\shell\" & $text & "\command", "", "REG_SZ", $folder & " %1")
            If Not @error Then
                MsgBox(64, "Context Menu", "Context menu successfully created !")
            Else
                MsgBox(16, "Context Menu", "Error while creating context menu !")
                Exit
            EndIf
        Else
            Exit
        EndIf
    Else
        Exit
    EndIf
EndFunc   ;==>_Folder

Thanks for anyhelp :)

Best regards, FireFox

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Updated script !

Edit : I create my context menu on "HKEY_CLASSES_ROOT\*" key but I see that AutoIt create one's on "HKEY_CLASSES_ROOT\AutoIt3Script" where I can read "Default Icon" so the way is I want to do same thing but on all files :)

Thanks for anyhelp :o

Cheers, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0