/* demo.urexx */

/* tell AREXX that commands are to be sent to uedit */
address 'URexx'

/* tell uedit to sent result strings back */
options results

/* tell uedit to load 'demofile' */
loadfile 'demofile'

/* try some cursor movement commands */
down ; down ; down ; down
right ; right ; right ; right
up ; up ; up ; up
left ; left ; left ; left


/* find PART 2 */
searchfor 'PART 2'
if result = '' then 
do 
	ask "couldn't find PART 2"
	exit 
end

ask 'Delete these linesn?'

/* if requested, cut the next 3 lines */
if result = 'YES'
then do
	down
	sinvert
	down;down;down;down
	einvert
	cut
end

/* find PART 3 */
searchfor 'PART 3'
if result = '' then 
do 
	ask "couldn't find PART 3"
	exit 
end

/* add some new text to the file */
down
text 'Here is some new text' '0a'x
text 'Just to show we can both add' '0a'x
text 'and delete some lines'

searchfor 'THE END'

message 'Thats all folks'
