home *** CD-ROM | disk | FTP | other *** search
- /* $VER: SendtoBME.rexx 2.0 (19.07.96)
- Copyright 1996 SoftLogik Publishing Corporation
- May not be distributed without SoftLogik Publishing Corporation's express written permission */
-
- OPTIONS RESULTS
- TRACE OFF
-
- /* Make sure rexx support is opened */
- IF ~SHOW('L','rexxsupport.library') THEN
- CALL ADDLIB('rexxsupport.library',0,-30)
-
- ADDRESS 'PAGESTREAM'
-
- /* Check and see if one picture is selected */
- getobject type objtype
- if objtype~=12 then do
- ADDRESS 'PAGESTREAM'
- allocarexxrequester '"Send to Editor Error!"' 368 59
- reqhandle=result
- addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
- Exithandle=result
- addarexxgadget reqhandle TEXT 8 10 352 border none string "'One picture must be selected to edit in BME.'"
- addarexxgadget reqhandle TEXT 8 20 352 border none string "'Select only one picture and try again.'"
- doarexxrequester reqhandle
- freearexxrequester reqhandle
- EXIT
- end
-
- /* Stop the user from messing things up while away */
- 'lockinterface true'
-
- /* Find out if it's internal or external */
- 'getpicture fileinfo fstem'
-
- /* Append PageStream3: if not a full path */
- if pos(':',fstem.file)=0 then fstem.file='PageStream3:'||fstem.file
-
- /* If imported from ram file, fix the space problem with ram disk */
- if left(fstem.file,9)='Ram Disk:' then fstem.file='Ram:'||right(fstem.file,length(fstem.file)-9)
- filepath=fstem.file
- if pos('/',filepath)~=0 then filename=right(filepath,length(filepath)-lastpos('/',filepath))
- else filename=right(filepath,length(filepath)-lastpos(':',filepath))
-
- /* If untitled, then give it a name */
- if fstem.file='PageStream3:' then filename='UntitledPicture'
-
- /* Export the picture to a temp file if internal */
- if fstem.mode=INTERNAL then do
- filepath='t:'filename
- 'exportgraphic file 'filepath' filter iffilbm status force'
- end
-
- /* Get the start date and time info */
- sTemp = statef(filepath)
- Parse VAR sTemp dum dum dum dum iSDays iSMins iSTicks .
-
- 'refresh wait'
-
- /* Set the default BME path */
- bmepath='PageStream3:BME'
- preffile='PageStream3:SendtoBME.prefs'
-
- /* If BME doesn't exist in the default path, check SendtoBME.prefs */
- if ~exists(bmepath) then do
- if open(.ifile, preffile, 'R') then do
- bmepath=readln(.ifile)
- call close(.ifile)
- askuser='no'
- end
- else do
- askuser='yes'
- end
- /* If BME doesn't exist in the set pref path, ask the user where it is */
- if ~exists(bmepath) | askuser='yes' then do
- getfile TITLE "'Please locate BME'" load path "'PageStream3:'" file BME posbutton 'Ok' negbutton 'Cancel'
- if RC=10 then signal cancel
- bmepath=result
- if open(.ifile, preffile, 'W') then do
- call writeln(.ifile, bmepath)
- call close(.ifile)
- end
- end
- end
-
-
- /* Run BME */
- ADDRESS COMMAND
- 'run >nil:' bmepath
-
- /* Wait until the ARexx port shows up */
- do 20
- if ~show(P, 'BME') then call delay(50)
- end
-
- /* If the ARexx port didn't show up, alert the user and exit */
- if ~show(P, 'BME') then do
- ADDRESS 'PAGESTREAM'
- allocarexxrequester '"Send to Editor Error!"' 368 59
- reqhandle=result
- addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
- Exithandle=result
- addarexxgadget reqhandle TEXT 8 10 352 border none string "'BME could not be started.'"
- doarexxrequester reqhandle
- freearexxrequester reqhandle
- 'refresh continue'
- 'lockinterface false'
- EXIT
- end
-
- ADDRESS 'BME'
- 'screentofront'
- 'open 'filepath
-
- /* Wait for the user to finish in BME */
- do forever
- if show(P, 'BME') then do
- 'getpicture 'filepath
- if rc=0 then call delay(50)
- else signal update
- end
- else signal update
- end
-
-
- /* Update PageStream and exit */
- UPDATE:
- ADDRESS 'PAGESTREAM'
- 'screentofront'
- 'revealwindow current'
-
- /* If it's external, we don't have to do anything */
- if fstem.mode=EXTERNAL then signal cancel
-
- /* Get the end date and time info */
- sTemp = statef(filepath)
- Parse VAR sTemp dum dum dum dum iEDays iEMins iETicks .
-
- /* If the picture hasn't changed, don't update pgs */
- if iSDays=iEDays & iSMins=iEMins & iSTicks=iETicks then signal cancel
-
- 'editpicture external file 'filepath
- 'editpicture internal'
- signal cancel
-
-
- CANCEL:
- ADDRESS 'PAGESTREAM'
- 'refresh continue'
- 'lockinterface false'
- ADDRESS COMMAND
- /*'delete t:'filename' >NIL:'*/
- 'delete t:'filename
- EXIT
-
-
- DOALERT:
- parse arg astring
- /* Display an alert requester */
- allocarexxrequester '"Script Alert"' 334 55
- hAlertReq=result
- addarexxgadget hAlertReq TEXT 8 12 268 border none string '"'astring'"'
- addarexxgadget hAlertReq EXIT 252 38 70 label "_Exit"
- doarexxrequester hAlertReq
- freearexxrequester hAlertReq
- RETURN
-