Tuesday, June 27, 2017

#1 2017-06-13 02:21:58 pm

rick_260
Member
Registered: 2012-06-28
Posts: 49

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

Offline

 

#2 2017-06-13 08:49:34 pm

t.spoon
Member
From: BFE, Massachusetts
Registered: 2013-01-12
Posts: 185

Re: Houdahspot scripting?? search lists

According to the manual https://www.houdah.com/houdahSpot/help/ … p%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:

1954834
1983142
1986741
1986753
1987001
1987198

to

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

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

Applescript:

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:

Applescript:

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.

Last edited by t.spoon (2017-06-13 10:15:56 pm)


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

#3 2017-06-14 06:46:08 am

rick_260
Member
Registered: 2012-06-28
Posts: 49

Re: Houdahspot scripting?? search lists

"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

Offline

 

#4 2017-06-14 09:18:06 am

t.spoon
Member
From: BFE, Massachusetts
Registered: 2013-01-12
Posts: 185

Re: Houdahspot scripting?? search lists

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.

Applescript:

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

Last edited by t.spoon (2017-06-14 09:18:26 am)


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

#5 2017-06-14 09:53:31 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3059

Re: Houdahspot scripting?? search lists

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

Applescript:

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

Last edited by Yvan Koenig (2017-06-15 09:13:38 am)

Offline

 

#6 2017-06-14 12:36:53 pm

rick_260
Member
Registered: 2012-06-28
Posts: 49

Re: Houdahspot scripting?? search lists

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

Offline

 

#7 2017-06-14 02:02:29 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3059

Re: Houdahspot scripting?? search lists

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

Offline

 

#8 2017-06-15 05:54:44 am

rick_260
Member
Registered: 2012-06-28
Posts: 49

Re: Houdahspot scripting?? search lists

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

Offline

 

#9 2017-06-15 07:09:53 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3059

Re: Houdahspot scripting?? search lists

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

Applescript:

tell application "Adobe Acrobat" to activate

Here the trial version is named "Acrobat Pro"

In my version we may read:

Applescript:

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

Applescript:

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

Last edited by Yvan Koenig (2017-06-15 07:16:24 am)

Offline

 

#10 2017-06-15 07:45:57 am

rick_260
Member
Registered: 2012-06-28
Posts: 49

Re: Houdahspot scripting?? search lists

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"

Last edited by rick_260 (2017-06-15 07:46:20 am)

Offline

 

#11 2017-06-15 08:02:54 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3059

Re: Houdahspot scripting?? search lists

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

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?

If the parenthesis must not be inserted edit the instruction

Applescript:

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

as

Applescript:

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

Last edited by Yvan Koenig (2017-06-15 09:15:13 am)

Offline

 

#12 2017-06-15 08:47:33 am

rick_260
Member
Registered: 2012-06-28
Posts: 49

Re: Houdahspot scripting?? search lists

"set searchtext to searchNumbers as text"

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

Last edited by rick_260 (2017-06-15 09:00:17 am)

Offline

 

#13 2017-06-15 11:58:54 am

rick_260
Member
Registered: 2012-06-28
Posts: 49

Re: Houdahspot scripting?? search lists

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

Offline

 

#14 2017-06-15 12:55:43 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3059

Re: Houdahspot scripting?? search lists

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

Last edited by Yvan Koenig (2017-06-15 12:57:00 pm)

Offline

 

#15 2017-06-16 07:04:25 am

rick_260
Member
Registered: 2012-06-28
Posts: 49

Re: Houdahspot scripting?? search lists

ok. thank you.

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

Offline

 

Board footer

Powered by FluxBB

[ Generated in 2.924 seconds, 12 queries executed ]

RSS (new topics) RSS (active topics)