jiglei Posted May 2, 2011 Share Posted May 2, 2011 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... Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 2, 2011 Share Posted May 2, 2011 I get it too so something is broken/stupid. Search FileRegister and get it from some thread. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
wakillon Posted May 2, 2011 Share Posted May 2, 2011 (edited) expandcollapse popup;============================================================================================== ; ; 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 EndFuncHope it's the good one ! Edited May 2, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 2, 2011 Share Posted May 2, 2011 You took the oldest one you could find? I thought it was smarter to take a new one, just in case someone changed something (hopefully for the better). .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
wakillon Posted May 2, 2011 Share Posted May 2, 2011 Link dates back to 2007, but this i have posted, dates back to last year ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
jvanegmond Posted May 2, 2011 Share Posted May 2, 2011 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§ion=attach&attach_id=26378 http://autoitscript.com/forum/index.php?app=core&module=attach§ion=attach&attach_id=26378 github.com/jvanegmond Link to comment Share on other sites More sharing options...
wakillon Posted May 2, 2011 Share Posted May 2, 2011 (edited) @Manadar Logged or not, both links give the same error ! Edited May 2, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
jvanegmond Posted May 2, 2011 Share Posted May 2, 2011 Oh well, this is the content of the file: expandcollapse popup;============================================================================================== ; 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 github.com/jvanegmond Link to comment Share on other sites More sharing options...
wakillon Posted May 2, 2011 Share Posted May 2, 2011 It's exactly the same as mine ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
jiglei Posted May 3, 2011 Author Share Posted May 3, 2011 Got it... Thanks. 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