How to use Script Folders?

Hi, in the SenseTalk Reference, page 146. while talking about objects, the manual mentions Script Folders, and how each script inside the folder is considered a handler, also it mentions the specially named initialHandler script.

Nowhere else in the manual is this mentioned again, and when creating a folder ( manually on the desktop ), that folder is not recognized by the EggPlant application.

So, has anybody used this? How do you go about creating “handler” scripts for this? or am i completely mistaken in regard to what they are talking about here?

thanks in advance,

Luis R. Rojas

Yes, it’s true that SenseTalk allows a folder to be treated as an object, with any script files in that folder treated as handlers. This capability isn’t fully supported by eggPlant, though, and I’m curious why you’re interested in using it.

As you’ve noted, the eggPlant script development environment doesn’t recognize folders containing scripts as objects, so I don’t think you’ll find it very convenient to work with them. But to fully answer your question, as an academic exercise you can try this:

Create a new Suite, and an ordinary script in that suite called “ObjectA”. In the ObjectA.script put this code:

put "This is ObjectA, an ordinary script."

to sayHello
  put "Hello, this is the sayHello handler in ObjectA.script"
end sayHello

Then, in the Scripts folder inside your suite, create a folder called “ObjectB” alongside the ObjectA.script file. Inside this folder, create a file called “sayHello.script” containing this one line of code:

put "Hello, I'm a script inside the ObjectB folder"

You won’t be able to create the sayHello.script file directly in the ObjectB folder using eggPlant, but you can create it the usual way (directly in the Scripts folder) and then manually move it into the ObjectB folder in the file system.

Then create another script in you suite named “Caller”. The relevant files and folders in your file system should now look like this:

MySuite.suite
	Scripts
		Caller.script
		ObjectA.script
		ObjectB
			sayHello.script

Enter these commands in your Caller.script:

ObjectA.sayHello -- call a handler in a script object
ObjectB.sayHello -- call a script in a folder object

When you run the Caller.script you should find that both calls work correctly. If you add a script named initialHandler.script inside the ObjectB folder, then you could also add these lines to the Caller.script:

ObjectA -- call ObjectA's initial handler
ObjectB -- call ObjectB's initial handler

I hope that answers your question. If you have particular ideas about how this capability might be useful to you, please let us know and perhaps we can add support for it in a future version of eggPlant.