Find

Hello,

Is there a way in XOJO to programatically open the "“Searching “This Mac”” window with some search parameters?

e.g. SearchThisMac(Name, Is, MySearchData")

Thanks.

Lennox

Spotlight or Finder?

Finder

AppleScript

Hi Eli,

Any available code?

Thanks.

Lennox

[code]tell application “Finder”

activate
open "/" as POSIX file

tell front Finder window
	set toolbar visible to true
end tell

tell application "System Events"
	tell process "Finder"
		tell window 1
			set searchfield to text field 1 of the last group of toolbar 1
			set value of searchfield to "abc"
			keystroke "f" using command down
			click radio button 1 of radio group 1 of group 1 of splitter group 1
		end tell
	end tell
end tell

end tell[/code]

Thanks Eli but “assistive access” is required…

System Events got an error: Script Editor is not allowed assistive access

Lennox

Activate it (in System Preferences —> Universal Access) ?

OS X El Capitan Version 10.11.6 (15G31) does not have Universal Access.

It has “Accessibility”, cannot find the appropriate item to enable.

Lennox

System Preferences –> Security & Privacy –> Privacy

http://lifehacker.com/search-spotlight-from-the-os-x-terminal-1325827647

The OP’s question is not about a search, it is about opening a Finder window ready to be searched.

Thanks Eli,

That works, but what I really want is for:

  1. the dropdown menu that is labelled “Kind” to be labelled “Name”, and
  2. the dropdown menu that is labelled “Any” to be labelled the text that I would like to search for

Your code woks well but if it can be modified as mentioned that would be great.

Thanks again Eli.

Lennox

That for that link Michel,

It can also become useful for me or anyone else reading this message.

Thanks again.

Lennox