Jump to content

Program open with a file


 Share

Recommended Posts

I have a problem. When I click on the file "Hello.test", when must open the program "Test.exe". How can I write this. The Program "Test.exe" must open all infos about "Hello.test"

Are you asking how to associate a file with a .test extension with your test.exe program?

[font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font]

Link to comment
Share on other sites

OK. The name of my programm is test.exe. The file for the program is hello.test. in the file hello.test you can find a sentence like this "Hello this is may test-program". Then I click on the file hello.test when start the program test.exe. When the program is active when the programm have to do read the sentence in the file hello.test and show it in a MsgBox

Link to comment
Share on other sites

Lets see if I understand fully what you want... you want to open a text file when it has a different extension?

See if this is what you want... make a txt file, open it and put a some text in it, then rename it to test.hello and place in the same spot as your script(!important!)

$file = FileOpen("test.hello", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

$var = FileRead($file)
MsgBox(0, "Read...", $var)


FileClose($file)

If I am correct the extension of a file is there only to say how it should open. A text file is a text file with or without a .txt extension.

Let us know if thats what you wanted.

Edited by someone
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

@someone: That isn't what I search.

OK. You have a file. The filename is "Test.doc". When you click on this file, then start Word. And Word load the index of the file. I will programming this, too. When you click on the file "Hello.test", then start my programm "Test.exe". And this program must load the index of the file "Hello.test".

Link to comment
Share on other sites

You want file association?

;Mhz

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

Func _FiletypeAssociation($extension, $type, $program, $description = '')
    ; e.g. _FiletypeAssociation('.pdf', 'FoxitReader.Document', '"%ProgramFiles%\FoxitReader.exe" "%1"')
    $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
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...