Jump to content

Recommended Posts

Posted (edited)

This is all that's necessary to make JdeB's idea found here work.

A compiled version can be found http://www.autoitscript.com/fileman/users/Valik/autoit3.exe

This only works with an editor capable of grabbing the data, such as SciTE. The line I used to test with in SciTE was:

autoit3dir=C:\Path\To\Modified\File
command.go.$(au3)=$(autoit3dir)\autoit3.exe /ErrorStdOut "$(FilePath)"

In globaldata.h, globaldata.cpp, add variable:

bool g_bStdOut;

In Application.cpp:

Initialize g_bStdOut to false in AutoIt_App::AutoIt_App()

In AutoIt_App::ParseCmdLine() after the if block looking for a /c request, add this:

else if (stricmp("/ErrorStdOut", szTemp) == 0)
{
    g_bStdOut = true;
    if (nNumParams == 1)
    {
        pvTemp->ArraySubscriptClear();                // Reset the subscript
        pvTemp->ArraySubscriptSetNext(1);            // Array is 1 element (num params)
        pvTemp->ArrayDim();                            // Dimension array

        pvTemp->ArraySubscriptClear();                // Reset the subscript 
        pvTemp->ArraySubscriptSetNext(0);            // Set subscript we want to access
        pvElement = pvTemp->ArrayGetRef();            // Get reference to the element
        *pvElement = 0;                                // $CmdLines[0] = 0
        return;
    }
    --nNumParams;    // Decrement because we strip the /ErrorStdOut from the command line
    g_oCmdLine.GetNextParam(szTemp);    // skip to the next item
}

Finally in script.cpp, modify these:

In FatalError(int iErr, int nCol):

if (g_bStdOut)
    printf("%s (%d) : ==> %s: \n%s \n%s\n",szInclude, nAutScriptLine, szText, szScriptLine, szOutput2 );
else
    MessageBox(g_hWnd, szOutput, szTitle, MB_IConstop | MB_OK | MB_SYSTEMMODAL | MB_SETFOREGROUND);

And in FatalError(int iErr, const char *szText2):

if (g_bStdOut)
    printf("%s (%d) : ==> %s: \n%s \n%s\n",szInclude, nAutScriptLine, szText, szScriptLine, szText2);
else
    MessageBox(g_hWnd, szOutput, szTitle, MB_IConstop | MB_OK | MB_SYSTEMMODAL | MB_SETFOREGROUND);
Edited by Valik
Posted

Forgot to mention, that code works for both versions of ParseCmdLine() so it needs to go into both.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...