Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Win 32exe's / C++ / Batchfiles.. FLASH PLEASE?

  • 04-06-2003 9:20pm
    #1
    Registered Users, Registered Users 2 Posts: 771 ✭✭✭


    ..hello,

    Im a bit ignorant when it comes to batch files
    and a know and understand nothing of C++
    and Win32 executables

    However I came accross the following tickler when
    trying to open up a word.doc in word from a flash exe.

    Anybody able to help me with Attack 3?

    totally stumped and out of my league

    many thanks


    Question: How can I have a Flash projector run an external batch (command line) script without the command.com or cmd.com window showing up?


    I attempted to solve this problem (i.e. running dos/windows scripts from a flash projector with console app windows not showing or minimized).

    Here is a desription of the battle which was fairly short yet interesting and I believe victorious.

    Basic assumption: You have to keep your script commands within a .bat file in the same dir as your swf file. Calling command or cmd (in NT/2K) will always give you a maximized console app window.

    ATTACK 1: I first tried to run a windows shortcut pointing to the .bat file of interest (that would have the minimize window setting to on) but unfortunately the fscommand will not run .lnk (the transparent windows shortcut filename extension) files, although you can call them fine from the command line (I only tried that on my win2K system).

    ==>DEFEAT.


    ATTACK 2: I then tried to run a vbs windows script-host script that would invoke the shell's Run command with the minimize setting on. Here is the vbscript code for that:

    Set WshShell = WScript.CreateObject("WScript.Shell")

    Return = WshShell.Run ("runit.bat", 7, FALSE)

    This was saved as a .vbs file which would be invoked from within flash with an fscommand. Well, it would but it turns out that fscommand will only run directly executable files like .exe and .bat and .com

    ==> DEFEAT


    ATTACK 3: I set out to create a mini MFC Win32 executable that we could use to delegate the task of launching the batch file we wanted. Since this exe is not a console app there is no window that comes up when it first runs and since I don't initialize any window objects nothing shows, so it is perfect for the task. This file is called launch.exe. It can be called by the fscommand and it will then run the batch file called runit.bat MINIMIZED. This .bat file may contain anything we like.

    Be advised that swf, exe and bat files have to reside in the same directory. Of course we could have this executable simply do what we wanted without calling a secondary DOS batch script, but this would require win32/C++ programming skills. Kinda too much for the average flash user/scripter.

    ==> VICTORY

    It runs nicely. However this is a windows only solution. If anybody wants a UNIX/LINUX version let me know. I don't do MAC.

    The zip containing the executable and other goodies is here:

    http://www21.brinkster.com/lonwolve/launch.zip

    This is the best I could do given the short notice.

    Later,
    Fotios

    PS1. Another way would be to call "wscript whatever.vbs" with fscommand from within flash

    PS2. For anyone interested in the windows C++ code, here it is:

    ---
    #include <afxwin.h>

    #include <shlobj.h>
    #include <shlwapi.h>

    class CFotiosApp : public CWinApp
    {
    public:
    BOOL InitInstance()
    {
    SHELLEXECUTEINFO ShExecInfo;

    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    ShExecInfo.fMask = NULL;
    ShExecInfo.hwnd = NULL;
    ShExecInfo.lpVerb = "open";
    ShExecInfo.lpFile = "runit.bat";
    ShExecInfo.lpParameters = NULL;
    ShExecInfo.lpDirectory = NULL;
    ShExecInfo.nShow = SW_MINIMIZE;
    ShExecInfo.hInstApp = NULL;

    ShellExecuteEx(&ShExecInfo);

    return TRUE;
    }
    } FotiosApp;


Advertisement