• 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: Pathname Weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pathname Weirdness


  • Subject: Re: Pathname Weirdness
  • From: Jonathan Piccolo <email@hidden>
  • Date: Mon, 8 May 2006 12:12:39 -0400

Michelle,

Thank you so much for your quick and helpful response. I no longer have the syntax error, however something seems to be a little off as it doesn't appear to see the existence of the ".aPCheck" file/folder. This is the event log:

tell application "Finder"
path to preferences from user domain
alias "Macintosh HD:Users:jonathan:Library:Preferences:"
exists alias ".aPCheck" of alias "Macintosh HD:Users:jonathan:Library:Preferences:"
false
display dialog "This script was not installed correctly. Please reinstall." buttons {"Quit"} default button 1
{button returned:"Quit"}
"User canceled."


I've narrowed it down to the fact that it's an invisible file since I put a period at the beginning of the filename (dot file) but I need to keep it invisible (for obvious reasons). Is there a trick I can use to have the Finder see the dot file or am I going to have to whip up some fancy shell script to handle the checking?

Thanks again for your help!

Regards,

Jonathan Piccolo
---------------------------------------------------
email@hidden
http://www.callthemacwizard.com


On May 8, 2006, at 10:59 AM, Michelle Steiner wrote:


On May 8, 2006, at 7:38 AM, Jonathan Piccolo wrote:

property antiPiracy : alias ((path to home folder as Unicode text) & "Library:Preferences:")

You can replace that with

path to preferences folder from user domain

if (not (exists folder ".aPCheck" of antiPiracy as string)) then
display dialog "This script was not installed correctly. Please reinstall." buttons {"Quit"} default button 1 error number -128 --Quit was pressed
end if


Upon compilation, I get the following error: Syntax Error: Expected “, ” but found “.

Then it highlights the first quotation mark in ".aPCheck"

You need to put that inside a 'tell application "finder"' block, and you need to remove "as string" from it. You're looking for a folder, not a string.


In addition to why I'm getting this error, I'm confused about how to store these paths so that they are properly passed/parsed, etc and I believe this is the entire problem to begin with.

I'm not sure what you mean.

Also, I'd like to be able to pass on a path as a string to be compared with an actual real path to verify a certain file/folders existence. In the past I would get an error upon compiling that the file/folder in question did not exist (I know!)

If you refer to them with "file" or "folder" it will compile, but if you refer to them with "alias", they won't compile. If you need to refer to them as alias, can get around that limitation by assigning the names to variables. There is no need to convert paths to strings, though.


property antiPiracy : path to preferences folder from user domain
set folderName to ".aPCheck"
tell application "Finder"
if (not (exists alias folderName of antiPiracy)) then
display dialog "This script was not installed correctly. Please reinstall." buttons {"Quit"} default button 1 error number -128 -- Quit was pressed
end if
end tell


-- Michelle

--
"I'll see that when I believe it"
_______________________________________________
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: Pathname Weirdness
      • From: Michelle Steiner <email@hidden>
References: 
 >Pathname Weirdness (From: Jonathan Piccolo <email@hidden>)
 >Re: Pathname Weirdness (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Exchange Calendar Access & Manipulation
  • Next by Date: Re: Pathname Weirdness
  • Previous by thread: Re: Pathname Weirdness
  • Next by thread: Re: Pathname Weirdness
  • Index(es):
    • Date
    • Thread