Launching exe - swf fscommand?
Copy link to clipboard
Copied
When I use the "open file or url" option to launch an exe, I get a download file dialogue. This is in Windows 7. Is that normal on xp and Vista too?
So in an attempt to bypass that, I built a Flash button that uses fscommand("exec", "myfile.exe") to launch an exe. When published as exe, the Flash file launches the exe as expected, but when I embed the flash swf into Captivate and publish *that* as exe, the fscommand dowsn't work.
So I'm looking for suggestions for a cleaner way to launch an exe from Captivate - I'd prefer not to see a download file dialogue.
TIA
Steve
Copy link to clipboard
Copied
Steve,
What's your end goal? Will the final published C4 swf file be hosted in a browser or published as an .exe?
Copy link to clipboard
Copied
Captivate is published as exe - it will not ever run in the browser.
Copy link to clipboard
Copied
When you tell C4 to open a file, the logic in the code jumps to the "open" case in the EvaluateExternalStatement function (scroll below).
var _l2 = "open C:\\windows\\system32\\cmd.exe _self\nrdcmndResume = 1 ";
var _18 gets set to false in the EvaluateExteralStatement function.
_18 gets passed as the ForceFS parameter to the ExecuteExternalCmnd function. The logic in that function uses _18 to decide whether or not an fscommand is done. If _18 was set to "true", I believe you could rig this thing to open a file because the fscommand would be used instead of getURL. This is probably by design for security reasons. Same behavior on xp as well 🙂
*** class captivate.Veela_AS2.rdScriptEval ***
function ExecuteExternalCmnd(fsCmd, fsArg, guArg1, guArg2, ForceFS)
{
this.mytrace("ExecuteExternalCmnd 1");
if (ForceFS)
{
if (int(rdIsPreview) == 1 || FlashPlayer)
{
fscommand(fsCmd, fsArg);
return(undefined);
} // end if
} // end if
getURL(guArg1, guArg2);
} // End of the function
function EvaluateExternalStatement(stmnt)
{
var _l8 = true;
var _l11 = this.Trim(stmnt);
var _l3 = this.mySplit(_l11);
var _l7;
var _l6;
var _l10;
var _l4;
var _l9;
var _l2;
_l10 = this.Trim(_l3.pop());
_l9 = _l3.shift();
_l2 = _l3[0];
if (_l9 == "email" && (_l2 == undefined || _l2 == null || _l2 == ""))
{
_l2 = _l10;
} // end if
var _l5 = _l2.split("\"");
if (_l5.length == 3)
{
_l2 = _l5[1];
}
else
{
_l2 = _l5[0];
} // end if
_l3[0] = _l2;
switch (_l9)
{
case "open":
{
_l8 = false; JBL: *** This Should be set to true so fscommand executes ***
}
case "openmovie":
{
_l7 = "jumpmovie";
_l4 = this.Trim(_l3.join(" "));
_l6 = _l4;
break;
}
case "email":
{
_l7 = "execfile";
_l4 = "mailto:" + this.Trim(_l3.join(" "));
_l6 = _l4;
break;
}
case "javascript":
{
_l7 = "javascript";
_l4 = this.Trim(_l3.join(" "));
_l6 = "javascript:" + _l4;
if (swfCommenting)
{
m_movie_mc.executeJavascriptInAIR(_l4);
return(undefined);
} // end if
break;
}
default:
{
return(undefined);
}
} // End of switch
this.ExecuteExternalCmnd(_l7, _l4, _l6, _l10, _l8);
} // End of the function
C3 does the same thing in a simpler way using getURL:
var _l1 = "C:\\windows\\notepad.exe";
getURL(_l1, "_self");
HTH,
Jim Leichliter
Copy link to clipboard
Copied
Thanks - you leapt on a little ahead of me. What file did you get this from ? I think I found the equivalent AS3 functionality in CaptivateMaintimeline.as, but I have not yet found the AS 2 file that you quoted.
Since I published as AS3, I expect that CaptivateMaintimeline.as has the functionality I need, and to my less-than-stellar Flash knowledge the code looks 'right' 🙂
Steve
Copy link to clipboard
Copied
This is worth a look:
http://www.northcode.com/blog.php/2007/08/07/Conquering-FSCommand-EXEC-Part-1-Proxy
Even has an example .fla
Jim
Copy link to clipboard
Copied
Thanks.
I can already build a swf that uses FSCommand exec to launch my own exe. When I use Proxy.exe as you suggest, the outcome is the same:-
- When I run the swf that contains FSCommand exec, packages as an exe, it launches my own external exe fine, whether through proxy.exe or not.
- When I package as swf and embed the swf in Captivate, it fails to launch my exe. My guess is that FSCommand is ignored, since it was packaged as swf, even though it es embedded in Captivate exe.
I think you hit on a possible solution with the .as code you were pointing to earlier. If you can tell me which file you found that in, I might be able to make progress.
Copy link to clipboard
Copied
That was AS2 code from a decompiler.
There is no external AS3 file that I can find to edit for this. I tried to place the fscommand("exec", "notepad.exe") into the CaptivateMainTimeline function like so:
function CaptivateMainTimeline()
{
... cp code here ...fscommand("exec", "notepad.exe");
}
I also tried:
fscommand("execfile", "notepad.exe");
fscommand("jumpfile", "notepad.exe");
fscommand("exec", "C:\windows\system32\notepad.exe");
Nothing worked. When C4 goes to launch or jump to another captivate file, it executes the fscommand... so it's strange that it's not working here. They use "jumpfile" instead of "exec", but that didn't work either. I tried putting notepad.exe in an fscommand subfolder and in the root of the published exe with no success. There's got to be a way....
Copy link to clipboard
Copied
I made my own test exe for this, rather than relying on my first instinct - Notepad.exe. It should launch, as you say, but ...
I'll check with Adobe, and also with my client. Maybe Adobe can offer a better way, and maybe my client will be happy with what is working now ...
Thanks
Steve
Copy link to clipboard
Copied
Hey Steve
You might try my "Cheesing it" way around. If you still have Captivate 3, just create a small MenuBuilder SWF that opens the EXE file. Then drop it into a Captivate slide to allow it to do the heavy lifting of opening the EXE.
Hmmm, wait. That probably won't work because I believe that's all AS2 and you seem to be wanting AS3.
Another thought occurs here. Have you both attempted to configure the Flash Security settings to allow linking from your location? Maybe that explains the misbehavior?
Cheers... Rick
Copy link to clipboard
Copied
Yeah it has to be AS 3
Nice idea, but I don't think Flash Security Settings are relevant once you publish as exe. By publishing as exe you get different settings by default ... I think. When I right-click my the exe I make form the original Flash file, the Settings option is greyed out. The Captivate exe doesn't even offer any options on right-click.
Copy link to clipboard
Copied
Hi Steve
But this exe you call it by a command button?
Fabio Oliveira
Copy link to clipboard
Copied
Fabio - yes.
I have tried a button/clickbox in Captivate that uses the open URL/exe option.
I have also tried a custom SWF imported to Captivate. This swf has a button that calls FSCommand("exec", "myfile.exe")
Steve
Copy link to clipboard
Copied
Steve,
I don't normally drudge up old posts, but I just wanted to say that I've finally made a widget to open files in their native application from a .exe projector project. It also launches other .exe files. And yes, I used the fscommand. The nice thing about the widget is that it tackles the heart of the problem and allows you to use one widget in your project and it fixes buttons, click boxes, text entry boxes, standard and conditional advanced actions... and even slide entry and exit actions. It took me a while to find the back door... but I got it!
You can read about it here:
http://captivatedev.com/2011/05/25/adobe-captivate-5-widget-open-file-for-exe-projects/
Jim Leichliter
Copy link to clipboard
Copied
Well done Jim! This will solve a lot of headaches for people on this forum.
Copy link to clipboard
Copied
Thanks Rod!
Copy link to clipboard
Copied
Awesome.
Not that I have any clue now what project I needed this for 🙂
Always good to know of a new solution!
Steve

