Sign in to follow this  
Followers 0
jiglei

Not allowed to download attachment from FAQ?

10 posts in this topic

Hey guys, I was searching the forums on how would I be able to make my program the "defined program" to run a certain type of files that I myself made, and make those type of files have a right icon, and not a crappy one that windows sets to it.

I managed to find in some topic refering to the FAQ here, I looked it up and I actually found exactly what I needed at question 16.

Now here's the thing, I can't get the source of the function without getting the source of "<FileRegister.au3>", I tried to download it but the following error showed up in a forum message:

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

I thought it happened because I wasn't logged on to the forum, but I tried to relog twice, and even though it says I'm logged, it stills says I'm not authorized.

I don't know why I'm not authorized, and can't begin to think where to search why this is happening so, maybe someone can tell me...

Does it have anything to do with the warn status? No offense, but I believe it was ages ago...

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

;==============================================================================================
;
; 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

;===============================================================================
;
; 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

Hope it's the good one ! Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Link dates back to 2007, but this i have posted, dates back to last year ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

www.autoitscript.com and autoitscript.com are used ambiguously, but your browser sees them differently. You are probably going to autoitscript.com logged in, where as the Wiki links to www.autoitscript.com .

Try either of these links and see if they work:

http://www.autoitscript.com/forum/index.php?app=core&module=attach&section=attach&attach_id=26378

http://autoitscript.com/forum/index.php?app=core&module=attach&section=attach&attach_id=26378

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@Manadar

Logged or not, both links give the same error !

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Oh well, this is the content of the file:

;==============================================================================================
; 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

Share this post


Link to post
Share on other sites

It's exactly the same as mine ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#10 ·  Posted

Got it... Thanks.

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