NSMutableDictionary in SC4.8 from AppleScript

SuperCard 4.5 & 4.6 projects (.zip archives only please).

NSMutableDictionary in SC4.8 from AppleScript

Postby sctell » Thu Oct 20, 2016 7:37 am

As my previous post regarding NSMutableArray here is the NSMutableDictionary Test Project.

It has the following functions:

createDictionary(tPath)
setObjectForKey(tPath, tObject, tKey)
objectForKey(tPath, tKey)
descriptionWithLocale(tPath)
allKeys(tPath)
allValues(tPath)

Please share any additions you make to the project.

Thanks


NSMutableDictionary.zip
(203.46 KiB) Downloaded 51 times



Terry
Last edited by sctell on Fri Oct 21, 2016 10:32 am, edited 1 time in total.
sctell
 
Posts: 1129
Joined: Sun Jul 06, 2008 10:41 am

Re: NSMutableDictionary in SC4.8 from AppleScript

Postby codegreen » Fri Oct 21, 2016 6:03 am

Hi Terry,

Nice work!

One minor issue though: the samples don't work unless your user name happens to be Terry... :oops:

Perhaps you could tweak them to use something like:

Code: Select all
  put hfsToPosix(posixToHFS("~/Desktop/testDict")) into tPath

or maybe:

Code: Select all
  put hfsToPosix(projpath(this proj) & "testDict") into tPath

Otherwise very cool! 8-)

-Mark
codegreen
 
Posts: 1529
Joined: Mon Jul 14, 2008 11:03 pm

Re: NSMutableDictionary in SC4.8 from AppleScript

Postby sctell » Fri Oct 21, 2016 10:33 am

Modified to

put hfsToPosix(posixToHFS("~/Desktop/testDict")) into tPath


All the best

Terry
sctell
 
Posts: 1129
Joined: Sun Jul 06, 2008 10:41 am

Re: NSMutableDictionary in SC4.8 from AppleScript

Postby sandrobilbeisi » Fri Dec 15, 2017 5:37 am

this one always gives me this error :

1
Error 88 occured in the keyssortedbyvalueusingselector(/Users/utente/Desktop/testDict, compare:) call: Expected ")" but found something else.
sandrobilbeisi
 
Posts: 35
Joined: Mon Dec 04, 2017 1:11 am

Re: NSMutableDictionary in SC4.8 from AppleScript

Postby sctell » Fri Dec 15, 2017 6:39 am

sandrobilbeisi wrote:this one always gives me this error :

1
Error 88 occured in the keyssortedbyvalueusingselector(/Users/utente/Desktop/testDict, compare:) call: Expected ")" but found something else.


No problems here:

SC4.8 b30
MacOS 10.12.6
iMac


All the best

Terry
sctell
 
Posts: 1129
Joined: Sun Jul 06, 2008 10:41 am

Re: NSMutableDictionary in SC4.8 from AppleScript

Postby sctell » Fri Dec 15, 2017 6:41 am

sctell wrote:No problems here:


Here is the test dict:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Apples</key>
<integer>10</integer>
<key>Bananas</key>
<integer>100</integer>
<key>Oranges</key>
<integer>50</integer>
<key>Pears</key>
<integer>10</integer>
</dict>
</plist>
sctell
 
Posts: 1129
Joined: Sun Jul 06, 2008 10:41 am

Re: NSMutableDictionary in SC4.8 from AppleScript

Postby sandrobilbeisi » Fri Dec 15, 2017 7:59 am

Error = 88
dsCDEFNotFound = 88, /*could not load CDEF*/

SC4.8 b30
Mac OS 10.10.5
sandrobilbeisi
 
Posts: 35
Joined: Mon Dec 04, 2017 1:11 am


Return to Sample & Demo Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron