|
|
Droplet to open files with X11 app
I was just working on a droplet open one or more text files with Nedit when I ran across this tip. I just keep the droplet on my desktop for easy access.
Here's the code for the droplet if anyone's interested. It could easily be modified to work with just about any X app.
on open these_items tell application "Finder" --Launch X11 and bring to front launch application "X11" --String that will be executed by the do shell script command --First set the display set theCommand to "export DISPLAY=':0.0'; /sw/bin/nedit " --Process each file dropped on the droplet, appending the --POSIX path of the file to the end of "theCommand" set theFiles to these_items as string repeat with i from 1 to the count of these_items set theFile to POSIX path of (item i of these_items as string) set theFiles to these_items as string set theCommand to theCommand & " " & theFile end repeat -- Finish theCommand string -- Pipe output to stdout and stderr so the command -- returns and AppleScript won't wait around for -- stdout and stderr to close set theCommand to theCommand & "> /dev/null 2>&1 &" do shell script theCommand end tell end open |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.07 seconds |
|