• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File Path to URL question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Path to URL question...


  • Subject: Re: File Path to URL question...
  • From: Malcolm Fitzgerald <email@hidden>
  • Date: Thu, 8 Feb 2007 14:08:06 +1100


On 08/02/2007, at 12:33 PM, Bryan Walton wrote:

I am very new to AS, but have tried to create a run-only app that would allow a user to select a file or folder in the finder, click the run-only app's icon and have the file/folder's path returned to the clipboard as a clickable URL.  The URL could then be sent to other users on our LAN; allowing them to quickly go-to, or open the file/folder.

Here is the current script:

tell application "Finder"
        set aItem to selection as alias
end tell

tell application "Finder" to set theFileURL to URL of aItem
set the clipboard to theFileURL

How can the selection be anything except the application which you've just clicked?


I think you want a droplet. Get them to drop the files onto the application. The files aren't moved, they stay were they are, the droplet processes them.

try this:
-----------------------------------
on open my_items
	set the clipboard to getURL(my_items)
end open

to getURL(my_items)
	set gURLs to {}
	repeat with i from 1 to length of my_items
		tell application "Finder"
			set end of gURLs to URL of item i of my_items
		end tell
	end repeat
	return getListAsString(gURLs, return)
end getURL

to getListAsString(aList, tid)
	set {oldTID,  text item delimiters} to {text item delimiters, tid}
	set {aString, text item delimiters} to {aList as Unicode text, oldTID}
	return aString
end getListAsString
-----------------------------------

malcolm

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Re: File Path to URL question... (From: Bryan Walton <email@hidden>)

  • Prev by Date: Re: MS Word 2004 basic questions
  • Next by Date: Re: applescript saveas menu action
  • Previous by thread: Re: File Path to URL question...
  • Next by thread: Re: File Path to URL question...
  • Index(es):
    • Date
    • Thread