• 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: Compare two AppleScripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compare two AppleScripts


  • Subject: Re: Compare two AppleScripts
  • From: Jim Underwood <email@hidden>
  • Date: Fri, 27 Apr 2018 23:10:35 +0000
  • Thread-topic: Compare two AppleScripts

Gil,

Forget TextWrangler -- upgrade to BBEdit.

Here's a core script  to get you started:

________________________________

use AppleScript version "2.5" -- El Capitan (10.11) or later

use framework "Foundation"

use framework "AppKit"

use framework "OSAKit"


use scripting additions


## Based on scripts by @ShaneStanley and @ccstone


set scriptPath to POSIX path of ((choose file) as text)

set scriptStr to my extractScriptSource(scriptPath)


tell application "BBEdit"

  activate

  set newDoc to make new text document with properties {text:scriptStr}

end tell


on extractScriptSource(pScriptPath)

  set aURL to current application's |NSURL|'s fileURLWithPath:pScriptPath

  set theScript to current application's OSAScript's alloc()'s
initWithContentsOfURL:aURL |error|:(missing value)

  return theScript's source() as text

end extractScriptSource

________________________________


Best Regards,

Jim Underwood
aka JMichaelTX


From: AppleScript-Users
<applescript-users-bounces+jmichael=email@hidden<mailto:applescript-users-bounces+jmichael=email@hidden>>
 on behalf of Gil Dawson <email@hidden<mailto:email@hidden>>
Date: Friday, April 27, 2018 at 5:09 PM
To: "ASUL (AppleScript)"
<email@hidden<mailto:email@hidden>>
Subject: Compare two AppleScripts

Has anyone worked out (or even on) a script to compare the source text for two
AppleScripts?

I'm thinking of using TextWrangler's "Compare Two Front Windows" to see the
differences.  I do this manually by copying the text from two Script Editor
windows and pasting them into two TextWrangler windows.  I'd like a script,
though.

Before I start, however, I thought I'd ask whether this has already been done.

--Gil
 _______________________________________________
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

References: 
 >Compare two AppleScripts (From: Gil Dawson <email@hidden>)

  • Prev by Date: Re: Compare two AppleScripts
  • Next by Date: Re: Compare two AppleScripts
  • Previous by thread: Re: Compare two AppleScripts
  • Next by thread: Re: Compare two AppleScripts
  • Index(es):
    • Date
    • Thread