| Home | News | Products | Support | Download | Sales | library | Guests | Contact | WebCam | Links | |
| LanBox-Talk mail archive | |
| By date: Prev | Next | Index | By thread: Prev | Next | Index | ||||||
Hello all, From time to time I get the question whether you can use AppleScript to control a LanBox. As LCedit+ is not scriptable, Matthijs made a small perl script which can be invoked with AppleScript in order to send a LanBox command. (also as webserver cgi?) What do you need: 1. A computer running OSX, or Linux for the perl only script (maybe perl also runs on Windows). 2. A LanBox connected via a serial/USB port, or connected to Ethernet network. 3. The perl shell command script below saved as a file called cmdwrite.pl 4. The LC+ reference manual for all LanBox commands (see inside the manuals folder in the LCedit+ folder). In AppleScript if you do this: do shell script "perl ~/Desktop/cmdwrite.pl 192.168.1.77 777 '*00050000#'" It will return the string *F8FD00CD#> which is the type and version of your Lanbox.
Your LanBox will go instant to cue 10.1 in layer A :-)
To get a list of serial ports: do shell script "ls /dev/cu.*"
### #!/usr/bin/perl use strict; use warnings; use IO::Handle; my $path = shift or die "Usage: $0 <target> <commands>\n"; my $fh; STDOUT->autoflush; sub doread {
while (sysread $fh, my $buf, 256) {
print $buf;
$fh->blocking(0);
}
$fh->blocking(1);
print "\n";
}if (-e $path or -e "/dev/cu.$path") {
$path = "/dev/cu.$path" if -e "/dev/cu.$path";
open $fh, '+<', $path or die "$path: $!\n";
$fh->blocking(0);
until (sysread $fh, my $buf, 1) {
print $fh " #\n";
select(undef, undef, undef, 0.1);
}
} else {
require IO::Socket::INET;
$fh = new IO::Socket::INET PeerAddr => $path, PeerPort => 777
or die "$path: $@\n";
doread;
}$fh->autoflush; while (@ARGV) {
print $fh shift, "\n";
select(undef, undef, undef, 0.1);
doread;
}
###
Fokko van Duin, Creators of the LanBox-LC CDS advanced technology bv, DMX lighting controller. http://www.cds.nl/ http://www.lanbox.com/ Member of MIDI Manufacturers Association, MMA
| |||||||
| By date: Prev | Next | Index | By thread: Prev | Next | Index | ||||||