/* AB_GetTxt $VER 1.0 ©1995 Mads Lie Jensen Consider this as an external AREXX-funktion. If you just has the correct AmigaBase-function named inhere, you don't have to worry about ADDRESS'ing AmigaBase's AREXX-port. IMPORTANT!! AmigaBase will be automatically loaded if it's not already in memory. This is important to remember, if you have used the QUIT-command to quit the last project, which closes AB, then calling this script will load it again. Usage: rv = " [,]) Where: , is the complete path and filename to the script, put inside "". By doing it that way, you are sure that Arexx will always find the script. are a string, which makes the parameters your function in AmigaBase needs, OR it's one of the commands, in which case they'll be executed. See below. is the name of the function to call in your AmigaBase project. This one is optional. If not specified, the default function will be used. If are one of the Commands, this will have no meaning. The return-value from the script is whatever your AB-function returns, unless you used the Commands. (See below.) Tip: If you have functions in different projects, that returns the same sort of information, call them the same, and then set the default function in this script, to the function that you use most. BUT, this script supports commands! This means that you can get infor- mation on the project in AmigaBase, or interact with it. Commands have to be sent exactly as shown here. (Case sensitive!): Commands returns 1 if they where succesfull, 0 if not, except where said otherwise. %LOAD You will, as said, be able to load a new project into AB, using the normal AB filerequester. %NAME This will return the name of the current AB-project. If the project has not yet been saved, it will return an empty string. %SAVE This will save your AB-project using it's current name. If the project does not yet have a name, you will be presented for the file-requester. %SAVEAS This will present you for the Save-requester, where you can select a new name to save your file under. %QUIT This will quit the current AmigaBase-project. If it was the last window, it will also quit the program. If your project has been modified, and not saved, you will be asked if you want to save your project before quiting, or if you want to cancel. Returns 1 if the project was quittet, 0 if not. A value of -1 means that the last window was closed, and AmigaBase was quit too. %NEW This will open a new Window, to hold a new project. %PROJECT This is always specified with a name of a project. Used if you have more than one project open in AB at once, you can change betwen them, by using %PROJECT . */ /* The name of the default function to call in AB */ AB_func = '_Getname' OPTIONS RESULTS argline = arg(1) /* If a string that could be a function in Amigabase is passed as arg 2 this is used as the function to call */ IF LENGTH(arg(2)) > 0 & LEFT(ARG(2),1) = '_' THEN AB_func = arg(2) /* Check that this script is called as an external funktion */ PARSE SOURCE Calltype . /* If Amigabase is not loaded, then do it */ IF ~(SHOW('P','REXX_AB1')) THEN DO ADDRESS COMMAND 'run >NIL: AmigaBase:AmigaBase' 'WaitForPort REXX_AB1' END /* Operate on AmigaBase */ ADDRESS REXX_AB1 /* Check if it's a command issued. If not, call the function */ RESULT = '' SELECT WHEN argline = '%LOAD' THEN DO LOAD END WHEN argline = '%NAME' THEN DO STATUS FILENAME END WHEN argline = '%SAVE' THEN DO SAVE END WHEN argline = '%SAVEAS' THEN DO SAVEAS END WHEN argline = '%QUIT' THEN DO QUIT IF ~(SHOW('P','REXX_AB1')) THEN RESULT = -1 END WHEN argline = '%NEW' THEN DO NEW END WHEN LEFT(argline,8) = '%PROJECT' THEN DO SUBSTR(argline,2) END OTHERWISE DO FUNCTION AB_func argline END END IF Calltype = 'FUNCTION' THEN RETURN RESULT ELSE DO SAY RESULT RETURN 20 END