base:SendRexxCommand()

You can post your code snippets here for others to use and learn from

base:SendRexxCommand()

Postby djrikki » Wed Apr 15, 2015 11:00 pm

This function allows you to send messages to either Ringhio or the Workbench.

When sending to Ringhio it will 'show the message' when sending to Workbench it will open a window specified by the name 'message'.

There is some support going on here for Classic AmigaOS, AROS and MorphOS. I use both the base {} and the Application {} Array in all my projects.

Code: Select all
Global base
base = {}
application.name = "Your App"
application.platform = GetVersion().platform
Local t  = GetFileAttributes("PROGDIR:" .. application.name)
application.path = PathPart(t.path)

If application.platform = "MorphOS"
    systempartition = "MOSSYS:"
Else
    systempartition = "SYS:"
EndIf

;; base:SendRexxCommand(message,workbench)
; Send a Rexx Message to the Workbench or Ringhio
Function base:SendRexxCommand(message,workbench)
    Local res$
    ExitOnError(False)
   If workbench = False
       If application.platform = "AmigaOS4"
          ; configure this two lines below to your application
          res$ = SendRexxCommand("RINGHIO", "'REGISTERAPP APP=" .. application.name .. "'")
            If Exists(application.path .. "resources/" .. application.name .. "_ringhio.png") = True
            res$ = SendRexxCommand("RINGHIO", "'RINGHIO APP=" .. application.name .. " CLOSEONDC SCREEN=\"FRONT\" IMG=" .. application.path .. "resources/" .. application.name .. "_ringhio.png\" TITLE=\"" .. application.name .. "\" IMGVALIGN=1 TEXT=" .. message .. "'")
          Else
            res$ = SendRexxCommand("RINGHIO", "'RINGHIO APP=" .. application.name .. " CLOSEONDC SCREEN=\"FRONT\" IMG=" .. systempartition .. "Prefs/Presets/Ringhio/impronta_32.png TITLE=\"" .. application.name .. "\" IMGVALIGN=1 TEXT=" .. message .. "'")
          EndIf
       EndIf
   Else
      res$ = SendRexxCommand("WORKBENCH", "WINDOW '\"" .. message .. "\"' OPEN")           
    EndIf
    ExitOnError(True)
   
    Return (res$)
EndFunction
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
 
Posts: 645
Joined: Wed Apr 06, 2011 12:26 am

Re: base:SendRexxCommand()

Postby djrikki » Wed Apr 15, 2015 11:33 pm

Hmm, cannot edit first post now.

In addition the variable 'systempartition' should have global scope, so the first line should read:

Code: Select all
Global base, systempartition
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
 
Posts: 645
Joined: Wed Apr 06, 2011 12:26 am


Return to Code snippets area

Who is online

Users browsing this forum: No registered users and 1 guest

cron