• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
current application not work with fordEvent()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

current application not work with fordEvent()


  • Subject: current application not work with fordEvent()
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 22 Jan 2017 12:49:12 +1100

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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: current application not work with fordEvent()
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Looking for advice on 'Mail.app'
  • Next by Date: Re: current application not work with fordEvent()
  • Previous by thread: Looking for advice on 'Mail.app'
  • Next by thread: Re: current application not work with fordEvent()
  • Index(es):
    • Date
    • Thread