Script Library usage question (it's gotta be an easy answer!)

I have a Script Library called “MyScriptLib”. I have one sub routine in it called “TestOne”. For my test purposes, the only line TestOne has in it is a messagebox.

I have a form called IPAR. In the Globals - Options for the form, I have:

Use “MyScriptLib”

In a button on the form, I only have Call TestOne in the click event. But I can’t even save the form because it says:

Not a sub or Function name: TestOne

What easy little thing am I missing?

Subject: Script Library usage question (it’s gotta be an easy answer!)

I believe this will work if you add a Use “MyScriptLib” to the “Globals - Options” of the Form.

I forget, but in some cases you need to add it to the “Options” of the individual button object.

Subject: RE: Script Library usage question (it’s gotta be an easy answer!)

I already did have it in the ‘Globals - Options’ of the form. (or did you really mean somewhere else?).

I tried adding it to the action button under options also, but get same error.

Any other ideas?

Subject: RE: Script Library usage question (it’s gotta be an easy answer!)

Look at the script library and see if its options include:

Option Public

This means that unless you explicitly declare a module as private, it defaults to public. If it’s not there, you can either add the option to the LS library as stated above or declare your module to be public like so:

public function foo() as boolean

foo = true

end function.

IMO, it’s a good idea to explicitly declare the scope (i.e., public or private) of modules in a library regardless of what options you use in the library itself.

dgg

Subject: RE: Script Library usage question (it’s gotta be an easy answer!)

Thanks … that’s just what I needed!

Subject: Script Library usage question (it’s gotta be an easy answer!)

Delete the call to the sub and the Use statement. Resave your form. Save your script library. Go back into your form. Add the Use statement. Save. Then add the call to the sub.

Notes doesn’t evaluate the Use statement until the form is saved, so if you add it and then immediately add a call to one of its functions, Notes doesn’t find it.