Sign in to follow this  
Followers 0
Robjong

How to open associated files and read/display content?

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Run > Regedit > HKEY_CLASSES_ROOT

EDIT: if you wait just a sec i'll write a example for you

Edited by kip

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Hi again,

Thanks kip, that was exactly what i needed :)

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  
Followers 0