Jump to content

How to open associated files and read/display content?


Recommended Posts

Hi,

If you open a .txt file it will open with notepad for example, notepad reads the content and displays it.

To make a certain extension open with my program i found a script on the forum.

If I set .txt files open with myApp.exe then double click myFile.txt it starts myApp.exe,

now how can you make myApp.exe read myFile.txt and display the content in a edit box?

----------------

Robjong

Link to comment
Share on other sites

here you go:

$Ext = InputBox("file types","wich type do you want to associate? (.txt, .au3 etc)")
$Name = InputBox("file types","Name of your program:")
$Path = InputBox("file types","Path to your program: (C:\myprog.exe)")

RegWrite("HKEY_CLASSES_ROOT\" &$Ext& "\OpenWithList\"  & $Name , "")
RegWrite("HKEY_CLASSES_ROOT\" &$Name& "\shell\open\command", "","REG_SZ","""" & $Path & """ %1")

MsgBox(0,"file type","if your file is runned, then the full path to that file is send to the first command line($CMDLine[1]) of you program" &@CRLF& "You must reboot first")

#cs uncommand this to set an default icon for your files

$ico = InputBox("file types","full path to your icon: (C:\myimg.ico. must be an .ico)")
RegWrite("HKEY_CLASSES_ROOT\" &$Name& "\DefaultIcon", "","REG_EXPAND_SZ",$ico)

#CE
Edited by kip
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...