Rick, thanks, but I got ChatGPT to create the script for me. Here it is 
<https://www.dropbox.com/scl/fi/cfenigb8wag4dbdagw05e/Find-Diffs-Snippets.applescript?rlkey=8zl667qgakqo28r242ubkqmp1&st=hcji876i&dl=0>.
 
It requests the two snippets and transfers them to docs on desktop 
(and  opens desktop folder so you can delete them), then opens Find 
Differences with the snippets properly selected (stealing from JJ's work!).

It runs well but requires BBEdit's Command Line Tools and some permissions 
tweaks:

To run the streamlined BBEdit script without issues, here is a 
comprehensive list of any necessary system resets, preferences, and 
settings adjustments:
------------------------------
*1. Install BBEdit Command-Line Tools*
   
   - *Required*: The script uses the bbdiff command from BBEdit's 
   command-line tools.
   - *How to Install*:
      - Open BBEdit.
      - Go to *BBEdit > Install Command Line Tools* in the menu bar.
   - Verify installation by running this in Terminal:
   bash
   Copy code
   which bbdiff
   It should return a path like /usr/local/bin/bbdiff.

------------------------------
*2. Grant Automation Permissions*
   
   - *Why*: macOS requires explicit approval for apps to send Apple Events 
   to each other.
   - *How*:
      - Go to *System Settings > Privacy & Security > Automation*.
      - Ensure *BBEdit* is listed and allowed to interact with the 
      following:
         - *Script Editor* (or the tool used to run the script, e.g., 
         Terminal).
      - If not listed, manually add these tools to *Full Disk Access* (next 
   step).

------------------------------
*3. Grant Full Disk Access (If Needed)*
   
   - *Why*: macOS may block file writes or other operations without 
   explicit approval.
   - *How*:
      - Go to *System Settings > Privacy & Security > Full Disk Access*.
      - Add:
         - *BBEdit*
         - *Script Editor* (or the tool running the script, e.g., Terminal).
      - Enable the toggles.
   
------------------------------
*4. Optional: Reset Automation Permissions*
   
   - *When to Reset*:
      - If BBEdit or related tools are behaving unpredictably.
   - *How to Reset*:
      - Open Terminal and run:
      bash
      Copy code
      tccutil reset AppleEvents
      - This clears all AppleEvents permissions. You'll need to re-grant 
      permissions to BBEdit and other tools (steps 2 and 3).
   
------------------------------
*5. Avoid Common File Path Issues*
   
   - *Why*: /tmp paths sometimes cause issues on macOS.
   - *Resolution*: The script uses /private/tmp to ensure compatibility 
   with macOS's internal handling of temporary paths.

------------------------------
Final Checklist for Smooth Use
   
   1. *Install BBEdit's Command Line Tools*.
   2. *Grant Automation Permissions for BBEdit and Script Editor*.
   3. *Add Full Disk Access Permissions for BBEdit and Script Editor*.
   4. *Optional*: Run tccutil reset AppleEvents if automation permissions 
   seem broken.


On Sunday, December 8, 2024 at 1:35:53 AM UTC Rick Gordon wrote:

> This page may offer some helpful clues downward from #30:
>
> https://unix.stackexchange.com/questions/582796/using-the-diff-command-to-compare-two-strings
>
> Rick Gordon
> ------------------------------
> From: Jim Leff <[email protected]> 
> To: BBEdit Talk <[email protected]> 
> Date: Sat, Dec 7, 2024 3:26:05PM -0700 
> Subject: "Find Difference" on Fragmentary Text 
>
> Thanks. The scripts seem to require the text to already be distributed to 
> two different docs, so I'm not sure how much time it would save. The doc 
> creation is the tedious part.  
>
> I suppose I'm envisioning a process more like this: invite user to paste 
> text A into a field, then paste text B into another field. Save each 
> snippet to a new doc on desktop, and open Find Diffs pop-up with both docs 
> chosen. I suppose I could delete them afterwards manually, that's not the 
> bottleneck.
>
> Is that realistic do you think?
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"[email protected]" rather than posting here. Follow @bbedit on Mastodon: 
<https://mastodon.social/@bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/bbedit/7b4d307d-f78c-40fe-a6ae-ab2b1fc19934n%40googlegroups.com.

Reply via email to