Topic: fscommand troubles

I am trying to use fscommand to execute a shell script.   I am not truly writing the flash, I am using a canned menu program which will call the fscommand function

So it doesnt work using fscommand ("exec","echo.sh")

I get

2007-09-25 21:44:29 ClientObject::DoFSCommand() cmd='exec' args='echo.sh'
2007-09-25 21:44:29 ClientObject::DoFSCommand() unknown fscommand 'exec' with 'echo.sh'

I also tried fscommand("launch","echo.sh") but that doesnt work either.

Any suggestions?

justin

Re: fscommand troubles

This is a flash file, but you want to launch the linux programs?

Call an XML of "exec:/path/to/command"

This will NOT work if the widget is loaded into the control panel, however.

Re: fscommand troubles

The FlashLite player does not support the "exec" fscommand, mainly because your typical mobile device doesn't want you executing arbitrary binaries on the device.  Even if it were enabled, fscommand does not return the result of the execution.

However, on the chumby, we've enabled some capabilities that are available to movies running with local security.  This means that the movie must be running on the device itself as the primary movie (like the Control Panel), but not from the network (like a widget).  Both methods allow you to capture the stdout output of the command.

The first method is to use the XML object, with  the protocol "exec://".  For instance, you could do:

x = new XML();
x.onData = function(data) {
  trace(data);
}
x.load("exec://ls");

The second option requires an ASnative call:

_backtick = ASnative(5,52); // syntax slightly different for Actionscript 2 - see the wiki
output = _backtick("ls");
trace(output);

The backtick method should be used only for extremely quick, synchronous calls, since the player is blocked during the execution and will cause and Actionscript timeout if it takes too long.  The XML method should be used for longer, asynchronous calls, and is preferred as best practice.

Again - these only work for movies running with local security, not widgets.  Running local binaries is potentially dangerous, so use at your own risk.

Re: fscommand troubles

Ug!  Thanks Duane for the insight.

So I won't be able todo what I want with the quick-menu swf file.  It seems I am SOL until someone builds a generic menu program for the chumby which allows this, or Chumby, Inc makes it happen. I was attempting to use a generic flash menu program I got off the inet to enable/disable btplay so that I could play music  on chumby while other widgets are playing.

I was able to get chumby to play music using a flash mp3 player; but that will only play as long as that widget is running.  I am really trying to get music to play without givingup all the nice features that the widgets provide.  running btplay in background seems to be best way, but I want to control it from chumby not SSH or webserver.

Did I mention, I am not a Flash programmer, and not really interested in learning or purchasing $800 software to do it?

So another plea for generic menu swf that can be configured via XML or other config file.  That hopefully supports this kind of action. 

BTW the generic menu "quick-menu" was able to fscommand, loadMovie however I think the player became confused about how big the screen was when it launched.  Cause it displayed off the screen.

Regards,

Justin

Re: fscommand troubles

We're adding a significant number of continuous music sources to an upcoming release of the Control Panel.

Several of these are awaiting business deals to close so they are "official".

I'm looking into another possibility for you to try, but I need to test it first.

Re: fscommand troubles

What were you doing? I could help compile/write something, depending on what you need.

Re: fscommand troubles

Hmmm, nope, the thing I was thinking of doesn't work in the current public release version of the Control Panel, but is fixed in the next version.

Basically, there's a mechanism to create "local" widgets that are run from the USB dongle but mixed in with the widgets that are coming from the server.  What I'm not absolutely sure of is what the security sandbox allows for them - ie whether or not they'd have sufficient permissions to run local binaries.

I'll document this on the wiki when the next Control Panel is released so you can play with it.

Re: fscommand troubles

zachninme wrote:

What were you doing? I could help compile/write something, depending on what you need.

What I was trying todo was use a free flash menu program such as http://adriantnt.com/products/simple_menu or quick_menu

to either call a local script   or perform loadMovie

configuring the generic menu through the XML provides significant ease of use to non-flash folks.

Simple_menu is pretty limited only doing getURL.  The same producer has quick_menu which is alot more versitile; I tried the demo of it, and was able to loadMovie another swf file.  But the screen size was messed up and the pictures did not display fully on screen.

The idea would be to produce a similar swf file which would be able to be configured via XML by anyone.  Allowing local execution of scripts and loading additional movies allows it to seemlessly integrate with existing widgets.

thanks,

Justin

Re: fscommand troubles

Duane, I wanted to help out Justin with his lack of Flash, but I'd be glad to help you guys need be ;-)
(I guess I should quote more)

I'll take a peek into it. smile

Re: fscommand troubles

zachninme wrote:

Duane, I wanted to help out Justin with his lack of Flash, but I'd be glad to help you guys need be ;-)
(I guess I should quote more)

I'll take a peek into it. smile

Zachninme,
    You make any progress on this?

Re: fscommand troubles

Drat. I'm not a flash developer, but I was hoping that I could cut my teeth by creating a widget (or a whatsit, or whatever) that used fscommand to call arecord..

Looks like that's currently out of the question.

I can't wait for people to start taking advantage of the microphone!