Library SDEF file optional parameter

Each of my libraries has a Dictionary.sdef file attached.
I can call all handlers with a command like:

set theResult to text find theString using thePattern with ignore case

I would like to make the ignore case parameter optional.
Is it possible?

[I’m using [Sdef Editor](https://www.shadowlab.org/softwares/sdefeditor.php?lang=en).]

You need to add an optional attribute with a value of "yes" to the parameter in your sdef. I imagine you can do it in Sdef Editor, otherwise you’ll need to do it manually. Then change the code to something like:

on find theString using thePattern ignore case caseFlag : false

The code side of things is covered in the 10.10 release notes.

Awsome!
It’s as simple as this!

I spent hours on the web to find the solution!

:wink:

And now I’m going to argue that you should eliminate the parameter altogether :slight_smile:

AppleScript already has a standard way of handling this:

considering case

or:

ignoring case

And it’s easy enough to check the, um, case:

if "A" = "a" then
-- ignoring case

I don’t get it.
The ignore case parameter is the user’s choice.
My goal is to simplify the writing of commands, not only this one.

I realize my precedent post is a little bit confused.

Let’s take another example with a command to change the extension in a path:

on path change extension thePath newExtension newExt full path fullPath

As it’s changing the path, it’s obvious it must return a path.
But some times, we only need the name.
For that, we could have another command or ask for the last component.
I find that an optional parameter is more adequate.

I understand — my point was for this particular case parameter only.