Categories
AppleScript Notes FlickrFan

FlickrFan – find the Mac default pictures folder

sys.UnixShellCommand("osascript -e '(path to pictures folder) as string'")

More better (since you get a newline at the end of the above)
string.trimWhiteSpace(sys.unixShellCommand("osascript -e '(path to pictures folder) as string'"))

The list of possible “magic” folders in AppleScript

Get multiple folder paths in one swell foop

osascript -e '{(path to pictures folder) as string, (path to applications folder) as string}'

returns a comma-separated list.

Categories
AppleScript Notes FlickrFan

Applescript – path to

The path to command now has the following new folder constants:

  • applications folder
  • documents folder
  • favorites folder
  • home folder
  • library folder
  • movies folder
  • music folder
  • pictures folder
  • public folder
  • shared documents
  • shared documents folder
  • sites folder
  • utilities folder

From the Applescript folks…

An additional tip about “path to”: you don’t need to wait for us to add an
explicit enumeration, since it can also take any four-character string that’s a
FindFolder selector. Get your hands on a copy of Folders.h (part of the Master
Interfaces) and go nuts.

Look here

/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/CFMCarbon/CarbonCore/Folders.h

Categories
FlickrFan

FlickrFan – Stop Firefox (or Safari) from starting up

When FlickrFan starts it makes sure that your default browser is running.
Determining what your default browser is (on the Mac) isn’t all that easy.

The “open” command knows what it is.

in photoFanThread.script

if system.environment.ismac {
  Â«webbrowser.launchMacBrowser () // [001]
  // [001] use the system utility
  sys.unixShellCommand("open " + homeurl) // [001]
};
photoFanSuite.init ();
system.temp.photoFan.flStarted = true;
// [001] we have already "opened" the URL on a Mac
// [001] don't do it again
if not system.environment.ismac {
  webbrowser.openurl (homeurl)
};
webbrowser.bringtofront ();
photoFanSuite.background.everyHour () //do a scan on startup