Gavin Crawford

SendOPro

SendOPro

A utility to send a file to Ovation Pro

SendOPro provides a simple way for an external program to send a file to Ovation Pro's iconbar icon. It could be used for such things as; opening an Ovation Pro document, creating a new Ovation Pro document from a text file, running a DDL file, executing an Ovation Pro script file or to convert an Impression document (or DDF file) via the TransLoader filers.

How it works

SendOPro takes the filename that was passed to it on the command line and sends it to Ovation Pro's iconbar icon using the Data transfer protocol. The file is transferred via disc using the <Wimp$Scrap> method, not using RAM transfer. Ovation Pro receives the file in the same way as if the file had been dragged to its iconbar icon.

Using SendOPro

How you run SendOpro depends upon the type of program or environment you are calling it from - it mainly depends on whether or not you are using it from a multitasking application. The different methods of using it are fully outlined below, but in general it is simply a matter of passing the file's full path name to SendOPro like so:

SendOPro filename

Note: In the previous releases of SendOPro (version 1.00) no path variables were set up to the location of SendOPro and you had to run it by including a full filepath to its file location. This has now changed as I decided it would be easier to use if some system variables were preset. As long as the SendOPro application has been seen by the filer (Filer_Booted) then the system variables will become active. This also means that single version of !SendOPro could be placed alongside the Ovation Pro transloaders or even in !Boot.Resources and be readily available whenever needed.

Ways to use SendOPro

SendOPro sets some alias *command style system variables that provides a simple way to use it from different environments, as well as setting a system variable to point to it's location to aid in running the from other programs.

Below I've listed some examples of different ways to use SendOpro depending upon where you are using it.

Note: in the following examples the file that is to be sent to Ovation Pro is referred to as 'filename' this should be replaced with a full pathname of the file (without the single quotation marks'). The path can include system variable paths,for example Boot:^.Public.Document would work fine.

  • Obey files

    From an Obey file you can use the alias *command SendOPro which will use *Run to invoke the application.

    eg: SendOPro 'filename'

  • TaskWindow

    Using from a TaskWindow is slightly different in that you are in a MultiTasking environment so calling another application using *Run will cause an error. In a TaskWindow you can use the other alias *command SendOProMT. This will run the SendOPro application from a Multi Tasking environment (hence the MT at the end of the command) as a separate WIMP task.

    eg: SendOProMT 'filename'

  • A Multi Tasking application

    An application that is registered with the WIMP can also use the alias command SendOProMT so that a separate WIMP task is started when the SendOPro application starts up.

    For example an application written in BBC BASIC could use either of the following:

    SYS"OS_CLI","SendOProMT 'filename'"
    OSCLI"SendOProMT 'filename'"
    *SendOProMT 'filename'

    If your application wanted to use the SWI Wimp_StartTask directly it could use the following:

    SYS"Wimp_StartTask","<SendOPro> 'filename'"

    Notice here the system variable '<SendOPro>' which is a short cut to the !SendOPro path location.

  • A Single Tasking BASIC file

    In the situation where you may have a simple BASIC file acting as a single tasking script file, things get a little more complicated. If you use *SendOPro (or one of the alternative OSCLI / SYS"OS_CLI" variants) then when this line is executed the SendOPro application is run, but it will replace your BASIC file in memory, so nothing else past that line will get executed. You can't use the SendOProMT multi tasking version as your BASIC script is not registered as a WIMP task so an error will occur.

    There are two ways to get around this problem. The first, is to register with the WIMP at the start of the BASIC code, then it is a simple matter of using the SendOProMT variant as described above under "A Multi Tasking application"

    To do this it is a simple matter of adding the following at the start of your code:

    SYS"Wimp_Initialise",310,&4b534154,"temp",0

    then at the end of your code add the following line, which does the job of de-registering:

    SYS"Wimp_CloseDown":SYS"OS_Exit"

    The second way, which involves less work, but is more limited, is to use the *Filer_Run command to start SendOPro. *Filer_Run has the advantage that it is queued-up and will only be activated AFTER the BASIC script has completed and quit, so it doesn't suffer from replacing the original BASIC file in memory. There are however, a few disadvantages. As it is queued and run afterwards it is only suitable when the BASIC file needs to issue one SendOPro command, and when it doesn't matter when that happens. In other words, the timing of events of other actions in the code doesn't matter. The other problem with *Filer_Run is that is doesn't allow a command tail string to be passed to the application, which rather defeats what SendOPro is doing. So to get around this, if SendOPro is invoked without a command line string being passed to it, it will look to use a special system variable of <SendOPro$String>. So what that all means, is to use it with *Filer_Run you would do the following:

    *Set SendOPro$String 'filename'
    *Filer_Run <SendOPro>

    or using SWI calls:

    SYS"OS_CLI","Set SendOPro$String 'filename'"
    SYS"OS_CLI","Filer_Run <SendOPro>"

    Afterwards SendOPro will unset the system variable so it is cleared before SendOPro is run again.

To re-cap, and give an overview there are the following system variables set:
*SendOPro - an alias to *Run the application
*SendOProMT - an alias to *WimpTask the application from a multi-tasking environment
<SendOPro> - a system variable that points to the application filepath
<SendOPro$String> - a system variable you set to pass the 'filename' string when using *Filer_Run

 

Limitations

Firstly, the Data transfer protocol message is only passed to Ovation Pro's iconbar icon, not to any open document windows. So specifying which document view receives the file is not possible.

Secondly, SendOPro expects Ovation Pro to already be running on the iconbar. It will not run Ovation Pro if it is not.

Why use SendOPro

File types that are normally associated with Ovation Pro, such as Ovation Pro documents, DDL files or Ovation Pro Script files could be Filer_Run, but if the users is holding down the SHIFT key then the file will be intercepted by a text editor. SendOPro stops that from happening by sending the file directly to Ovation Pro's icon bar. Also SendOPro allows other file types to be sent such as text files.

Runs on RISC OS
Buy Me a Coffee at ko-fi.com

Current version: 1.01   (07-Jan-21)     Change log