How can I stop the lack of "QXPScriptingAdditions.osax" interfering?

I recently began scripting again, and have a simple bit of Applescript as part of a macro process. The code, which takes a person’s name and flips it so that the name is surname, first name, is:

set the clipboard to word 2 of (the clipboard as text) & ", " & word 1 of (the clipboard as text)

However, when it’s executed, I receive this error:

I’ve gone looking for QXPScriptingAdditions.osax, but it’s not in /Library/ScriptingAdditons. In fact, that folder is empty.

I’m now lost: AppleScript obviously thinks it’s there, and can’t use it, so it throws an error and doesn’t accomplish the work. I’ve now encountered the same error in some other script lines. But I can’t manually locate it anywhere on my Mac. Any suggestions for stopping this from happening??

Are you sure you checked in the right Library folder – /Library and not ~/Library?

I have removed the standard additions for machines newer than Lion and got rid of the messages. The message is clear, it’s in the Library folder of the root folder of your disk. There is one possibility when you say it’s empty and that’s if the Finder won’t show it. To be sure if the folder is completely empty use this deprecated command in AppleScript:

list folder "/Library/ScriptingAdditions"

Thanks for your help, DJ and Stanley.

You’re right; I had missed the lack of subtle (to me) tilde at the front of the path and had been looking in the wrong place. I am truly rusty after these years of not using Applescript like I used to do. I found the osax file and have removed it, and all is well now.

I did have to smile, though, when I tried out your listing command first… and it threw the error!

Now I’ll head back to my drawing board where I have the usual Applescript issue: It doing exactly what I tell it to do, instead of what I want it to do!

Hey There,

This is a bit after-the-fact, but let’s post some troubleshooting methods for posterity.

Generally if you’ll copy a posix path directly from an error report and use the open command in the Terminal with the -R switch (reveal) you’ll find a file immediately.

open -R /Library/ScriptingAdditions/QXPScriptingAdditions.osax

QUOTE the path if it has any spaces in it.

open -R "/Applications/Test Folder/My Test File.txt"

Creating a report of installed OSAXen complete with HFS paths is easy enough:

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/06/29 09:45
# dMod: 2015/06/29 10:27
# Appl: Finder & TextEdit
# Task: Create Report of installed Scripting Additions on Desktop & Open Report in TextEdit
# Tags: @Applescript, @Script, @Finder, @Report, @Installed, @Scripting_Additions, @OSAX
-------------------------------------------------------------------------------------------
set scriptingAdditionsList to {}
set scriptingAdditionsFolders to {path to scripting additions folder from user domain, path to scripting additions folder from local domain, path to scripting additions folder from system domain}
set reportFilePath to POSIX path of ((path to desktop as text) & "Installed Scripting Additions " & (do shell script "date '+%Y.%m.%d · %H.%M.%S'") & ".txt")
set AppleScript's text item delimiters to linefeed
tell application "Finder"
    repeat with i in scriptingAdditionsFolders
        set scriptingAdditionsList to scriptingAdditionsList & (items of i as alias list)
    end repeat
end tell
set shCMD to "
reportFilePath='" & reportFilePath & "';
printf " & quoted form of (scriptingAdditionsList as text) & " > \"$reportFilePath\";
open -e \"$reportFilePath\";
"
do shell script shCMD
-------------------------------------------------------------------------------------------

A report with posix paths may be produced with a fairly basic one-liner in the Terminal:

find  ~/Library/ScriptingAdditions /Library/ScriptingAdditions /System/Library/ScriptingAdditions -maxdepth 1 -name "*.*" \! \( -name ".DS_Store" \) | open -f

If I was at a complete loss at where to search I might run something like this from the Terminal:

First try using Spotlight (fast):

mdfind 'kMDItemFSName == "QXPScriptingAdditions.osax"c'

Second try using find and starting the search at the root of the drive (pretty slow):

sudo find / -name "QXPScriptingAdditions.osax"

Note that sudo will require you to enter your Admin password.

Fortunately I don’t have to resort to the fairly slow search from the Terminal, because I have a couple of good search utilities that can find as root ” Find Any File and File Buddy.

Find Any File is cheap at $6.00 U.S.

No Mac User should be entirely dependent upon Spotlight for finding files on their system. Spotlight is totally dependent upon the hard drive having been indexed, and such systems are not always reliable. And for that matter Spotlight by default does NOT find files in the System area.

File Buddy is the 700lb Gorilla of Mac file-search utilities and has many other functions, and v10.0.2 works fine on Mavericks (I can’t yet say about Yosemite, but I’ll be surprised if it doesn’t).


You can use Spotlight in the Finder for this kind of task if you know how to search for system files, but Apple makes you jump through a couple of hoops to make that option available.

It is necessary to select ‘Other’ in the search attribute pop-up menu, find ‘System Files’, and check the check-box before the ‘System Files’ criteria will be available in the Spotlight user-interface.

You can get a little more creative by using a raw-query, but like the ‘System files’ attribute you have to enable ‘Raw query’ to make it available in the Spotlight user-interface.

kMDItemFSName == "*.osax"c

  • means any character zero or more.
    c means case-insensitive.

The upshot is that it’s not so very difficult to find files on your system. You just need a little knowhow.

Hello Chris

While running the system (10.10.3) in french I tried to use Raw Query (Requête brute in french).

It returned only the osax which was available on the desktop.
To get the complete list I had to complete with the query allowing to search for “System Files”.

Yvan KOENIG (VALLAURIS, France) lundi 29 juin 2015 19:04:03

Thanks Yvan,

It turns out that if you turn ON system-files and then delete it the search window will still find them.

Grrr…

I’ll edit my post to reflect this shortly.

Thanks

Save dialogs default with the late destination folder used. For years I wonder why the search tool doesn’t default with the late settings used.

Here, I use this script when I need to search a file :

--[SCRIPT]
on run
	my Germaine()
end run

on Germaine()
	set isElCapitan to (system attribute "sys2") = 11
	tell application id "com.apple.finder"
		activate
		set SystemFiles_loc to localized string "RV_SYSTEM_FILES_SLICE_NAME"
		-- log result -->"Fichiers système"
		set Searching_loc to localized string "SB37"
		-- log result --> "Recherche dans ^0."
		if isElCapitan then
			set path2Finder to path to application id "com.apple.finder" as text
			set name_loc to localized string "108.title" from table "ArrangeByMenu" in bundle (path2Finder & "Contents:Resources:") as «class furl»
			-- log result --> "Nom"
			set Search_loc to text 1 thru -2 of (localized string "N82")
			-- log result --> "Rechercher"
		else
			set name_loc to localized string "IN_S21"
			log result --> "Nom"
			set Search_loc to localized string "FF34" #  required for Yosemite developper preview
			log result --> "Rechercher"
		end if
	end tell
	
	if Searching_loc contains "^0." then # ca, cs, da, el, English, fi, French, hr, Italian, no, pl, pt, pt_PT, ro, ru, sk, Spanish, sv, th, ukl
		set Searching_loc to my supprime(Searching_loc, "^0.")
	else if Searching_loc contains "'^0'." then # Dutch
		set Searching_loc to my supprime(Searching_loc, "'^0'.")
	else if Searching_loc contains ""^0"." then # zh_CN
		set Searching_loc to my supprime(Searching_loc, ""^0".")
	else if Searching_loc contains "^0." then # zh_TW
		set Searching_loc to my supprime(Searching_loc, "^0.")
		
	else if Searching_loc contains "^0" then
		set Searching_loc to my supprime(Searching_loc, "^0")
		if Searching_loc contains "." then # German, hu, ko, tr
			set Searching_loc to my supprime(Searching_loc, ".")
		else if Searching_loc contains "..." then # Japanese
			set Searching_loc to my supprime(Searching_loc, "...")
		end if
		
	else if Searching_loc contains "0^" then
		set Searching_loc to my supprime(Searching_loc, "0^")
		if Searching_loc contains "." then # he
			set Searching_loc to my supprime(Searching_loc, ".")
		else if Searching_loc contains "..." then # ar
			set Searching_loc to my supprime(Searching_loc, "...")
		end if
	end if
	
	tell application "System Events" to tell application process "Finder"
		set mt to 3 # menu Fichiers
		tell menu bar 1 to tell menu bar item mt to tell menu 1 to click menu item Search_loc
		repeat
			if (count window) > 0 then exit repeat
			delay 0.1
		end repeat
		repeat
			if (get class of UI elements of window 1) contains splitter group then exit repeat
			delay 0.1
		end repeat
		repeat
			if (get class of UI elements of first splitter group of window 1) contains group then exit repeat
			delay 0.1
		end repeat
		--class of UI elements of last group of first splitter group of window 1
		tell last group of first splitter group of window 1
			# value of pop up buttons
			--> {"Type", "Quelconque"}
			set indx to 1
			set TypeButton to pop up button indx
			click TypeButton
			# name of menu items of menu 1 of TypeButton
			--> {"Type", "Date de dernière ouverture", "Date de dernière modification", "Date de création", "Nom", "Contenu", "Visibilité du fichier", "Fichiers système", "Date de l'ajout", missing value, "Autre."}
			click menu item SystemFiles_loc of menu 1 of TypeButton
			set indx to indx + 1
			set AttributesButton to pop up button indx
			click AttributesButton
			name of menu items of menu 1 of AttributesButton
			--> {"ne sont pas inclus", "sont inclus"}
			click last menu item of menu 1 of AttributesButton
			name of buttons
			--> {"+", "-"}
			click button 1
			
			repeat
				delay 0.1
				if (count pop up buttons) > 2 then exit repeat
			end repeat
			--log indx
			set indx to indx + 1
			--log indx
			# value of every pop up button
			--> {"Fichiers système", "sont inclus", "Type", "Quelconque"}
			set TypeButton to pop up button indx
			--log (get properties of TypeButton)
			click TypeButton
			click menu item name_loc of menu 1 of TypeButton
			# value of every pop up button
			--> {"Fichiers système", "sont inclus", "Nom", "correspond à "}
			set indx to indx + 1
			--log indx
			set AttributesButton to pop up button indx
			--log (get properties of AttributesButton)
			click AttributesButton
			name of menu items of menu 1 of AttributesButton
			--> {"correspond à ", "contient", "commence par", "se termine par", "est"}
			click menu item 2 of menu 1 of AttributesButton
			
		end tell
	end tell
end Germaine

#=====
(*
removes every occurences of d in text t
*)
on supprime(t, d)
	local oTIDs, l
	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
	set l to text items of t
	set AppleScript's text item delimiters to ""
	set t to l as text
	set AppleScript's text item delimiters to oTIDs
	return t
end supprime

--[/SCRIPT]

Yvan KOENIG (VALLAURIS, France) lundi 29 juin 2015 22:12:26

PS. As we may now use several delimiters in a single instruction, the script may be shorten but I’m too lazy to apply the possible changes :confused:

PS 2 : In fact the flow of instructions editing Searchin_loc may be replaced by :

set Searching_loc to my supprime(Searching_loc, {"'^0'", ""^0"", "0^", "^0"})
set Searching_loc to my supprime(Searching_loc, {".", "..."})

ccstone wrote:

Wow! Thanks for providing a metric tonne of knowhow, Chris! Very useful, along with the comments for clarification!

Me too :slight_smile: … seems like you can’t rely on the dynamic library loader error messages anymore :wink: