SenseTalk Compiler Error (null)

Howdy all–

I’m coding up a handler that takes a sequence of keystrokes out of a file and executes them on the remote system.

The text file contains

("NUMPAD7","f","NUMPAD6","a","b","NUMPAD5","c","d","e","c")

The experimental code I’m working with at the moment is the following:

to doSimpleEntries file_Name
	put file "Test_Data/Entries.txt" into command_list
	repeat with each item of command_List
		put value(it)
	end repeat
end doSimpleEntries

If I select the “guts” of the handler (everything inside the handler declaration, and run the selection, I get:

sensetalk compiler error in (null): Syntax error at or near character 11

If I select the first line by itself and run selection, it works. If I select the repeat loop, it works. What’s up?

Using Eggplant 4.1

Here’s a great situation to use the debugger to see what’s going on. Hold down the Option key when you run your selection, and step through one line at a time. Examine the contents of variables as you go. Before you execute the line that says “put value(it)”, type “put it” in the Ad Hoc Do Box and you’ll see this:
(“NUMPAD7”

Notice the leading parenthesis, and think about why it’s there…

The problem comes from the fact that any time you read from a file, what you get is text, not a list like you might be expecting. To get a list, call the value function when you access the file, like this:

	put value of file "/tmp/Entries.txt" into command_list 

That should get you closer to what you want. :slight_smile:

Anyway, I’ll also take this as a bug report, since it seems clear that the error message should be much better in this case. The code you are running is just fine… the “compiler error” comes from the fact that the value() function calls the SenseTalk compiler to evaluate the expression – (“NUMPAD7” – which isn’t a valid expression because it’s missing a closing parenthesis at character 11. The error message should at least make it clear that the error occurs while calling the value() function so you’ll have an idea of where to look.

That’s much better, thanks!

A follow up, I see that the escape sequences for modifiers have been removed from the docu. I’m discovering that if I’m going to tell eggplant to enter notes based on what’s in a text file, I’m going to need those. Is there a place that the old 4.0 docu is hiding, or maybe a post over on the FAQ for those of us who are sick enough to need that functionality.

Thanks again!

Allen

Here is a PDF of the TypeText escape codes for your reference.

If you want to put it inside Eggplant.app/Contents/Resources/Documentation (so it’s in the Eggplant Help Viewer in 4.1) you also must issue this command in a terminal and restart Eggplant:

defaults write com.redstonesoftware.Eggplant LoadAllDocuments -bool TRUE

Sweet!

Thanks…You are tempting me to rearrange my docu a bit, you know :wink: