View Full Version : File.Open ...how to open *.txt, *.exe, etc.
sferguson
11-20-2003, 09:08 AM
Hi Folks,
If you have a button you've built into an autorun (using AMS 5) that simply does
File.Open("AutoPlay\\Docs\\MyText.txt", "", SW_SHOWNORMAL);
What is the simplest way to make the file name a "wildcard" and just have the button open the file type, instead of the specific file name?
Corey
11-20-2003, 09:40 AM
You mean open all files of a given type on the user's hard drive at once with a single click?
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
sferguson
11-20-2003, 11:54 AM
ahhh....
Nope.
I just want it to always open/launch the text file (or whatever file type) is stored in a specified folder on the disc.
Here's a bit more detail on the scenario ... every disc will have one, and only one, .txt file on it, which will always be saved in the same place. However, the text file will always be named something different for every disc and the naming convention, etc. is out of my control. The objective is to create a button that will always launch or open a file, based on the file extension, instead of the actual file name.
Example:
On a disc created for "Sue"...
AutoPlay\\HodgePodgeFolder\\
Sues_WordFile.txt
Sues_Song.mp3
Sues_Budget.xls
Sues_Picture.jpg
A disc created for "Sam"...
AutoPlay\\HodgePodgeFolder\\
Sams_WordFile.txt
Sams_Song.mp3
Sams_Budget.xls
Sams_Picture.jpg
Thus, the "Budget" button in the autorun would simply launch the only .xls file located in the specified folder.
Ted Sullivan
11-20-2003, 12:04 PM
Take a look at the File.Find action. There are a bunch of examples in the help file to work with. That will do exactly what you're asking.
Corey
11-20-2003, 12:07 PM
Here's an example... But the better way, if there is indeed only one of each per dsic, is not to name them at all. Just call them mp3.mp3, text.txt, pic.jpg and that's it. Same for all...
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
sferguson
11-20-2003, 12:39 PM
Perfect, THANKS!
-Scott
Powered by vBulletin™ Version 4.0.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.