Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
75 user(s) are online (55 user(s) are browsing Forums)

Members: 0
Guests: 75

more...

Support us!

Headlines

Report message:*
 

Re: run external programm the same when main one running from shell and icon

Subject: Re: run external programm the same when main one running from shell and icon
by salass00 on 2019/2/27 7:21:32

@kas1e

From AutoRun commodity:

static void execute_command(CONST_STRPTR command) {
    
struct Library *workbenchbase;
    
struct WorkbenchIFace *iworkbench;
    
BPTR path_list ZERO;
    
BPTR input_file ZERO;
    
BPTR output_file ZERO;
    
int32 error = -1;

    
workbenchbase IExec->OpenLibrary("workbench.library"53);
    
iworkbench = (struct WorkbenchIFace *)IExec->GetInterface(workbenchbase"main"1NULL);

    if (
iworkbench != NULL) {
        
iworkbench->WorkbenchControl(NULL,
            
WBCTRLA_DuplicateSearchPath, &path_list,
            
TAG_END);
    }

    
input_file IDOS->Open("NIL:"MODE_OLDFILE);
    
output_file IDOS->Open("NIL:"MODE_OLDFILE);

    if (
input_file && output_file) {
        
error IDOS->SystemTags(command,
            
NP_Name,    "AutoRun Script",
            
NP_Path,    path_list,
            
SYS_AsynchTRUE,
            
SYS_Input,  input_file,
            
SYS_Outputoutput_file,
            
SYS_Error,  ZERO,
            
TAG_END);
    }

    if (
error) {
        
IDOS->Close(input_file);
        
IDOS->Close(output_file);
    }

    if (
error && iworkbench != NULL) {
        
iworkbench->WorkbenchControl(NULL,
            
WBCTRLA_FreeSearchPathpath_list,
            
TAG_END);
    }

    
IExec->DropInterface((struct Interface *)iworkbench);
    
IExec->CloseLibrary(workbenchbase);
}



Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project