Store/Retrieve more than one variable in Clipboard using an Array?

Well, being able to use 8 or more globals will be a boolean playground…

When I used the clipboard as storage, I was able to see the value of the variable, so I could check the “signal flow.”

How can I observe the values of the globals? As I understand it now, they are global to all applescript(s), so perhaps I can run something in “real” applescript to display them?

Thank you for the more advanced code ideas, I am learning a lot. I’m still at 10.9.5 though. 10.10 was a music software breakpoint, so I’m desperately holding on.

Ooops just re-read the thread. The globals only persist in the MIDIpipe Applescript instance.

How can I display them?

Well. If you’re going to fool with the record before it goes on the clipboard:

set alpha to {property1:4, property2:"oops", property3:{1, 2, 3, 4, 5}, property4:{a:"aardvark"}, property5:Tuesday, date:(current date)}
set the clipboard to {alpha}
delay 0.2

set beta to beginning of (the clipboard as list)
-- Or:
set beta to (the clipboard as list) as record

:slight_smile:

I don’t know how or what you were displaying before. There’s no obvious way to show what’s going on in real time without holding things up. You can get a script to ‘say’ the value of a variable as long as the value’s text, a number, or a boolean:

set my print depth to "aardvark"
say my print depth

Or it can say when the flow’s entered a certain block of code:

if (footswitchSignalReceived) then
	say "footswitch signal"
	-- Relevant handling code here.
end if

Or, as Yvan suggested, you can set the properties of a record to several variables of interest and put the record on the ciipboard. You can then read the clipboard with a script in Script Editor and see the result in the Result pane. Obviously this only shows record that’s on the clipboard when it’s read, but it may be useful. The advantage of a record over a list is that you can give the properties meaningful labels, making it easy to identify which value’s which.

If you’re really desperate and need a message-by-message breakdown of the entire performance, you can get the script(s) to write running logs to a text file or editor. But that’s potentially a hell of a lot of data — as well as a considerable amount of extra code!

One can view the contents of the clipboard either with one of several apps. or in the Finder, under Edit, View Clipboard. The Finder window is not real time though, you need to refresh the window.

Anyway, I’m sure have enough info now. Many thanks to all who commented.

Peter

For anyone who Googled and got this MIDIpipe thread, this little pipe reveals the status of the “my” variables listed above:

on runme(message)

if (whatever MIDI trigger message is input) then

tell application “Finder”
say my minutes
end tell
end if
end runme

I have the logic working perfectly thanks to everyone here.

FYI I am monitoring the globals by having Applescript tell the finder to say them. Very cool.

The final problem. I need to block the MIDI from going through each specific pipe. I thought this would work as a MIDI on off switch, but it does not

on runme(message)
if (my hours = (1)) then
return (message)
end if
end runme

The script still passes MIDI. And, when “if = True”, it doubles the notes.

Stublito

Hi stublito.

Have you unchecked the “pass through” option beneath the script window?

Thanks for the quick reply.

Yes, I’ve unchecked that.

It’s definitely “leaking” through each pipe, and not from somewhere else, if I disable the input tool in any pipe, it mutes correctly.

FYI I have 13 of these being switched by the logic.

Duh. Applescript module has a “pass through” check box as well.

All good.