[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
[MacPerl] Selecting files from MacPerl
Title:
Selecting files from MacPerl
I've been lurking for a longtime, keeping my eye on the list but
not having many questions since I'd generally been programming for a
Unix box. Anyways, I finally had a project that specifically required
a Perl program on the Mac and while I got most of it working, I ran
into a snag. The help files were very vague on how to select files to
open or save using the standard Mac dialog boxes. I hacked a
workaround by running an AppleScript from the script to choose the
file the user wants to manipulate and passing the result to the the
script:
$import_sourcefile =
MacPerl::DoAppleScript(<<END_SCRIPT);
tell application
"Finder"
return choose file of type "TEXT"
end tell
END_SCRIPT
A rather inelegant solution I thought. For saving the file, I
had the script set the name and destination for the file rather than
letting the user input their own name and save location. Even more
inelegant.
Well, I'd really like to cleanup the script and use MacPerl to
let the user pick the input file and save the output file in the
location of their choice. But I can't seem to find any decent help or
examples only "Access to Inside Macintosh is essential for proper
use of these functions. Explanations of terms, processes and
procedures are provided there." in the help file. Does
anyone know where I can find a tutorial or have the proper usage of
open and save dialogs?
Thanks for all the assistance,
David Wadson - wadsond@air.on.ca
Composing Foreman
The Chronicle-Journal
Thunder Bay, Ontario, Canada
www.chroniclejournal.com
# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org