NSMutableArray in SC4.8 from AppleScript

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

NSMutableArray in SC4.8 from AppleScript

Postby sctell » Thu Oct 20, 2016 6:20 am

Further to messing about with NSMutableDictionary here is a starter script and Test Project for calling NSArray and NSMutableArray from within SC.

It currently has the following methods/functions:

createArray(tPath)
addObject(tPath, tObject)
insertObjectAtIndex(tPath, tObject, tIndex)
replaceObjectAtIndex(tPath, tObject, tIndex)
removeObject(tPath, tObject)
removeAllObjects(tPath)
removeObjectAtIndex(tPath, tObject, tIndex)
objectCount(tPath)
objectAtIndex(tPath, tIndex)

Please add any other functions you like but please post here for the use of others.

If you need any help please ask and I will do my best.

All the best

Terry


NSMutableArray.zip
(203.49 KiB) Downloaded 62 times
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: NSMutableArray in SC4.8 from AppleScript

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

Modified to:

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


All the best

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

Re: NSMutableArray in SC4.8 from AppleScript

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

I always get this error:

Error -1708 occured in the createarray(/Users/utente/Desktop/testDict) call: (null)
Error 88 occured in the objectcount(/Users/utente/Desktop/testDict) call: Expected ")" but found something else.
1
sandrobilbeisi
 
Posts: 34
Joined: Mon Dec 04, 2017 1:11 am

Re: NSMutableArray in SC4.8 from AppleScript

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

sandrobilbeisi wrote:I always get this error:

Error -1708 occured in the createarray(/Users/utente/Desktop/testDict) call: (null)
Error 88 occured in the objectcount(/Users/utente/Desktop/testDict) call: Expected ")" but found something else.
1



No problems here:

SC4.8 b30
MacOS 10.12.6
iMac


All the best

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

Re: NSMutableArray in SC4.8 from AppleScript

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

Error - 1708
errAEEventNotHandled = -1708, /* the AppleEvent was not handled by any handler */

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

SC4.8 b30
Mac OS 10.10.5
sandrobilbeisi
 
Posts: 34
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