• 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: Could someone try the following script run as an app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Could someone try the following script run as an app


  • Subject: Re: Could someone try the following script run as an app
  • From: Christopher Stone <email@hidden>
  • Date: Tue, 08 Dec 2015 11:20:33 -0600

On Dec 07, 2015, at 10:58, Deivy Petrescu <email@hidden> wrote:
on run
   open selection
end run

on open selection
   set l to selection -- files selected
   display dialog (count of l)
end open
______________________________________________________________________

Hey Deivy,

I'm wondering why you're using the reserved word selection as the open handler parameter.  Perhaps that's NOT a reserved word on a French system?

If I change it thus:

on open theItems
  set l to theItems
  display dialog (count of l)
end open

I get normal responses.

The quarantine bit bug still bites.

I just noticed when dragging 6 aliases onto the applet that I got 2 dialogs.

A 1 count.
And a 5 count.

Huh?  To my huge surprise the target of one of these aliases from my desktop (a BBEdit text file) has its quarantine bit set on...

Run from BBEdit (or TextWrangler):

* Command-Drag files in to the front document to get a path list.  Takes full-paths or tilde-paths.

#! /usr/bin/env bash

read -r -d '' fileList <<'EOF'
~/Documents/Action_List.txt
~/Documents/Note_Files/Desktop Notes.rtf
~/Documents/Paranormal Research/Meta-Research.txt
~/Documents/BBEdit Miscellaneous/TEST.worksheet
~/Documents/Dev/Perl/Desktop_Items/Perl_Dump.txt
~/Documents/Note_Files/Kinesiology.rtf
EOF

fileList=$(sed -E 's|^~|'"$HOME"'|' <<< "$fileList");

while read -r lineVar; do
xattr -lv "$lineVar" | sed -En '/quarantine/p'
done <<< "$fileList"


The problem file was this one:

~/Documents/Dev/Perl/Desktop_Items/Perl_Dump.txt

Velly strange indeed, since I created that myself years ago.

Here's an AppleScript to report on the selected items in the Finder.

-------------------------------------------------------------------------------------------
# X-Attributes for Selected Files in the Finder.
# Prioritizes Quanantine Attribute.
-------------------------------------------------------------------------------------------
set xattrReportText to ""

tell application "Finder"
  set finderSelectionList to selection as alias list
  if length of finderSelectionList = 0 then error "No files were selected in the Finder!"

  repeat with i in finderSelectionList
    set theFile to contents of i
    if theFile's kind = "Alias" then
      set theFile to original item of theFile as alias
    end if
    set xattrReportText to xattrReportText & (do shell script "xattr -lv " & quoted form of (POSIX path of theFile) without altering line endings)
  end repeat

end tell

if xattrReportText contains "quarantine" then
  set quarantinedFileList to "Qarantined Files Found:" & ¬
    linefeed & ¬
    linefeed & ¬
    (do shell script "sed -En '/quarantine/p' <<< " & quoted form of xattrReportText)

  

  set xattrReportText to quarantinedFileList & ¬
    linefeed & ¬
    linefeed & ¬
    "-------------------------------------------------------------------------------------------" & ¬
    linefeed & ¬
    linefeed & ¬
    xattrReportText
end if

do shell script "open -f <<< " & quoted form of xattrReportText

-------------------------------------------------------------------------------------------

Oh, I did get some quite unexpected behavior.

I put my test applet in my ~/Downloads/ folder, because I have 1 keystroke access to it.

~/Downloads/test-draganddrop.app

Strangely the Finder would NOT consistently let me drag & drop files TO the applet.

When this happened it seemed like the applet was dead, but then I noticed the Downloads window itself was not accepting the dragged items.

The common factor was drag & drop to the applet once – the window becomes "broken" and won't accept the very same files.

I put the applet in my Dock, and that worked around the problem.

I later restarted the Finder, and the problem seems to have gone away (for now).

This is all on El Capitan 10.11.1.

<shrug>

--
Best Regards,
Chris

 _______________________________________________
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: Could someone try the following script run as an app
      • From: Yvan KOENIG <email@hidden>
References: 
 >Could someone try the following script run as an app (From: Deivy Petrescu <email@hidden>)

  • Prev by Date: RE: I really need some help
  • Next by Date: Re: Could someone try the following script run as an app
  • Previous by thread: Re: Could someone try the following script run as an app
  • Next by thread: Re: Could someone try the following script run as an app
  • Index(es):
    • Date
    • Thread