Jump to content
Sign in to follow this  
TLOTS

I need FileRegister UDF

Recommended Posts

TLOTS

Hi, i search in the faq how to associate a extencion with my program, i found this:

http://www.autoitscript.com/wiki/FAQ#How_can_I_register_a_file_type_with_my_program_.5Bor.5D_How_can_I_make_files_with_a_certain_extension_open_in_my_program.3F

But the UDF non exist, i search in the forum and i don found it.

some can give me a copy of the UDF "FileRegister"???

PD: Sorry my bad english, i know only a bit of english

Share this post


Link to post
Share on other sites
Melba23

TLOTS,

Welcome to the AutoIt forum. :blink:

If you look at the bottom of the section on the Wiki page to which you linked, you will see:

Download here: FileRegister.au3

I have just tried to download the file from there and it worked perfectly. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
TLOTS

Really???

i have this:

Posted Image

Share this post


Link to post
Share on other sites
Melba23

TLOTS,

You do need to be logged in to download Just noticed on the image that you are - probably JohnOne has called it correctly. ;)

Here is what I downloaded from that link about 10 secs ago: :blink:

;==============================================================================================
; Filename:         Fileregister.au3
; Author:           this-is-me
;==============================================================================================

;==============================================================================================
;
; Description:      FileRegister($ext, $cmd, $verb[, $def[, $icon = ""[, $desc = ""]]])
;                   Registers a file type in Explorer
; Parameter(s):     $ext -  File Extension without period eg. "zip"
;                   $cmd -  Program path with arguments eg. '"C:\test\testprog.exe" "%1"'
;                           (%1 is 1st argument, %2 is 2nd, etc.)
;                   $verb - Name of action to perform on file
;                           eg. "Open with ProgramName" or "Extract Files"
;                   $def -  Action is the default action for this filetype
;                           (1 for true 0 for false)
;                           If the file is not already associated, this will be the default.
;                   $icon - Default icon for filetype including resource # if needed
;                           eg. "C:\test\testprog.exe,0" or "C:\test\filetype.ico"
;                   $desc - File Description eg. "Zip File" or "ProgramName Document"
;
;===============================================================================================
Func FileRegister($ext, $cmd, $verb, $def = 0, $icon = "", $desc = "")
    $loc = RegRead("HKCR\." & $ext, "")
    If @error Then
        RegWrite("HKCR\." & $ext, "", "REG_SZ", $ext & "file")
        $loc = $ext & "file"
    EndIf
    $curdesc = RegRead("HKCR\" & $loc, "")
    If @error Then
        If $desc <> "" Then
            RegWrite("HKCR\" & $loc, "", "REG_SZ", $desc)
        EndIf
    Else
        If $desc <> "" And $curdesc <> $desc Then
            RegWrite("HKCR\" & $loc, "", "REG_SZ", $desc)
            RegWrite("HKCR\" & $loc, "olddesc", "REG_SZ", $curdesc)
        EndIf
        If $curdesc = "" And $desc <> "" Then
            RegWrite("HKCR\" & $loc, "", "REG_SZ", $desc)
        EndIf
    EndIf
    $curverb = RegRead("HKCR\" & $loc & "\shell", "")
    If @error Then
        If $def = 1 Then
            RegWrite("HKCR\" & $loc & "\shell", "", "REG_SZ", $verb)
        EndIf
    Else
        If $def = 1 Then
            RegWrite("HKCR\" & $loc & "\shell", "", "REG_SZ", $verb)
            RegWrite("HKCR\" & $loc & "\shell", "oldverb", "REG_SZ", $curverb)
        EndIf
    EndIf
    $curcmd = RegRead("HKCR\" & $loc & "\shell\" & $verb & "\command", "")
    If Not @error Then
        RegRead("HKCR\" & $loc & "\shell\" & $verb & "\command", "oldcmd")
        If @error Then
            RegWrite("HKCR\" & $loc & "\shell\" & $verb & "\command", "oldcmd", "REG_SZ", $curcmd)
        EndIf
    EndIf
    RegWrite("HKCR\" & $loc & "\shell\" & $verb & "\command", "", "REG_SZ", $cmd)
    If $icon <> "" Then
        $curicon = RegRead("HKCR\" & $loc & "\DefaultIcon", "")
        If @error Then
            RegWrite("HKCR\" & $loc & "\DefaultIcon", "", "REG_SZ", $icon)
        Else
            RegWrite("HKCR\" & $loc & "\DefaultIcon", "", "REG_SZ", $icon)
            RegWrite("HKCR\" & $loc & "\DefaultIcon", "oldicon", "REG_SZ", $curicon)
        EndIf
    EndIf
EndFunc   ;==>FileRegister

;===============================================================================
;
; Description:      FileUnRegister($ext, $verb)
;                   UnRegisters a verb for a file type in Explorer
; Parameter(s):     $ext - File Extension without period eg. "zip"
;                   $verb - Name of file action to remove
;                           eg. "Open with ProgramName" or "Extract Files"
;
;===============================================================================
Func FileUnRegister($ext, $verb)
    $loc = RegRead("HKCR\." & $ext, "")
    If Not @error Then
        $oldicon = RegRead("HKCR\" & $loc & "\shell", "oldicon")
        If Not @error Then
            RegWrite("HKCR\" & $loc & "\DefaultIcon", "", "REG_SZ", $oldicon)
        Else
            RegDelete("HKCR\" & $loc & "\DefaultIcon", "")
        EndIf
        $oldverb = RegRead("HKCR\" & $loc & "\shell", "oldverb")
        If Not @error Then
            RegWrite("HKCR\" & $loc & "\shell", "", "REG_SZ", $oldverb)
        Else
            RegDelete("HKCR\" & $loc & "\shell", "")
        EndIf
        $olddesc = RegRead("HKCR\" & $loc, "olddesc")
        If Not @error Then
            RegWrite("HKCR\" & $loc, "", "REG_SZ", $olddesc)
        Else
            RegDelete("HKCR\" & $loc, "")
        EndIf
        $oldcmd = RegRead("HKCR\" & $loc & "\shell\" & $verb & "\command", "oldcmd")
        If Not @error Then
            RegWrite("HKCR\" & $loc & "\shell\" & $verb & "\command", "", "REG_SZ", $oldcmd)
            RegDelete("HKCR\" & $loc & "\shell\" & $verb & "\command", "oldcmd")
        Else
            RegDelete("HKCR\" & $loc & "\shell\" & $verb)
        EndIf
    EndIf
EndFunc   ;==>FileUnRegister

M23

Edit: Obvious!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
TLOTS

Many thanks for your help! :blink:

Share this post


Link to post
Share on other sites
z3r0c00l12

Thanks Melba,

Link in FAQ still down and I'm getting the same error as TLOTS:

An Error Occurred
Sorry, an error occurred. If you are unsure on how to use a feature, or don't know why you got this error message, try looking through the help files for more information.

[#10171] You do not have permission to view this attachment.

I've included the code Melba posted in an .au3, I've also updated the link in the FAQ.

I am not the author of the code.

FileRegister.au3

Edited by z3r0c00l12

Share this post


Link to post
Share on other sites
GrowBigTrees

Thanks Melba & z3r0c00I12 !

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  

×