Jump to content

File association Question


Recommended Posts

Hi.

Hi everyone, is there a way to associate a file type with

a program written in autoit?

I want to open .log files using a text editor written in autoit,

is that possible?

Thanks...

Please read the FAQ (Sticky Posting, topmost in this forum) [1]

Regards, Rudi.

[1] Q16. How can I register a file type with my program [or] How can I make files with a certain extension open in my program?

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

@all

Maybe this can get you going

_FiletypeAssociation('.test', 'test', 'notepad "%1"', 'test description')

Func _FiletypeAssociation($extension, $type, $program, $description = '')

    $exitcode = RunWait(@ComSpec & ' /c ftype ' & $type & '=' & $program & _
             ' && assoc ' & $extension & '=' & $type, '', @SW_HIDE)
    If $description And Not $exitcode Then
        Return RegWrite('HKCR\' & $type, '', 'Reg_sz', $description)
    EndIf
    Return Not $exitcode
EndFunc

regards

ptrex

Link to comment
Share on other sites

@all

Maybe this can get you going

_FiletypeAssociation('.test', 'test', 'notepad "%1"', 'test description')

Func _FiletypeAssociation($extension, $type, $program, $description = '')

    $exitcode = RunWait(@ComSpec & ' /c ftype ' & $type & '=' & $program & _
             ' && assoc ' & $extension & '=' & $type, '', @SW_HIDE)
    If $description And Not $exitcode Then
        Return RegWrite('HKCR\' & $type, '', 'Reg_sz', $description)
    EndIf
    Return Not $exitcode
EndFunc

regards

ptrex

Handy! Thanks, I will have good usage of this!
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...