FoxTrot Search Forum
FoxTrot Search for macOS Forum

Home » Public Forums » FoxTrot Search User Forum » Help Needed with Foxtrot Applescript
Help Needed with Foxtrot Applescript [message #168] Mon, 24 March 2014 20:48 Go to next message
Potts Jeff
Messages: 1
Registered: March 2014
Junior Member
Hi,

I love Foxtrot Pro, but since I do an awful lot of searches on my data
when working on research.

I was wondering if anyone had already written an Applescript service where
I could simply select the text I wish to search, hit an keyboard shortcut
and it would copy my selected data into the search field and start the
search.

Alternatively, could anyone point me in the direction of some scripts that
I could modify?

Jeff
Re: Help Needed with Foxtrot Applescript [message #170 is a reply to message #168] Tue, 25 March 2014 09:03 Go to previous messageGo to next message
FoxTrot Engineering
Messages: 385
Registered: April 2020
Senior Member
Potts Jeff wrote:

> I was wondering if anyone had already written an Applescript service where
> I could simply select the text I wish to search, hit an keyboard shortcut
> and it would copy my selected data into the search field and start the
> search.

You can use the FoxTrot system menu: select the text you want to search, type command-E in applications that support the system-wide search string, then use the shortcut defined in FoxTrot's preferences to open FoxTrot's system menu.
If the application where you select the text does not support the system-wide search string, copy the text, use the shortcut to open FoxTrot's system menu, then press the command key to paste the search string.

> Alternatively, could anyone point me in the direction of some scripts that
> I could modify?

To perform a search in FoxTrot from AppleScript, use the following command:

tell application "FoxTrot Professional Search"
activate
search "search string"
end tell


Jérôme - CTM Engineering


------------------------------------------------------------ ---------
"Incredibly powerful and useful. If you're thinking "Yeah, I have
Spotlight, and it was free" then think again. FoxTrot is instantaneous.
It lets you do those good boolean searches that Spotlight makes
impossible to do (or to remember how to do). I can't believe how fast
it finds Mail messages, and then shows me the subject line, mailbox
location, and the full text of the message in preview."
FoxTrot Personal Search user comment on www.macupdate.com

Download a demo version from www.foxtrot.ch
------------------------------------------------------------ ---------


Jérôme - FoxTrot Engineering
Re: Help Needed with Foxtrot Applescript [message #1104 is a reply to message #170] Thu, 03 December 2020 04:23 Go to previous messageGo to next message
Christopher Stone
Messages: 2
Registered: December 2020
Junior Member
Please show me how to initiate a regular expression search via AppleScript.

TIA

-ccs
Re: Help Needed with Foxtrot Applescript [message #1110 is a reply to message #1104] Wed, 16 December 2020 15:52 Go to previous messageGo to next message
FoxTrot Engineering
Messages: 385
Registered: April 2020
Senior Member
Regular expressions are usually used through the criterion [then apply advanced filter] [contents] [contains the regular expression], which can only be used as a secondary criterion. Using AppleScript, you can currently only specify the search string for the first criterion, so you can't use regex filters from AppleScript.

However, you can also use regular expressions through the FoxTrot Query syntax, enclosing the regex between acute accents. Here again, you can't only specify a regular expression, there should be some other search words. For example, you could search for: [contents] [matches the foxtrot query] [secret memo `\b\d\d/01/\d\d(\d\d)?\b`] to search for documents containing the words [secret] and [memo] and the regex \b\d\d/01/\d\d(\d\d)?\b (which matches a date in the format mm/dd/yyyy or mm/dd/yy where dd is 01).

To execute this search from AppleScript (note that backslashes should be escaped in AppleScript):

tell application "FoxTrot Professional Search"
search "secret memo `\\b\\d\\d/01/\\d\\d(\\d\\d)?\\b`"
end tell


Jérôme - FoxTrot Engineering
Re: Help Needed with Foxtrot Applescript [message #1111 is a reply to message #1110] Wed, 16 December 2020 17:58 Go to previous messageGo to next message
FoxTrot Engineering
Messages: 385
Registered: April 2020
Senior Member
I forgot to specify that, if you have not defined a search template, the last search you ran should use the [matches the FoxTrot Query] criterion; or you can create a search template using this criterion, and specify this template from AppleScript:

tell application "FoxTrot Professional Search"
    search "secret memo `\\b\\d\\d/01/\\d\\d(\\d\\d)?\\b`" using template "my FoxTrot Query template"
end tell
(and the FoxTrot Query syntax uses grave accents to delimit regular expressions, and not acute accents as I said)


Jérôme - FoxTrot Engineering
Re: Help Needed with Foxtrot Applescript [message #1112 is a reply to message #1111] Wed, 16 December 2020 23:48 Go to previous message
Christopher Stone
Messages: 2
Registered: December 2020
Junior Member
Thank you for the tips.

-ccs
Previous Topic: Issues in PowerMail
Next Topic: Search for PDFs with highlights
Goto Forum:
  


Current Time: Fri Jun 14 14:16:33 GMT+2 2024