G’day folks
Shane Stanley was good enough some very long time ago to supply me with the following code.
However, I was using it in an App that had a ‘NSObject’ as its parent property
I am trying to merger 3 different apps that normally work separately into a single app, where it’s initial parent property is ‘ObjectWithFords’.
Of course it bombs on line
set oneURLString to (current application's NSString's stringWithString:(oneURL)).
I’ve tried the following (because I don’t know what I’m doing), (and a number of other things, I’m desparate!)
set oneURLString to ((my fordEvent())'s NSString's stringWithString:(oneURL)) but it crashes (error message contained ‘unrecognized selector').
try
# tell application "System Events" to display dialog (oneURL) as text —< displays Path
end try
set oneURLString to (fileManager's NSString's stringWithString:(oneURL)) —< errors
Any advice please? Something must replace current application’s.
Regards
Santa
PS, merrging just the first two apps resulted in a 27% increase in speed. Now for the third one.
property parent : class "NSObject"
set oneURLString to (current application's NSString's stringWithString:(oneURL))
property parent : class "ObjectWithFords"
set fileManager to current application's NSFileManager's defaultManager() -- probably redundant at this stage
set posixPath to POSIX path of (my holdingFolder)
set p to 2
set theTempList to my urlsInFolder:(posixPath)
set p to 3
set holdingFolderURL to current application's NSURL's fileURLWithPath:(posixPath)
set p to 3.1
if holdingFolderURL's lastPathComponent() as string = "Links" then
set p to 4
set parentURL to holdingFolderURL's URLByDeletingLastPathComponent()
set t to {}
set p to 5
set tAll to urlsInURL_(parentURL)
set p to 6
repeat with oneURL in tAll
if oneURL's pathExtension() as text = "indd" then
set end of t to oneURL
exit repeat
end if
end repeat
if (count of t) > 0 then set theTempList to {}
end if
on error errmsg number errnum
set theTempList to {}
# set my didItPrint to false
end try
try
set p to 7
set my onlyPrintIndandQuarkflag to false
set p to 8
repeat with oneURL in theTempList -- list of URLs
set p to 9
set oneURLString to (current application's NSString's stringWithString:(oneURL)) — < CRASHES
set p to 9.1
set theExt to oneURLString's pathExtension() as text