Jump to content
Sign in to follow this  
KXM

Make script default program...

Recommended Posts

KXM

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. :idiot:

TIA.

Share this post


Link to post
Share on other sites
layer

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.. :idiot:

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
SvenP

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

Share this post


Link to post
Share on other sites
KXM

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

Share this post


Link to post
Share on other sites
SvenP

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" %*')

EndFunc

I hope that's wat you mean?

Regards,

-Sven

Share this post


Link to post
Share on other sites
KXM

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.

Share this post


Link to post
Share on other sites
therks

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" %*')

Share this post


Link to post
Share on other sites
KXM

I'll be damned! So simple! It was right there in my own words.

THNX so much!

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  

×