• 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: Slight deviation, big problem with script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slight deviation, big problem with script


  • Subject: Re: Slight deviation, big problem with script
  • From: Axel Luttgens <email@hidden>
  • Date: Mon, 23 May 2011 23:09:07 +0200

Le 23 mai 2011 à 17:56, Jeffrey Madson a écrit :

> I have attached a script below that works great and has been used
> extensively. Instead of installing the RRDAuto folder into the Utilities
> folder I want to install it into a folder called "Options" at the top level
> of the hard drive now. The "Options folder may or may not already exist when
> this is run.

Hello Jeffrey,

This assumes that you are running the script as a user having the rights needed for creating a folder at the root of the drive, presumably your startup disk. It seems to be the case, since you anyway could create folders in the /Application/Utilities folder. But this raises the question to know whether you really need to create such folders; wouldn't it be sufficient, as Michelle has already suggested, to stay in the user's home directory?


> In the first line I took out the word utilities and put in Options folder
> which creates an error. I also changed the set folderpath to line to: set
> folderpath to (("Options")) as text) & "RRDAuto" but the script never gets
> that far.

Others have already pointed that Standard Additions' command "path to" only knows about some standard, pre-defined locations; such locations are identified thru keywords such as "application support", "documents folder", "utilities folder"... and possibly narrowed with a domain specification.

That said, the Finder itself has some knowledge about some of these locations.


> Any suggestions on how to get this script corrected would be greatly
> appreciated.

Here follows an additional variant:

	tell application "Finder"
		if not (exists folder "Options" of startup disk) ¬
			then make new folder at startup disk with properties {name:"Options"}
		if not (exists folder "RRDAuto" of folder "Options" of startup disk) then
			make new folder at folder "Options" of startup disk with properties {name:"RRDAuto"}
			tell current application to do shell script "/var/scripts/ionicelf -img /var/script/RRDAuto.png /Options/RRDAuto"
		end if
	end tell

I deliberately dropped your Set_Icon handler for various reasons:
- it doesn't bring any generality, since it acts upon fixed items
- taking the "POSIX path" property of a string is an undocumented behavior and relies on many assumptions
- there is no real need to make use of "quoted form", since your shell arguments are well-known constants without any ambiguous characters

HTH,
Axel

 _______________________________________________
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/archives/applescript-users

This email sent to email@hidden

References: 
 >Slight deviation, big problem with script (From: Jeffrey Madson <email@hidden>)

  • Prev by Date: Re: two Filemaker Pro questions
  • Next by Date: Print MS Excel workbook / worksheet to PDF
  • Previous by thread: Re: Slight deviation, big problem with script
  • Next by thread: two Filemaker Pro questions
  • Index(es):
    • Date
    • Thread