Here is code i have to write out and read in stored data sources (i found this code here… thanks to whomever posted it.)
It works, however, the place it saves to is: “~/Library/preferences/com.apple.ASApplication.plist”
My application is named DLib4Amazon.app
How do i get this preference to save in it’s own pref file and not that of Applescript Studio. Doesn’t other scripts i write then attempt to write to the same pref file? (also I WOULD MUCH RATHER keep the data inside the package for ease of portability)
Also, one more (possibly) stupid question. I write the applescript app in the AS Studio environment. If i want to move the app to another computer, do i just copy “~/DLib4Amazon/build/Debug/DLib4Amazon” to another location? (or have i simpy set up XCode’s prefs wrong) This is seems counter intuitive to me.
TIA
Jann
on read_prefs()
make new default entry at end of default entries of user defaults with properties {name:"storedAmazonDataSource", contents:{}}
make new default entry at end of default entries of user defaults with properties {name:"storedMailingLogDataSource", contents:{}}
set AmazonDataSource_stored to contents of default entry "storedAmazonDataSource" of user defaults
set MailingLogDataSource_stored to contents of default entry "storedMailingLogDataSource" of user defaults
end read_prefs
on write_prefs()
if AmazonDataSource is not "" then
set contents of default entry "storedAmazonDataSource" of user defaults to (contents of every data cell of every data row of AmazonDataSource)
end if
if MailingLogDataSource is not "" then
set contents of default entry "storedMailingLogDataSource" of user defaults to (contents of every data cell of every data row of MailingLogDataSource)
end if
end write_prefs
The bundle identifier is stored in the application’s Info.plist file as a key called CFBundleIdentifier.
This page of the Xcode manual will show you where you can change that without editing Info.plist directly.
What do you mean by “move the app”? If you want to move the project, copy the entire project folder. If you want to put the built app on another computer–say, for testing–you should run the Release build configuration and copy that app to the other computer instead.
[Edit: Changed “build phase” to “build configuration”.]
Did you click “Build” after changing to “Release”? You will need to build the app after changing the build configuration.
(Apologies, I kept saying “build phase” when I meant “build configuration”. It’s been a long night. I’m editing my posts to reflect the more accurate nomenclature.)
I just had a recent post about this probem while trying to compile my app as Universal Binary.
My Xcode 2.2 did not have the Release build option and probably yours too. Querty Denzel said that Release is the same as Deployment so that’s what I used and it compiled alright as universal binary. So try using Deployment as your “Release” build option.
BTW, Debug is same as Development. I now have Release and Debug created in my Build Config by changing the corresponding names accordingly.
Good luck.
archseed
Model: iBook G3
AppleScript: 1.10.3
Browser: Camino 1.0
Operating System: Mac OS X (10.4)