Variable to an application keyword
Variable to an application keyword
- Subject: Variable to an application keyword
- From: Paul Strecker <email@hidden>
- Date: Mon, 20 Aug 2001 14:43:37 +1000
Hi, I am writing some scripts for Outlook Express and want to do the
following.
I want to allow users to search their address book for contacts matching
search criteria entered. They need to be able to specify which fields of the
contacts to perform the search.
I present the user with a list of fields, the user selects which field ( or
property of a contact) to search in.
I then want to ask Outlook to perform the search on the property specified
using the search_criteria entered through another dialog.
choose from list {"Description", "Display Name", "Company"} with prompt
"What field do you want to search on?" without multiple selections allowed
set search_method to result
set search_method to item 1 of search_method as string
Set search_criteria to "Some string the user searches for"
try
tell application "Outlook Express"
activate
try
(contacts whose search_method contains search_criteria)
--the search part
set found_contacts to result as list
on error
Display dialog "Something went wrong"
end try
End tell
End try
What I get if the user chooses "Description" is the following in the event
log.
get every contact whose "Description" contains "Some string the user
searches for"
--> {}
Instead of treating description as a property of a contact, it treats it as
a literal string thus consequently finding nothing. If I hard code
description into the script, everything works as expected.
To cut a long story short, can I coerce or otherwise my users choice of
search field into an application keyword?