Welcome, Guest. Please login or register.

Author Topic: Running workbench programs from another program  (Read 3241 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline TrickyTopic starter

  • Full Member
  • ***
  • Join Date: Aug 2005
  • Posts: 127
    • Show only replies by Tricky
    • http://www.jigsawlounge.co.uk/kungfu/
Running workbench programs from another program
« on: May 29, 2006, 09:48:51 PM »
Does anybody know, if it is possible to run a workbench program from another program, as if you had double clicked on its own icon?  I know there is the exec function of dos.library... is there an equivalent for Workbench programs?

Also is there a function to open a directory view window on the Workbench screen as if you had double clicked on the drawer icon?
[A1200/060, 32Mb fast RAM, 1.2Gb HDD, 19\\" Acer TFT Monitor]
I never write anything that won\\\'t run on a stock A1200.  That\\\'s the Jigsaw Lounge Guarantee.
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Running workbench programs from another program
« Reply #1 on: May 29, 2006, 09:51:44 PM »
Which OS version? In 3.5 and 3.9 you have the WBRun command, which will simulate clicking the icon. You could call that programme from your app with the path to the programme you want to launch as an argument.

Obviously this will only work on 3.5/3.9 :roll:

--
moto

--EDIT
WBRun will open a drawer also.
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline amigagr

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 1454
    • Show only replies by amigagr
    • http://www.amigahellas.gr
Re: Running workbench programs from another program
« Reply #2 on: May 29, 2006, 09:56:08 PM »
you can run any prog from a shell or alternative with iconx.
open a text editor and type in the path and the prog.
for example:
work:graphics/dpaint/dpaint
save the text file with any name you like and make a project icon with exact the same name. in the default tool of the icon set the iconx command. maybe it will need to turn the script attribute on too, but i'm not sure on this.
A3040/25 AmigaOS 3.9
A1260BPPC AmigaOS 3.9/4.0
Sam440ep AmigaOS 4.1.2
PegasosII/G3 AmigaOS 4.1.2/MorphOS 2.7/Debian 5.0.7/SUSE 11.1
MacMini/G4 1.5 MorphOS 2.7/OSX 10.5.8
Long Live Amiga

If i am going to have bugs on my system,
at least let me keep the latest versions.
Neil Bothwick
 

Offline TrickyTopic starter

  • Full Member
  • ***
  • Join Date: Aug 2005
  • Posts: 127
    • Show only replies by Tricky
    • http://www.jigsawlounge.co.uk/kungfu/
Re: Running workbench programs from another program
« Reply #3 on: May 29, 2006, 09:57:16 PM »
This is exactly what I need... only for WB3.1...

I wonder if the command will run on 3.1, even though it's supplied only with 3.5+.

@amije
I know of IconX, but surely that is for running CLI commands from Workbench, not the other way round?  I want to call up a Workbench program from within another program (not a script).
[A1200/060, 32Mb fast RAM, 1.2Gb HDD, 19\\" Acer TFT Monitor]
I never write anything that won\\\'t run on a stock A1200.  That\\\'s the Jigsaw Lounge Guarantee.
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Running workbench programs from another program
« Reply #4 on: May 29, 2006, 10:00:09 PM »
I think the WBRun supplied with OS3.5+ requires workbench.library v45+ - i.e. not 3.1.

However, I have just found this on Aminet, which might work. It also includes source code so you could implement the function directly in to your code.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline TrickyTopic starter

  • Full Member
  • ***
  • Join Date: Aug 2005
  • Posts: 127
    • Show only replies by Tricky
    • http://www.jigsawlounge.co.uk/kungfu/
Re: Running workbench programs from another program
« Reply #5 on: May 29, 2006, 10:02:20 PM »
@motorollin
Oh!  Now that looks exactly what I want...
Shame the course is in C and not ASM... I can't do C.

also, never heard of parm.library.  And I should be more aware of Aminet in future!
[A1200/060, 32Mb fast RAM, 1.2Gb HDD, 19\\" Acer TFT Monitor]
I never write anything that won\\\'t run on a stock A1200.  That\\\'s the Jigsaw Lounge Guarantee.
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Running workbench programs from another program
« Reply #6 on: May 29, 2006, 10:07:39 PM »
Well if the command works, just call the command from your application instead of integrating the function in to your source. Not as clean as it would require the presence of the command, but it would work.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline TrickyTopic starter

  • Full Member
  • ***
  • Join Date: Aug 2005
  • Posts: 127
    • Show only replies by Tricky
    • http://www.jigsawlounge.co.uk/kungfu/
Re: Running workbench programs from another program
« Reply #7 on: May 29, 2006, 10:17:19 PM »
@moto
I shall work it out.  C isn't so hard to understand, I just don't have a compiler for it!

Anyways, the program I intend to make is very simple.  The theory goes as thus:
You create a project icon.  Its default tool is my program.  It also has a tooltype that contains a path to the other program you want to run.

Add a companion program that simply makes such an icon for you (that you can add to your custom workbench menu), and Hey ho - windows-style shortcuts!  Without mucking about with scripts.
[A1200/060, 32Mb fast RAM, 1.2Gb HDD, 19\\" Acer TFT Monitor]
I never write anything that won\\\'t run on a stock A1200.  That\\\'s the Jigsaw Lounge Guarantee.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Running workbench programs from another program
« Reply #8 on: May 29, 2006, 10:44:56 PM »
wbstart.library is the "industry standard" for lauching apps in wb way.

ToolManagerExt.lha (wbstart.library is included there)

stefanb_src.lha (includes full source code to wbstart.library, including dev information, also for assembler)

Example code:
Code: [Select]

        include "libraries/WBstart.i"

_LVOCloseLibrary        EQU     -414
_LVOOpenLibrary         EQU     -552
_LVOWBStartTagList      EQU     -36

Main:
        move.l  4.w,a6
        lea     .wbstartname(pc),a1
        moveq   #2,d0
        jsr     _LVOOpenLibrary(a6)
        tst.l   d0
        beq     .nowbstart
        move.l  d0,a6

        clr.l   -(sp) ; TAG_END
        pea     .wbprogname(pc)
        move.l  #WBStart_Name,-(sp)
        move.l  sp,a0
        jsr     _LVOWBStartTagList(a6)
        lea     3*4(sp),sp

        move.l  a6,a1
        move.l  4.w,a6
        jsr     _LVOCloseLibrary(a6)
.nowbstart:
        moveq   #0,d0
        rts

.wbstartname:
        dc.b    "wbstart.library",0

.wbprogname:
        dc.b    "SYS:Utilities/MultiView",0

Ahh, m68k asm, my old love. Nice to see I haven't lost the touch. ;-)
 

Offline TrickyTopic starter

  • Full Member
  • ***
  • Join Date: Aug 2005
  • Posts: 127
    • Show only replies by Tricky
    • http://www.jigsawlounge.co.uk/kungfu/
Re: Running workbench programs from another program
« Reply #9 on: May 29, 2006, 11:01:59 PM »
@Piru
Ohhh...

now that is EXACTLY exactly what I wanted.  Thank you so much!

Is the WBstart include file in the source archive?  Only that's a bit too big to put on a floppy to get onto my Amiga... how primitive I am!

Must find Linux app that extracts lha...

EDIT: now i come to think of it, I might already have it in my includes folder.
[A1200/060, 32Mb fast RAM, 1.2Gb HDD, 19\\" Acer TFT Monitor]
I never write anything that won\\\'t run on a stock A1200.  That\\\'s the Jigsaw Lounge Guarantee.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Running workbench programs from another program
« Reply #10 on: May 29, 2006, 11:07:59 PM »
You'll need these files from the archive:
Code: [Select]

WBStart/dev/wbstart.doc
WBStart/dev/asm/Libraries/WBstart.I
WBStart/dev/asm/LVO/WBStart_Lib.I


Quote
Must find Linux app that extracts lha...

well, linux does have lha. :-)

Quote
EDIT: now i come to think of it, I might already have it in my includes folder.

I suggest you still grab the wbstart.doc, it's the documentation about the library.