Houdahspot scripting?? search lists

This is a long shot but has anyone done any scripting for Houdahspot search software??

https://www.houdah.com/houdahSpot/?lang=en

Our current workflow using “EasyFind” is to copy a list of file names from a PDF and paste it in the EasyFind search field. Easy find searches out all the names in the list and returns a result for each of listings.

Houdahspot does not do lists.

Well it sort of does. Following the above workflow: If I copy the list into text edit and and add an “or” after each entry and then copy/paste it into Houdahspot it will work.

For example the following will not work in houdahspot unless there is an “or” between the entries
1954834
1983142
1986741
1986753
1987001
1987198

it takes the above and creates one string (each requiring an “or”)

1954834 1983142 1986741 1986753 1987001 1987198

(1954834 or 1983142 or 1986741 or 1986753 or 1987001 or 1987198)

looking for a way to get that copied data into houdahspot so that it teaches for each entry in a list?

thank you in advance r260

According to the manual https://www.houdah.com/houdahSpot/help/4.3/HoudahSpot%20Help%20EN.pdf, HoudahSpot has an Applescript dictionary, so that shouldn’t be any problem.

But frequently when someone asks for help with a program that none of the regulars here have installed, nobody wants to download and install new software on their personal computers just to help. At the moment, that includes me.

I’m also not entirely clear on what functionality you’re looking for - do you want to parse the PDF’s with a script and do the whole thing automatically? If you’re still planning on having the user open the PDF and select the text with the relevant numbers, and the only thing you’re looking for is to convert the clipboard from the format:

to

So the user can paste that into the front window in HoudahSpot, then that’s easy.

set searchNumbers to the paragraphs of (the clipboard)
set searchText to "("
set itemCount to the count of searchNumbers
repeat with i from 1 to itemCount
	set aNumber to item i of searchNumbers
	if i ≠ itemCount then
		set searchText to searchText & aNumber & " or "
	else
		set searchText to searchText & aNumber & ")"
	end if
end repeat

set the clipbpoard to searchText

Then you’re ready to paste it into Houdahspot.

You could add a “copy” in the PDF viewer to the beginning and then activate HoudahSpot at the end and paste there, to make it so all they have to do is select the text and run the script.

Or, since HoudahSpot has an Applescript dictionary, you can script more on the HoudahSpot end.

It looks to me like to make it search the text in HoudahSpot, it’s just:

tell application "HoudahSpot4"
        activate
	search searchText
end

But I’m guessing that, if you need HoudahSpot rather than just using Spotlight, you have a lot more refinements going on in your HoudahSpot search window and want to either just paste it in, or need the Applescript to fill in your additional search criteria.

“But frequently when someone asks for help with a program that none of the regulars here have installed, nobody wants to download and install new software on their personal computers just to help. At the moment, that includes me.”

  • yes. thank you. completely understood.

“You could add a “copy” in the PDF viewer to the beginning and then activate HoudahSpot at the end and paste there, to make it so all they have to do is select the text and run the script.”

Yes. optimally it would be great to go on copy from Acrobat into the Houdahspot.

i.e. taking the result of Acrobat copy > adding “or” after each entry > auto fill the result into the HoudahSpot search window. The user would then select his/her own “refinements” within HoudahSpot before searching (ex: selecting the drive to be searched etc etc)

Using Adobe AcrobatPro 10.1.16 as PDF viewer.

Unfortunately I am not sure how to do the above. I am guessing this would be an Acrobat script?? Does Acrobat offer an attached script options??

Thank you for the ideas and input. Rick

Although Acrobat has a scripting dictionary, I could find no way to directly retrieve the contents of selected text, and there isn’t even a dictionary command for “copy.” So I’ll resort to UI scripting there.

Otherwise, it’s just the script I already posted.

tell application "Adobe Acrobat" to activate
tell application "System Events" to keystroke "c" using command down
set searchNumbers to the paragraphs of (the clipboard)
set searchText to "("
set itemCount to the count of searchNumbers
repeat with i from 1 to itemCount
	set aNumber to item i of searchNumbers
	if i ≠ itemCount then
		set searchText to searchText & aNumber & " or "
	else
		set searchText to searchText & aNumber & ")"
	end if
end repeat
tell application "HoudahSpot4"
        activate
	search searchText
end

Assuming that t.spoon script does the job, this one would do it too :

tell application "System Events" to tell process "AdobeAcrobat" # check the name of the process
	set frontmost to true
	keystroke "c" using {command down}
end tell
delay 0.1
set searchNumbers to paragraphs of (the clipboard as «class utf8») # EDITED
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to " or "
set searchtext to searchNumbers as text # EDITED, the enclosing parenthesis were unwanted
set AppleScript's text item delimiters to oTIDs

tell application "HoudahSpot4"
	activate
	search searchText
end tell

Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) mercredi 14 juin 2017 16:53:27

how do i implement the script?? i am drawing a blank (OS 10.11.6)

do i add acrobat to system prefs>security&privacy>accessibility?

or am thinking of something different? as i recall it had something to do with Universal Access> Assistive Devices??

foregive me its been awhile

R260

No need to add Acrobat to system prefs>security&privacy>accessibility
No need to add the script to system prefs>security&privacy>accessibility as long as you save it as a script or a script bundle.
You will have to add the script to system prefs>security&privacy>accessibility if you save it as an application.

We had something to do with Universal Access> Assistive Devices with very old operating system : before 10.6 if I remember well.

Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) mercredi 14 juin 2017 21:00:34

i am doing something wrong.

after i compile the script, where do i save it and in what format (script, bundle, application?)

i tried saving it as an application and adding it prefs>security&privacy>accessibility and nothing happened on acrobat command-c

i apologies for my lack of understanding R260

Which version are you trying to use ?
In t.spoon’s one we may read

tell application "Adobe Acrobat" to activate

Here the trial version is named “Acrobat Pro”

In my version we may read:

tell application "System Events" to tell process "Acrobat" # check the name of the process

The comment was useful because after installing the trial version I discovered that the process is named “AdobeAcrobat”.

Running the script after editing the name of the process I discovered that I had to explicitly define which component of the clipboard was to be extracted. It contained two of them : «class RTF » and «class utf8»
I must use «class utf8» and a short delay seams to be useful before the instruction

set searchNumbers to paragraphs of (the clipboard as «class utf8») # EDITED

I edited my original message accordingly.

Before trying to save as application, open the edited script in the Script Editor, select some numbers in Acrobat then click the button [Run the script], the one with a black triangle [ ▶︎ ].

Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) jeudi 15 juin 2017 14:09:39

numbers selected/copy in acrobat:
1986786
1986812
1986884

run script

houdahspot search window result:
(1986786 or 1986812 or 1986884)

“or” was successfully added however it also added “parenthesis”

The script adds the parenthesis because it’s what you described in your original message.

If the parenthesis must not be inserted edit the instruction

set searchtext to "(" & searchNumbers & ")"

as

set searchtext to searchNumbers as text

I wait confirmation that it’s what you need before editing my script.

OK, script edited !

Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) jeudi 15 juin 2017 15:02:49

“set searchtext to searchNumbers as text”

using the line above the results were correct in the HoudahSpot search field

the script does not run on its own and must be “activated” manually.

i have it as an application in prefs>security&privacy>accessibility.

if i understand correctly the script process should begin with “command-C” in acrobat…is this correct??

R260

No, the script execute the copy task after you start it.
If you save it as an application you will have to double click it to run it.
An alternate way is to use a launcher like FastScripts which would allow you to link the script to a shortcut which you will have to type to run the script.

Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) jeudi 15 juin 2017 19:55:24

ok. thank you.

i was thinking that it could act like an “event listener” that would perform the task