home *** CD-ROM | disk | FTP | other *** search
- /* $VER: SendtoBME.rexx 2.0 (28.06.95)
- Copyright 1995 Soft-Logik Publishing Corporation
- May not be distributed without Soft-Logik 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'
-
- /* Export the picture to a temp file if internal */
- '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'
- if fstem.mode=INTERNAL then do
- filepath='t:'filename
- 'exportgraphic file 'filepath' filter iffilbm status force'
- end
-
- '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'
- 'editpicture internal'
- 'editpicture external file 'filepath
- if fstem.mode=INTERNAL then 'editpicture internal'
- else 'editpicture external file 'fstem.file
- signal cancel
-
-
-
- CANCEL:
- ADDRESS 'PAGESTREAM'
- 'refresh continue'
- 'lockinterface false'
- ADDRESS COMMAND
- /*'delete t:'filename' >NIL:'*/
- 'delete t:'filename
- EXIT
-