how to drag and drop files?

Mac OSX specific forum
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

how to drag and drop files?

Post by jack »

hello,
I would like to be able to drag and drop files that launch the Terminal and then execute the file,
for example here's basically what I am looking for http://hints.macworld.com/article.php?s ... 7142625782
the script worked just perfect at first, but now it does not bring the Terminal to the front.
here's the slightly modified AppleScript from the link above

Code: Select all

set filecount to 0

on open filelist
	repeat with i in filelist
		set filecount to 1
		tell application "Terminal"
			set filename to do shell script ¬
				"perl -e \"print quotemeta ('" & POSIX path of i & "');\""
			do script "a68g " & filename & "; exit"
		end tell
	end repeat
end open
where a68g is the algol68 interpreter.

anyone knows why terminal is not brought to the front?
also for whatever reason that script now launches two terminal sessions whereas before it did not, I am stumped.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: how to drag and drop files?

Post by Danilo »

jack wrote:anyone knows why terminal is not brought to the front?
Try 'activate' within your tell-block

Code: Select all

      tell application "Terminal"
         activate
      end tell
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: how to drag and drop files?

Post by jack »

thanks Danilo, that brings the terminal to the front but I still get two sessions but it's no big deal.
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: how to drag and drop files?

Post by jack »

solved, adding in front window to the do script fixed the two session problem.

Code: Select all

set filecount to 0

on open filelist
	repeat with i in filelist
		set filecount to 1
		tell application "Terminal"
			activate
			set filename to do shell script ¬
				"perl -e \"print quotemeta ('" & POSIX path of i & "');\""
			do script "a68g " & filename & "; exit" in front window
		end tell
	end repeat
end open
Post Reply