The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   OmniFocus bought thru AppStore: Cache-querying scripts fail (http://forums.omnigroup.com/showthread.php?t=21458)

RobTrew 2011-06-25 01:11 AM

OmniFocus bought thru AppStore: Cache-querying scripts fail
 
Various scripts on this board query the cache, and typically start with a property like:

[CODE]property pstrDBPath : "~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2"[/CODE]

AppStore-purchased copies of OmniFocus can not run these scripts without modification.

A possible modification might be something like the following (though this is not bullet-proof):

[CODE]set pstrDBPath to GetCachePath()

on GetCachePath()
set strDefaultFolder to "~/Library/Caches/com.omnigroup.OmniFocus"
set strAppStoreFolder to "~/Library/Caches/com.omnigroup.OmniFocus.MacAppStore"
set strDBName to "OmniFocusDatabase2"

set strCacheFolder to strDefaultFolder
if (do shell script ("test -d " & strCacheFolder & "; echo $?")) ≠ "0" then
set strCacheFolder to strAppStoreFolder
if (do shell script ("test -d " & strCacheFolder & "; echo $?")) ≠ "0" then return ""
end if

return strCacheFolder & "/" & strDBName
end GetCachePath[/CODE]

[COLOR="White"]--[/COLOR]

RobTrew 2011-06-29 03:38 PM

Or, I suppose, you could try using "System Events" to read the [I]Bundle identifier[/I] key in the [I]info.plist[/I] file inside the OmniFocus.app package.

(Looking first in [I]/Applications/OmniFocus.app[/I] and then perhaps falling back to [I]~/Applications/OmniFocus.app[/I] if it wasn't found ...)

(But this kind of thing is, of course, hard to test because it is in the nature of the bifurcated bundle identifier problem that any given user only has one version installed, and can't test code for the other ... )

(I have asked the Ninjas whether there is a better solution to automatically detecting whether a user's data is in a com.omnigroup.OmniFocus cache or a com.omnigroup.OmniFocus.MacAppStore cache ...)

UPDATE see [URL="http://forums.omnigroup.com/showthread.php?t=21496"]FAQ[/URL]

[COLOR="White"]--[/COLOR]


All times are GMT -8. The time now is 01:42 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.