KXM Posted January 9, 2005 Share Posted January 9, 2005 Is there a way to make my script the default program for a given file type? I know I can set Windows to always open it, but I would like the program make it's self the default. I have searched the forum and help file, no luck. TIA. Link to comment Share on other sites More sharing options...
layer Posted January 9, 2005 Share Posted January 9, 2005 (edited) RegWrite i think... but im at my cusings so i dont have the example larry gave me... if no one helps you i will post up the example larry gave me once i get back home.. Edited January 9, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
SvenP Posted January 9, 2005 Share Posted January 9, 2005 You could try this one: Func _RegisterExtension( $FileExtension) $AutoIt3Location = @ProgramFilesDir & "\AutoIt3\AutoIt3.exe" RegWrite("HKCR\" & $FileExtension,"","REG_SZ", "AutoIt3Script") RegWrite("HKCR\AutoIt3Script\Shell\Run\Command","","REG_SZ", $AutoIt3Location & ' "%1" %*') RegWrite("HKCR\AutoIt3Script\Shell\Open\Command","","REG_SZ", $AutoIt3Location & ' "%1" %*') EndFunc You could call the function like this: _RegisterExtension (".icset") Regards, -Sven Link to comment Share on other sites More sharing options...
KXM Posted January 10, 2005 Author Share Posted January 10, 2005 I'm sorry if this sounds dumb. My I'm a little slow when it comes to programing. But if I'm reading this correctly, this would reg autoscript to always open a given file type. I'm wondering how do do the same, but with my compiled script. I see the concept, however I'm not sure how to use it to refrecne my program. Func _RegisterExtension( $FileExtension) $Mylocation = @ProgramFilesDir & "\where\it\is\myscript.exe" RegWrite("HKCR\" & $FileExtension,"","REG_SZ", "***Myscript?***") RegWrite("***whathere??**","","REG_SZ", $Mylocation & "") EndFunc Link to comment Share on other sites More sharing options...
SvenP Posted January 10, 2005 Share Posted January 10, 2005 I'm sorry if this sounds dumb. My I'm a little slow when it comes to programing. But if I'm reading this correctly, this would reg autoscript to always open a given file type.I'm wondering how do do the same, but with my compiled script.I see the concept, however I'm not sure how to use it to refrecne my program.Func _RegisterExtension( $FileExtension)$Mylocation = @ProgramFilesDir & "\where\it\is\myscript.exe"RegWrite("HKCR\" & $FileExtension,"","REG_SZ", "***Myscript?***")RegWrite("***whathere??**","","REG_SZ", $Mylocation & "")EndFunc<{POST_SNAPBACK}>Aha, I'm sorry. Now I understand your question. Well, try this one:$YourProgramPath= @ProgramFilesDir & "\where\it\is\" ; with trailing backslash ! $YourProgramEXE= "myscript.exe" $YourExtension=".icset" _RegisterExtension ($YourProgramPath,$YourProgramEXE, $YourExtension) Func _RegisterExtension($ProgramPath, $ProgramName, $FileExtension) RegWrite("HKCR\" & $FileExtension,"","REG_SZ", $ProgramName) RegWrite("HKCR\" & ProgramName & "\Shell\Run\Command","","REG_SZ", $ProgramPath & $ProgramEXE & ' "%1" %*') RegWrite("HKCR\" & ProgramName & "\Shell\Open\Command","","REG_SZ", $ProgramPath & $ProgramEXE & ' "%1" %*') EndFuncI hope that's wat you mean?Regards,-Sven Link to comment Share on other sites More sharing options...
KXM Posted January 13, 2005 Author Share Posted January 13, 2005 THNX so much for your help! I think I understand the concept fully now, but I'm still having a small syntax issue. Here is a summery of my code: Dim $meedir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Meedio\Meedio Essentials", "root") RegWrite("HKEY_CLASSES_ROOT\.icset", "", "REG_SZ", "IconChooser") RegWrite("HKEY_CLASSES_ROOT\IconChooser\Shell\Run\Command", "", "REG_SZ", $meedir & '"plugins\module\IconChooser\IconChooser.exe" "%1" %*') RegWrite("HKEY_CLASSES_ROOT\IconChooser\Shell\Open\Command", "", "REG_SZ", $meedir & '"plugins\module\IconChooser\IconChooser.exe" "%1" %*') I'm not sure what is wrong, but I know it's close. Because anything with the extension .icset will dispaly to correct icon, but when I try to open it, I get the Windows 'selesct program box'. Or sometime I get access denied. Any cluse? BTW: $meedir returns: C:\Program Files\Meedio\Meedio Essentials\ without any quotes. Link to comment Share on other sites More sharing options...
therks Posted January 13, 2005 Share Posted January 13, 2005 So that means that what ends up being written to the registry key is this:C:\Program Files\Meedio\Meedio Essentials\"plugins\module\IconChooser\IconChooser.exe" "%1" %*Is this what you want it to be?I think you need something more like this:RegWrite("HKEY_CLASSES_ROOT\IconChooser\Shell\Open\Command", "", "REG_SZ", '"' & $meedir & 'plugins\module\IconChooser\IconChooser.exe" "%1" %*') My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
KXM Posted January 13, 2005 Author Share Posted January 13, 2005 I'll be damned! So simple! It was right there in my own words. THNX so much! 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