• 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
Re: Mavericks AppleScript Editor formatting problems redux
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mavericks AppleScript Editor formatting problems redux


  • Subject: Re: Mavericks AppleScript Editor formatting problems redux
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 11 Nov 2013 14:15:04 +1100

On 11 Nov 2013, at 1:02 PM, email@hidden wrote:

The only script editors I am using are Xcode and the AppleScript Editor - you got me thinking about what else could be using the formatting though, and remembered that I do have a QuickLook plugin for showing scripts. It would also be using the preferences (or calling something else that does)

It could be the cause, but it shouldn't have to touch the preferences just to turn a compiled script into syntax-styled text. For example, put this in an ASObjC script library:

use framework "Foundation"
on readFile:thePath
set anNSURL to current application's NSURL's fileURLWithPath:thePath
set theScript to current application's NSAppleScript's alloc()'s initWithContentsOfURL:anNSURL |error|:(missing value)
set theSource to theScript's richTextSource()
set pb to current application's NSPasteboard's generalPasteboard()
pb's clearContents()
pb's writeObjects:{theSource}
end readFile:

When you run it, it will put the styled contents of the script at thePath on your clipboard -- no need to go near the settings.

I don’t think that Xcode is necessarily doing anything with the formatting preferences since it doesn’t use them, but something is getting confused when using it with the AppleScript Editor - I’ve never had a problem just using the AppleScript Editor by itself.

You could always try another editor for a few days, and see if it still happens. But if it's something else, which I suspect, it won't prove a lot.

I’m not manipulating the preferences file while the applications are running, but before Mavericks, just quitting the applications and restoring the file was enough.  Now when it gets lost, it takes a restart to clean things up or to get it to read the file again (or at least pay attention to it). 

AppleScript Editor doesn't read (or write) the file. And I doubt it even uses defaults. There are special APIs for the syntax styles (ASCopySourceAttributes() and ASSetSourceAttributes()), which tell an AppleScript instance to fetch or modify them, presumably using the defaults mechanism, which in turn writes the file when it feels like it (not often in Mavericks). My guess would be that corruption occurs when an attempt is made to make access them on separate instances at the same time. But that brings us back to the question of what is doing it, and I don't think Xcode is involved directly (but I suppose it could be be triggering a QuickLook plug-in).

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Mavericks AppleScript Editor formatting problems redux
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Mavericks AppleScript Editor formatting problems redux (From: email@hidden)

  • Prev by Date: Re: Mavericks AppleScript Editor formatting problems redux
  • Next by Date: Re: Mavericks AppleScript Editor formatting problems redux
  • Previous by thread: Re: Mavericks AppleScript Editor formatting problems redux
  • Next by thread: Re: Mavericks AppleScript Editor formatting problems redux
  • Index(es):
    • Date
    • Thread