Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
130 user(s) are online (126 user(s) are browsing Forums)

Members: 0
Guests: 130

more...

Support us!

Headlines

 
  Register To Post  

SystemTags()
Just popping in
Just popping in


See User information
I am trying to execute a program with SystemTags() but I am getting mixed results. Sometimes I need an output window opened, other times not. Sometimes it will have command line args, other times not. And has to run asynch, but can't use SYS_Asynch,TRUE, tag.

If I can specify my own window location/size/title would be a plus.

The command line args are the biggest problem. WBRun works great when none.

Simple examples:
C:List RAM:
Needs an output window opened. User has to close it. Run asynch.

SYS:Utilities/Notepad
No output needed. Run asynch.

SYS:Utilities/Notepad textfile.txt
No output needed. Run asynch.

REXX:MyScript.rexx (args possible)
Output window depends on script. Run asynch.

Go to top
Re: SystemTags()
Home away from home
Home away from home


See User information
@mritter0

Why can't you use SYS_Async,TRUE, ?

Using WBrun is completely the wrong thing to do if all you want is it to run async.

If you want a conaole window of specific size then open one with IDOS->Open() and use the file handle as the Output varibale,

I just swictch my amigas off but might be able to post some example code tomorrow...



Go to top
Re: SystemTags()
Just popping in
Just popping in


See User information
@mritter0

Also, why would you want to run c:List ?

You're writing a real program, do it yourself, there's even example
code with IDOS->ExamineDir(), then you can format it and filter it
and do all that other neat stuff too.

A program that just runs other programs is just a "toolbar" basically.


Go to top
Re: SystemTags()
Just can't stay away
Just can't stay away


See User information

I think i wants to "clone" 'Workbench->Execute command...' option on his personal program/application.

So I open (Amiga+E) it and can "write" whatever I want in stringgadget (C:list; Notepad; Notepad myfile.txt;....) and execute it.

Go to top
Re: SystemTags()
Home away from home
Home away from home


See User information
@broadblues

The thing about WBrun, is that any file (.txt, .jpeg, .avi) that is started with that app, will use DefIcons, to find the default tool to open that file.

You can't just open the icon, and look at default tool, as that assume that all def icons has a default tool, they don't, if default tool is not found the default tool of def icons group above is used, as its organized in def icons prefs.

So unless you wont to invent you're on mime type database, it makes perfect sense to use WBRun.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: SystemTags()
Home away from home
Home away from home


See User information
@LiveForIt

No, not in this case,

1. it's not what mritter is asking for, he clearly wants to run commands from shel asynchronously, not start programs or 'open' files as if they were run from workbench.

2. Even if he did want to do the above he should not be calling SsystemTags() rather he should use OpenWorkbenchObject() WBrun is for scripts and command line usage and is in fact just a thin wrapper for OpenWorkbenchObject().






Edited by broadblues on 2016/11/6 18:07:25
Go to top
Re: SystemTags()
Home away from home
Home away from home


See User information
@mritter

This is not quite what you want but should help you get started.

The following is my function from SketchBlock fior launching arbitrary scripts. The first section is the part of interest is verifies the script is not intended as Rexx command and executes it via SystemTags() (that is indicated by an leading @ symbol which is an entirely custom thing for the sketchblock settings file, so ignore that bit).

Note that it duplicates the current Input() and Output() streams because SYS_Async,TRUE, means they will be closed.


void Executerexx(STRPTR cmd)
{
    
    
LONG rc,rc2;
    
STRPTR result NULL;
    
STRPTR buffer Dupstr(cmd,-1);
    
STRPTR p buffer;
    
STRPTR q p;
    if(
buffer)
    {
        while(
q)
        {
            
strchr(p,';');
            if(
q)
            {
                *
q++ = '\\0';
            }
            if(*
== '@')
            {
                
p++;
                if(*
!= '\\0')
                {
                    
BPTR in IDOS->DupFileHandle(IDOS->Input());
                    
BPTR out IDOS->DupFileHandle(IDOS->Output());
                    if(
IDOS->SystemTags((CONST_STRPTR)p,
                                                
SYS_Asynch,TRUE,
                                                
SYS_Input,in,
                                                
SYS_Output,out,
                                                
TAG_DONE))
                    {
                        
/* we failed so clean up dupped handles */
                        
IDOS->Close(in);
                        
IDOS->Close(out);
                    }
                    if(
App->ap_MacroPython)
                    {
                        
WriteApplicationMacroRaw(App,"\\n# ");
                        
WriteApplicationMacroRaw(App,p);
                        
WriteApplicationMacroRaw(App," \\n\\n");
                    }
                    else
                    {
                        
WriteApplicationMacroRaw(App,"\\n/* ");
                        
WriteApplicationMacroRaw(App,p);
                        
WriteApplicationMacroRaw(App," */\\n\\n");
                    }
                }
                
            }
            else
            {
                
IIntuition->IDoMethod(arexxHost,AM_EXECUTE,p,SKETCHBLOCKPORT,&rc,&rc2,&result,NULL);
                if(
result)
                {
                    
#if REXXDEBUGLVL > 0
                        
IDOS->Printf("result %s\\n",result);
                    
#endif
                
}
                if((
strchr(p,':')))
                {
                    if(
App->ap_MacroPython)
                    {
                        
WriteApplicationMacroRaw(App,"\\n# ");
                        
WriteApplicationMacroRaw(App,p);
                        
WriteApplicationMacroRaw(App," \\n\\n");
                    }
                    else
                    {
                        
WriteApplicationMacroRaw(App,"\\n/* ");
                        
WriteApplicationMacroRaw(App,p);
                        
WriteApplicationMacroRaw(App," */\\n\\n");
                    }
                }
            }
            
q;
        }    
        
Freemem(buffer);
    }
}


because the above Dups the Input/Output streams the if the scripts write to stsout then a the main prgrams console will open (if not open) and the output will appear there.

Sounds like you need a dedicated console for each laucnh script (like Workbench->Menu->Workbench->Execute command...)

So instead of duplicating the current input / output do

BPTR in = IDOS->Open("CON:x/y/width/height/Ouput Window/AUTO/CLOSE/WAIT",MODE_NEWFILE);

BPTR out = ZERO;

and use those in place of the in and out in the above code.

See con-handler.doc and the SystemTagList section of the DOS autodoc.


[edit]
The site code removed my \\ scapes from the code.

PS the outerloop that checks for *q == ';' is to allow execute of semi colon delimitered "one line scripts" and so may or may not be of use to you....



Edited by broadblues on 2016/11/6 18:23:04
Go to top
Re: SystemTags()
Just popping in
Just popping in


See User information
LiveForIt, I use WBRun for exactly the reason you said. Works great.

Sorry for my lack of code example. I was posting from work.


EDIT:

Actually, WBRun does do what I need.

Go to top
Re: SystemTags()
Home away from home
Home away from home


See User information
@mritter0

Quote:

Actually, WBRun does do what I need.


In that case your question was completely at odds with your needs and as you are running from a program you should use IWorkbench->OpenWorkbenchObject()


And you cannot pass shell arguments to it

ie

WBRun C:List ram: will list C: not ram:



Go to top
Re: SystemTags()
Just popping in
Just popping in


See User information
WBRun is good for about 80% of what I tested. IWorkbench->OpenWorkbenchObject() is what I am going with.

So frustrating when one thing works perfectly, but the next does not or looks like it did and fools you.

Thanks again, Andy.

Workbench Explorer - A better way to browse drawers
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project