Click to See Complete Forum and Search --> : [RESOLVED] Can Flash Send Parameters to External Program?

07-07-2000, 01:33 PM
I've got a VB program I am planning to "sandwich" between two Flash projector files. The first Flash will run and then call the VB program. When the user exits the VB program, the second Flash will run. This way I get the functionality of VB for my application but the coolness of Flash for my Intro/Ending sequences!

I've got this working just fine but I want to prevent the user from simply executing the VB program directly, thereby bypassing the Intro Flash.

If I could get the Intro Flash projector file to send command line inputs to my VB program this would neatly solve the problem but I cannot figure out how to send these along with the FS Command's "exec" function.

Any Ideas? (thanx in advance!)

The Master
07-07-2000, 05:53 PM
If by command line inputs you mean..

somexe.exe open
somexe.exe /dothis

Yes, flash can do this you simply use the exec command and then add the argument..

I am currently working on debugging my program because my program is not interpruting the flash command (I believe that the fault lies in a standard command line .h file)

Anyway, I was not aware that VB understood command line arguments.. (but then it's been a long while for me with VB)

07-08-2000, 01:48 AM
Hmmm. Thanks but I already tried your suggestion and it does not seem to work. When I add the FS Command it takes two parameters, "exec" and the actual VB program name. If I try to add the VB command line parameter separated from the VB program name with a space or a slash or a comma, none of these work and the FS Command won't allow another parameter. I have created a shortcut on the desktop that correctly sends a command line parameter so I know the VB program is processing it correctly. :( Maybe I'm just missing something on the Flash to Windows to VB connection.

07-14-2000, 09:31 AM
why not embed your intro and ending sequence into a form within your VB app' ?

Simply use the SWF .ocx and away you go !

I can't think of any reason - functional or asthetical that would require keeping the elements seperate.

If this is not acceptable to you let me know - I'm very familiar with VB and Flash, and will try to help.

07-14-2000, 02:29 PM
Your suggestion is a good one but it won't solve my problem on this project. You see, we will distribute the end product on floppy disks. However, the Visual Basic 6 executables don't appear to fit on a single floppy. :(

Since our VB code was a) designed to be compatible with VB3 through VB6, b) does not use any VBX/OCX/ActiveX components and c) does not need long filenames, we plan to create the executables in VB3 and have plenty of room on the floppy for our Flash!

Since I don't think there is a Flash VBX component or DLL compatible with VB3, I have assumed the best way (and smallest) is to use three separate executables, 1) Flash1.exe, 2) VB3prog.exe and 3) Flash2.exe. This is a fine solution except the end user could simply execute the VB program directly and avoid the Intro Flash.

If there is no better solution around, I might just give the VB3 program an obscure name and set up the installer so it only produces an icon for the first Flash. That will probably handle 95% of the potential users of the package.

If you have other advice I'd welcome it. Thanks in advance.

The Master
07-17-2000, 03:48 PM
Sorry about getting back to you so late.. but I was pretty embarrassed to learn that Flash 4 doesn't support command line arguments.. (I hate being wrong :) )

I really don't understand it cause I must have tested the feature like 10 times.. and I thought I had 10 working responses.. This led me to believe my program had a bug.. I really don't understand how I missed such a crucial fact..

Here's what I've learned since this crucial mistake..

http://www.***********.com has a tool to launch executables with a command line interface (called JTOOLS)

It uses special symbols on the command line interface that allow the executable to both be launched and then to read the data on the command line.. This allows the program to re-interpret the characters and send the correct sequence to the shellexecute API

I haven't figured out exactly how JSTART reads the parameters from flash but when I do I should have my program completed shortly.. of course you are welcome to take a shot at it in VB or buy JTOOLS..

07-23-2000, 12:57 PM
the trick is - you have to change spaces in fs exec command line to tab symbols (09 in hex).

for example - FS Command ("exec", "program.exe /arg") will run only program.exe until you edit exported swf in hex editor and replace the space symbol (00 in hex) between '..am.exe' and '/arg' to horizontal tab (09 in hex).


The Master
07-26-2000, 06:16 PM
While this helps.. it isn't the answer to my problem..

You see.. unless jstart.exe modifies the flash executable on call the method you talk about isn't what there using.. (and I don't like the idea of having to write a .swf, .exe hex edit.. it's just too much work for the user)

This just isn't a practicle solution to recreating JSTART's easy command line call.. Though I must say I value this information highly.. Thanks

Status on my program:
I've almost got the cdrom browse part done, shellexecute is already working but I have to add the parameter command line calls..

Once cdrom browse is done.. I'm going to work on reading command line arguments through flash

Note: It's not 00 it should be 20 in hex edit..
[Edited by The Master on 07-26-2000 at 07:11 PM]

The Master
07-27-2000, 08:11 PM
Thanks to Gatha's post the answer is now YES

I had a hard time understanding exactly what the command is.. Just because I haven't hardly ever used the expression editor.. so it took me a few hours to get it.. but I'll try and simplify it for everyone..

the command works like this..

in the expression editor make the arguments a Expression
then write it out like this
"here is the name of the executable"& Chr (9) & "here goes the command line argument"

The Chr (9) actually changes the hex of the code so when it writes the executable or .swf the HEX comes out at 09 (that's the one that works sort of as a space)

Here's a picture to hopefully better demonstrate

Note: the name of the program here is actually the one I'm working on to launch file types by default applications through the Shellexecute API

08-08-2000, 06:57 PM

not to step on toes but Chr(9) is a tab Chr(32) is a space. But I used Chr(9) with my code written in VC++ and it works fine. But now i'm writing the same program in VB and it chokes on the arguments passed to it. it executes but throws an error, because the second part of my expression FS_Command is not passed at all. Anyone have any ideas why it would work with C++ and not VB?

Also both of my programs work just fine at the command-line.

but the VB one chokes out of flash.

".exe" & Chr(32) & "c:\windows\notepad.exe"
".exe" & Chr(9) & "c:\windows\notepad.exe"
[Edited by secart on 08-08-2000 at 07:05 PM]

The Master
08-08-2000, 09:26 PM
Well the real question to ask is why would you want to write a VB application anyway?

C and C++ is pure, (though M$'s is a little off) why sour it with the complications and lousy implementation of programming called Visual Basic??? (sure VB is easy.. but it still is a lousy Programming application) <-- Don't get me started on this cause I can rant and rave all day..

I meant Character 9 was interpreted as a space in Flash not in Hex.. (I didn't bother to test the true space.. "if it works, leave it alone" is the old saying)

I really truly can't understand why you would want to program in VB.. (but wouldn't it just be easier to launch a program through your C++ .exe) If you want to send me your VB code I can have a look, on that same note I can send you my C++ code if you would like to see it in action (though by your post I assume you already have the Shellexecute API working..) It's so easy isn't it.. :)

Ohh and in case you missed it I did launch 2 functional BETA's that open programs in there default applictions.. (these where both written in C++) http://www.flashkit.com/board/showthread.php?threadid=13112
And one of these days I'll optimize them and add a Cdrom browse command and release a final..
[Edited by The Master on 08-09-2000 at 01:42 AM]

08-09-2000, 11:54 AM

Your correct VB is easy, and I picked a lot up on it in about one day. I went with it beacuse I cut the size down of my application with VB. Also VB has auto parsing of the command line or command spliter function. But i'm not here to stand for one or the other I enjoy both VB and C++

I was just wondering why both would work just fine at the command-line and the VB program would choke with flash sending it the arguments. It should work the same as the c++ program, but it doesn't.

Thanks anyway.

The Master
08-09-2000, 12:46 PM
What you want is Delphi not VB, Delphi executable start at around 20 to 30 kb if it's Console (that's command line arguments) if you make a visual application then executables start out at around 150 kb (these programs have 0 dependencies)

It always good to work with a programming language that has a future.. and soon Delphi will be compatible with 2 OS's as a Linux version is in development

To me Delphi is everything VB should have been..

Anyway back to practically.. I tested 2 command line applications I found on planet-source-code (one of the better things about VB however is the amount of shared knowledge) and both came up negative when executing parameters from flash just as you said.. Now I could spend hours and hours of debugging, testing and surfing to see if VB has some tiny little option that would fix this.. But that's your job :)

My summary of why it doesn't work.
VB = Flawed programming language

08-09-2000, 12:55 PM
My VB app is less then 20 kb. and for Delphi I don't think so. But yes your right its my job to look and search for the answer which is what i'm doing. I thought i would ask here first since its flash that i need to understand how it passes arguments.

Thanks again.

The Master
08-09-2000, 03:29 PM
Your best bet at saving time on such a quest would be to download a very, very proffesional VB app (probally made by a team of programmers) one that of course executes command line arguments.. And then just test to see if it can be done..

I would look for a App like that at http://www.downloads.com or http://www.zdnet.com/downloads

You also might be able to understand more about how Flash works with command line arguments by looking at the source code of the flash player from http://www.macromedia.com if I remember right it was specifically made for VC++ so you should have an easy time looking at it..

One last thing you do know that even when a VB app compiles to say 20 kb (I've had mine at 10 kb :) )

That if you are to do a proper distrubution guarenteed of working on all computers you will need to include 1 to 3 Mb's of runtime .dll's?

Pope de Flash
08-09-2000, 11:00 PM
Here you go boys and girls, a little toy for you to play with


Regards, Bill

The Master
08-09-2000, 11:34 PM
Took long enough to find that program.. :)

There does appear to be two small problems from a quick glance though..

A. It doesn't install on 2000 :(
B. It's kind of big don't you think?
[Edited by The Master on 08-09-2000 at 11:39 PM]

Pope de Flash
08-10-2000, 01:13 AM
Its big but it is the only solution right now. I know about the win2000 thing but the NT solution should run on 2000. I dont know how far this guy has this thing. I have emailed him four times to do a reivew and he or she never ever answers. Its like they are selling it but with no support. Oh well. Regards, Bill

08-10-2000, 02:14 AM
Originally posted by The Master
Well the real question to ask is why would you want to write a VB application anyway?

C and C++ is pure, (though M$'s is a little off) why sour it with the complications and lousy implementation of programming called Visual Basic???

I really truly can't understand why you would want to program in VB.. (but wouldn't it just be easier to launch a program through your C++ .exe)
[Edited by The Master on 08-09-2000 at 01:42 AM]

OK. We get it that you don't like VB.

C, C++, VB, Flash; they are all just tools, not religions! :) I personally could care less about the tool or its "purity"!! If it does the job I'm happy!

The Master
08-10-2000, 02:46 AM
Given the fact that the last Beta was in March of 2000 that isn't suprising.. still it costs money so that's a plus for my App :)

Still all the the things the app claims to do are really actually easy to implament.. and I'm not sure if the executable I could make would come out at 300 + kb that seems kind of big.. (of course he is using a Visual interface.. or so it appears and that does add size)

OK. We get it that you don't like VB.

C, C++, VB, Flash; they are all just tools, not religions! I personally could care less about the tool or its "purity"!! If it does the job I'm happy!

Yah but you don't get it.. it doesn't do the job.. In the end it causes more problems then solutions

Isn't there enough bad programs out there already?

Pope de Flash
08-10-2000, 03:32 PM
the best deal for all of that has also been to create a Director shell around the swf. and do all your actions through the Director exe. If you have Director it works.

I bet that dude was just waiting to see if they included that function in Flash 5 to finish it or can the project. There are alot of tools that will go off the market in the next few months with the advent of 5. Regards, Bill

08-15-2000, 12:30 PM
I have a question along these lines, but it doesn't really belong in this thread so I posted a new one:
Sounds like you guys have the technical knowlege I need to answer this question. It's about modifying the registry from flash. If you feel like helping jump on over.

08-15-2000, 04:44 PM
You mean "bad programmers"

VB is a fine language. And if you know the win32 api it is even more flexible.
I have created many apps with VB and all of them run very well. C++ is a better system, but when it comes to GUI and crunch time it canít beat VB. Sure it has some drawbacks but overall my experience with VB has been excellent.

One thing I have noticed is that it seems to be the culture of C++ guys to dismiss VB out of hand.

Jaime Garate
10-05-2000, 11:27 AM
Hi, I don't know if you're still following this thread but i just made a program in VBasic to write vars to my HD into a text file.
I run the program with the FS "EXEC" command, pass the variables and the program do the rest.
You can download this three files from here:
place the three files in the same folder and run the write.exe first, use the read.exe to read your vars, the name of the text file is vars.txt.
you can have more than three vars,
of course if you whish i can share the source code.
The read.exe is just for demonstration purposes, the important part here is a subroutine nested in my flash file called write.exe, this subroutine deletes and inserts all the special chars like &, chr(9) and "" so you don't have to deal with that every time you add or remove a variable.

The other important thing here is the executable built in VBasic that filters and formats the vars passed to save the in a format that Flash can read back again AND it runs transparent in the background you don't even notice it.

You can not pass more than 135 chars to the VBasic exe.

Final note:
I'm still working on the warning noted above as well as other capabilities and functions and don't forget your feedback.