• 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
Requesting help, please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Requesting help, please


  • Subject: Requesting help, please
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 24 Jan 2016 14:07:17 +1100

G’day all

Quite some time ago, I believe one of you kind folk wrote the following ObjC code for me, but it’s now failing under Yosemite and El Capitan.

If fails on the line after ‘set p to 2’, and the variable ‘my holdingFolder' resolves to a path ending in a colon.

Would any of you care to fill me in on why it fails, and offer corrections that will work for the whole code, please. I’m at a loss when it comes to ObjC code.

Regards

Santa


on attachmentsPreparationOne()
try
set p to 1
set my ignoreGraphicConverterCount to false
set my printGraphicConverterCount to 0
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
say “Prep 1. p = “&p as text
set theTempList to {}
end try
try
set p to 7
set fileManager to current application's NSFileManager's defaultManager() -- probably redundant at this stage
set my onlyPrintIndandQuarkflag to false
set p to 8
repeat with oneURL in theTempList -- list of URLs
set theExt to oneURL's pathExtension() as text
if theExt = "" then -- no extension
set {theFlag, theValue} to (oneURL's getResourceValue:(reference) forKey:(current application's NSURLLocalizedTypeDescriptionKey) |error|:(missing value)) -- get description
set theValue to theValue as text -- coerce to text
if theValue = "Rich Text Format (RTF)" then
tell fileManager to moveItemAtURL:(oneURL) toURL:(oneURL's URLByAppendingPathExtension:"rtf") |error|:(missing value)
else if theValue = "RTF with attachments (RTFD)" then
tell fileManager to moveItemAtURL:oneURL toURL:(oneURL's URLByAppendingPathExtension:"rtfd") |error|:(missing value)
else if theValue = "Unix Executable File" then
tell fileManager to moveItemAtURL:oneURL toURL:(oneURL's URLByAppendingPathExtension:"eps") |error|:(missing value)
else -- fall back to creator type
set attRecord to (fileManager's attributesOfItemAtPath:(oneURL's |path|()) |error|:(missing value)) as record -- returns a whole lot of stuff
set creatorType to NSFileHFSCreatorCode of attRecord -- returned as an integer; note pipes around path
if creatorType = 1.231963246E+9 then -- InDn as an integer
tell fileManager to moveItemAtURL:(oneURL) toURL:(oneURL's URLByAppendingPathExtension:"indd") |error|:(missing value)
set my onlyPrintIndandQuarkflag to true
else if creatorType = 1.481658931E+9 then -- XPR3 as an integer
tell fileManager to moveItemAtURL:(oneURL) toURL:(oneURL's URLByAppendingPathExtension:"qxp") |error|:(missing value)
set my onlyPrintIndandQuarkflag to true
end if
end if
else -- it has an extension
if theExt is in {"indd", "inx", "qxp", "qxd"} then
set my onlyPrintIndandQuarkflag to true
end if
end if
end repeat
on error errmsg number errnum
if errnum ≠ -1728 and my RunForOz then tell application "System Events" to display dialog "attachmentsPreparationOne error " & errmsg & " number " & errnum giving up after 40
end try
my attachmentsPrintCycleOneInstallFonts() # as alias
end attachmentsPreparationOne

 _______________________________________________
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: Requesting help, please
      • From: Shane Stanley <email@hidden>
  • Next by Date: Re: Requesting help, please
  • Next by thread: Re: Requesting help, please
  • Index(es):
    • Date
    • Thread