• 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: Re: Converting 'file:/' URL to MacOS path name...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Converting 'file:/' URL to MacOS path name...


  • Subject: Re: Re: Converting 'file:/' URL to MacOS path name...
  • From: <email@hidden>
  • Date: Mon, 28 Feb 2005 17:31:43 -0500

The hint may have been moved or the site may be down.  At any rate, here is
the script.  When the site is back up.  Search under exchange and file to get
more instructions.  The subject of the hint is "An AppleScript to help open
Exchange-style links"

Let me know if you have any questions.

--here is the script: beginning script

global theName, mynull
set error_num to -128
set bkslsh to "\\"
set mynull to " "
set myvol to "open /Volumes"
set y to 0
set k to 0
set L to {}
tell application "Microsoft Entourage"
	activate
	tell application "System Events"
		key down command
		delay 1
		keystroke "c"
		delay 1
		key up command
	end tell
end tell
set x to the clipboard
set text item delimiters to bkslsh
set howmany to (count text items of x)
-- set mypath to text item of x

if howmany is less than 3 or (howmany - 3) is equal to 0 then
	my myerror(error_num)
end if

try
	repeat howmany times
		set k to k + 1
		set myitem to text item k of x
		if myitem is equal to "documents" then
			set myitem to "Documents"
		end if
		set end of L to myitem
	end repeat
end try
try
	repeat (howmany - 3) times
		set y to y + 1
		if text item (y + 3) of L contains mynull then
			set passthebuck to text item (y + 3) of L
			my myspace(passthebuck)
			set myvol to myvol & "/" & theName
		else
			set myvol to myvol & "/" & text item (y + 3) of L
		end if
	end repeat
	do shell script myvol
on error number error_number
	my myerror(error_num)
	(* if error_number is -128 then error number -128
	display dialog ¬
		"you are not able to open the exchange server link for one or more
of the following reasons:" & return & return ¬
		& "you may not be connected to the network" & return & return ¬
		& " or the network may be down" & return & return & ¬
		"or the file location may have moved or doesn't exist" & return &
return ¬
		& "or you may not have properly selected the exchange server link"
& return & return ¬
		& "PLEASE CHECK THESE REASONS AND TRY AGAIN" *)
end try

on myspace(thebuck)
	set z to 0
	set text item delimiters to mynull
	set thismany to (count text items of thebuck)
	set breakumup to text items of thebuck
	set theName to text item (z + 1) of thebuck
	repeat with abreak in breakumup
		set z to z + 1
		if z is less than or equal to (thismany - 1) then
			set theName to theName & "\\ " & text item (z + 1) of thebuck
		end if
	end repeat
	return theName
end myspace

on myerror(error_number)
	if error_number is -128 then
		set thingsgonewrong to "you are not able to open the exchange
server link for one or more of the following reasons:" & return & return ¬
			& "you may not be connected to the network" & return &
return ¬
			& " or the network may be down" & return & return & ¬
			"or the file location may have moved or doesn't exist" & return
& return ¬
			& "or you may not have properly selected the exchange server
link" & return & return ¬
			& "PLEASE CHECK THESE REASONS AND TRY AGAIN"
		display dialog thingsgonewrong buttons {"Cancel"}
	end if
end myerror


--end of script




>
> From: David Crowe <email@hidden>
> Date: 2005/02/28 Mon AM 11:00:00 EST
> To: <email@hidden>
> Subject: Re: Converting 'file:/' URL to MacOS path name...
>
> Ron;
>
> Thanks, but I didn't see the script there.
>
> - David
>
>
> >I just recently wrote a script that will allow you to do this.  Please read my
> >hint at
> >
> >http://www.macosxhints.com/article.php?
story=20050223235851157#comments
> >
> >to get an idea on how to do this.  Some simple changes in my script
should
> >be able to serve your needs.  Several people have tried this already and it
> >works for them.
> >
> >Let me know if you need any further help on this.
> >
> >thx
> >RLC
> >
> >>
> >>  From: David Crowe <email@hidden>
> >>  Date: 2005/02/26 Sat PM 04:24:13 EST
> >>  To: email@hidden
> >>  Subject: Converting 'file:/' URL to MacOS path name...
> >>
> >>  Given a URL-like file specification like:
> >>
> >>  file:/Tinantia/Users/dad/Documents/Green/AIDS/AIDS-Databases/
AIDS
> >>  References.fp7
> >>
> >>
> >>  is there a simple way to convert this into the corresponding MacOS
> >filename?
> >>
> >>  I know that I can trim the "file:/" and convert "/" into ":", but
> >>  there may be special characters to deal with as well (such as   for
> >>  blank).
> >>
> >>  I've tried "POSIX path" followed by this name in quotes, but it
> >>  doesn't do the trick. I've tried "path of URL" followed by the quoted
> >>  string, and that just gives a different error.
> >>
> >>
> >>  - David Crowe
> >>   _______________________________________________
> >>  Do not post admin requests to the list. They will be ignored.
> >>  Applescript-users mailing list      (email@hidden)
> >>  Help/Unsubscribe/Update your Subscription:
> >email@hidden
> >>
> >>  This email sent to email@hidden
> >>
>
>
>
> From: David Crowe <email@hidden>
> Date: 2005/02/28 Mon AM 11:00:00 EST
> To: <email@hidden>
> Subject: Re: Converting 'file:/' URL to MacOS path name...
>
> Ron;
>
> Thanks, but I didn't see the script there.
>
> - David
>
>
> >I just recently wrote a script that will allow you to do this.  Please read my
> >hint at
> >
> >http://www.macosxhints.com/article.php?
story=20050223235851157#comments
> >
> >to get an idea on how to do this.  Some simple changes in my script
should
> >be able to serve your needs.  Several people have tried this already and it
> >works for them.
> >
> >Let me know if you need any further help on this.
> >
> >thx
> >RLC
> >
> >>
> >>  From: David Crowe <email@hidden>
> >>  Date: 2005/02/26 Sat PM 04:24:13 EST
> >>  To: email@hidden
> >>  Subject: Converting 'file:/' URL to MacOS path name...
> >>
> >>  Given a URL-like file specification like:
> >>
> >>  file:/Tinantia/Users/dad/Documents/Green/AIDS/AIDS-Databases/
AIDS
> >>  References.fp7
> >>
> >>
> >>  is there a simple way to convert this into the corresponding MacOS
> >filename?
> >>
> >>  I know that I can trim the "file:/" and convert "/" into ":", but
> >>  there may be special characters to deal with as well (such as   for
> >>  blank).
> >>
> >>  I've tried "POSIX path" followed by this name in quotes, but it
> >>  doesn't do the trick. I've tried "path of URL" followed by the quoted
> >>  string, and that just gives a different error.
> >>
> >>
> >>  - David Crowe
> >>   _______________________________________________
> >>  Do not post admin requests to the list. They will be ignored.
> >>  Applescript-users mailing list      (email@hidden)
> >>  Help/Unsubscribe/Update your Subscription:
> >email@hidden
> >>
> >>  This email sent to email@hidden
> >>
>
>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Re: Converting 'file:/' URL to MacOS path name...
      • From: David Crowe <email@hidden>
  • Prev by Date: Re: Called script won't store property
  • Next by Date: Re: *Very* strange script / global variable behavior
  • Previous by thread: Re: Converting 'file:/' URL to MacOS path name...
  • Next by thread: Re: Re: Converting 'file:/' URL to MacOS path name...
  • Index(es):
    • Date
    • Thread