base:SendRexxCommand()
Posted: 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.
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