Click Here
home features news forums classifieds faqs links search
6155 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
22 crawler(s) on-line.
 95 guest(s) on-line.
 0 member(s) on-line.



You are an anonymous user.
Register Now!

/  Forum Index
   /  Classic Amiga Software
      /  Can an RTF export script be written for WordWorth?
Register To Post

PosterThread
Hypex 
Can an RTF export script be written for WordWorth?
Posted on 9-Mar-2013 4:03:57
#1 ]
Elite Member
Joined: 6-May-2007
Posts: 11351
From: Greensborough, Australia

I've been working on this a little while. just getting back to it, and I don't think it can be done!

What I'm trying to do is something simple. Write an Arexx macro for WW7 to export the current document as an RTF file. I want it to be saved on the RAM Disk with an .rtf extension and this is where I get stuck.

Out of all the 142 ARexx commands, none I see can give something simple like the current file name. Or at least I didn't see it in the list. Also there is no mentiion of any preset WW variables. They provide custom ARexx support and don't include something as simple as preset variables or commands to get info about the current document?

The only way I can see is for the script to bring up a file requester for the file I want so I can select it but this goes against the point and doesn't automate it.

So, export the current documemt to the RAM Disk as an RTF file, Can WordWorth Arexx do this?

Last edited by Hypex on 10-Jul-2013 at 06:28 AM.

 Status: Offline
Profile     Report this post  
Darek 
Re: Can an RTF export script be written for WordWorth?
Posted on 9-Mar-2013 9:05:41
#2 ]
Member
Joined: 10-Apr-2004
Posts: 84
From: Poland

@Hypex

As I see WW7 guide, there is ARexx command SAVEAS:

SAVEAS (ASCII|RTF|WORDPERFECT|TEMPLATE/S,NAME/K)
Saves the current project to the specified filename.

* The filetype is optional, if ommited the file will
be saved in normal Wordworth format.

* NAME specifies the filename for the project. If no
name is provided, the file requester will be
displayed for the user to select a filename.


It looks like that saving as an RTF file is a piece of cake there...

_________________
Copyright (c) by Darek A.D. 2017

 Status: Offline
Profile     Report this post  
Hypex 
Re: Can an RTF export script be written for WordWorth?
Posted on 9-Mar-2013 14:22:26
#3 ]
Elite Member
Joined: 6-May-2007
Posts: 11351
From: Greensborough, Australia

@Darek

Yes, that's the command I was hoping to use, but then what name do I specify? I need the file name so I can modify it and give it to SaveAs. I don't know how to get the file name for the document.

Otherwise my options are to overwrite the current file as RTF or let it bring up a file requester asking for a name. And I don't want that, obviously.

 Status: Offline
Profile     Report this post  
broadblues 
Re: Can an RTF export script be written for WordWorth?
Posted on 9-Mar-2013 15:00:20
#4 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4456
From: Portsmouth England

@Hypex

I'm not sure that you can. Wordthworths arexx command set is frustratingly 'almost'. Another example you acn PRINT and can change the print optyions, but you can't setup the postscript print options, and choose what file to printofile too.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Darek 
Re: Can an RTF export script be written for WordWorth?
Posted on 9-Mar-2013 15:39:34
#5 ]
Member
Joined: 10-Apr-2004
Posts: 84
From: Poland

@Hypex

Quote:
what name do I specify? I need the file name so I can modify it and give it to SaveAs. I don't know how to get the file name for the document.


Just ideas...

...what about opening just blank WW document with given name there?

... or what about opening the default WW document, then save it under specified name as first step, and continue on that document later...?

Last edited by Darek on 09-Mar-2013 at 03:45 PM.

_________________
Copyright (c) by Darek A.D. 2017

 Status: Offline
Profile     Report this post  
ara 
Re: Can an RTF export script be written for WordWorth?
Posted on 9-Mar-2013 19:43:21
#6 ]
Regular Member
Joined: 11-Jan-2006
Posts: 138
From: Unknown

@Hypex

This would be a really bad hack, but would it be possible to get the filename from the window title? I don't know whether this is possible in ARexx (or whether you need to write a separate C program for that).

 Status: Offline
Profile     Report this post  
mr_homm 
Re: Can an RTF export script be written for WordWorth?
Posted on 10-Mar-2013 6:11:31
#7 ]
Regular Member
Joined: 21-Mar-2003
Posts: 180
From: Seattle

@Hypex
I've got three. "The first is for single files, and it came with WW5. The other two are batch converters from WW7. The third one "many-non-rtf to rtf.rexx" is a slight modification that I made to the original script, so that you can use in on a directory that contains a mixture of rtf and non-rtf files. All the files in the directory have to be readable by WW, but it skips .info and .rtf and .rtf.bak files.

Here's the first one, for single files:

/* Convert_To_RTF

Converts a document to RTF format

Digita ARexx Script for Wordworth 5
Copyright ©1996, Digita International Ltd.

Created: 19 January 1996
Author: MJ
*/


OPTIONS RESULTS


RequestFile TITLE "Select File to Convert to RTF"
File = Result

If (RC > 0) THEN
Exit

New
Address Value Result

Open FILENAME File

File = File || ".RTF"

SaveAs RTF NAME File
Close FORCE


Here's the second one for batch converting. It does not check whether a file is already RTF


/* Many_To_RTF

Converts a drawer full of documents to RTF format.

Digita ARexx Script for Wordworth 7
Copyright ©1998, Digita International Ltd.

Created: 31 May 1996
Author: MJ
*/


OPTIONS RESULTS


RequestFile TITLE "Select drawer..." DRAWERSONLY
Drawer = Result

If (RC > 0) THEN
Exit

OldPort = Address()

Address Command 'List >RAM:WwTemp 'Drawer' NOHEAD PAT=~(#?.info) LFORMAT="%s%s" FILES'
IF Open('listfile', 'RAM:WwTemp', R) THEN DO
DO Until EOF('listfile')
File = ReadLn('listfile')

If File = '' THEN
Break

New
Address Value Result

Open FILENAME File

File = File || ".RTF"

SaveAs RTF NAME File
Close FORCE

Address Value OldPort
END
Call Close('listfile')

END

Address Command 'Delete >NIL: RAM:WwTemp'


Here is the third one, which converts a batch of files and does ignore files that are already RTF



Converts a drawer full of documents to RTF format,
ng falies that are already RTF.

Digita ARexx Script for Wordworth 7
Copyright ©1998, Digita International Ltd.

Created: 31 May 1996
Author: MJ
*/


OPTIONS RESULTS


RequestFile TITLE "Select drawer..." DRAWERSONLY
Drawer = Result

If (RC > 0) THEN
Exit

OldPort = Address()

Address Command 'List >RAM:WwTemp 'Drawer' NOHEAD PAT=~(#?.info|#?.RTF|#?.RTF.BAK) LFORMAT="%sIF Open('listfile', 'RAM:WwTemp', R) THEN DO
DO Until EOF('listfile')
File = ReadLn('listfile')

If File = '' THEN
Break

New
Address Value Result

Open FILENAME File

File = File || ".RTF"

SaveAs RTF NAME File
Close FORCE

Address Value OldPort
END
Call Close('listfile')

END

Address Command 'Delete >NIL: RAM:WwTemp'


I've used all these extensively in the past, and they work fine for me.

Hope that helps!

--Stuart Anderson

 Status: Offline
Profile     Report this post  
Darek 
Re: Can an RTF export script be written for WordWorth?
Posted on 10-Mar-2013 8:39:48
#8 ]
Member
Joined: 10-Apr-2004
Posts: 84
From: Poland

@ara:
would it be possible to get the filename from the window title?

Isn't default feature in WW there?

Last edited by Darek on 10-Mar-2013 at 09:54 AM.

_________________
Copyright (c) by Darek A.D. 2017

 Status: Offline
Profile     Report this post  
Hypex 
Re: Can an RTF export script be written for WordWorth?
Posted on 10-Mar-2013 13:51:14
#9 ]
Elite Member
Joined: 6-May-2007
Posts: 11351
From: Greensborough, Australia

@Darek

I could open a new document or default but then what? I still don't know what name it is called and still no clue what the file I need is called.

 Status: Offline
Profile     Report this post  
Hypex 
Re: Can an RTF export script be written for WordWorth?
Posted on 10-Mar-2013 13:55:39
#10 ]
Elite Member
Joined: 6-May-2007
Posts: 11351
From: Greensborough, Australia

@ara

I suppose I could use some extra commands to locate it by reading Intuition windows pointer and such but it does go beyond the scope of Wordworth. Of course if Wordworth cannot tell me what I need to know I may need to look into it. So simple yet hard to do!

 Status: Offline
Profile     Report this post  
Hypex 
Re: Can an RTF export script be written for WordWorth?
Posted on 10-Mar-2013 13:58:48
#11 ]
Elite Member
Joined: 6-May-2007
Posts: 11351
From: Greensborough, Australia

@mr_homm

Thanks for sharing the scripts. Of course, none do what I exacly need, since they rely on asking the user. I can see myself taking the first example and asking the filename because Wordworth cannot or will not give it to me.

 Status: Offline
Profile     Report this post  
Darek 
Re: Can an RTF export script be written for WordWorth?
Posted on 10-Mar-2013 15:31:57
#12 ]
Member
Joined: 10-Apr-2004
Posts: 84
From: Poland

@Hypex

In WW& ARexx folder there is script called Save_All.rexx:

/* Save_All

Saves all open documents.

Digita ARexx Script for Wordworth 7
Copyright ©1998, Digita International Ltd.

Created: 19 January 1996
Author: MJ & PB
*/


RequestResponse "Do you wish to Save all open documents?"
IF (RC > 0) THEN
Exit

DO Num = 1 to 20
WwPort = "WORDWORTH." || Num
IF SHOW(PORTS, WwPort) THEN DO
Address Value WwPort
Save
END
END


As I see there, WW7 opens individual & separate WW port there for each document.
So for finding out document name in use you need to find actual active WW port name.



Regarding to my previous idea for knowing name of document is based on different , but easy, approach. Simply you know name of document in advance before opening there.
First you simply save blank WW document under name i.e. WW7Blank.
Now open new WW by simply clicking on WW7Blank icon there, and that's all.




Last edited by Darek on 10-Mar-2013 at 03:43 PM.

_________________
Copyright (c) by Darek A.D. 2017

 Status: Offline
Profile     Report this post  
Hypex 
Re: Can an RTF export script be written for WordWorth?
Posted on 11-Mar-2013 14:19:12
#13 ]
Elite Member
Joined: 6-May-2007
Posts: 11351
From: Greensborough, Australia

@Darek

Thanks for your suggestions.

Yes I was aware of the port names it uses. However, they are all named in "WORDWORTH.x"format and so bare no relation to the document name. In any case I can see no command to get the current port name, only to create a new one. Wordworth typical.

Regarding your other idea, in fact I do know the name of the document beccause it's right in front of me! I just don't know how to grab it from a script.

Now I see what you mean about the blank document. I could automate it to save a blank document and load it in again or simply create a new document but then what? The document I want to use is already loaded! And I'm back where I started!

 Status: Offline
Profile     Report this post  
Hypex 
Re: Can an RTF export script be written for WordWorth?
Posted on 10-Jul-2013 6:47:20
#14 ]
Elite Member
Joined: 6-May-2007
Posts: 11351
From: Greensborough, Australia

Thought I'd give an update. I decided to go with the file requater as I first posted. But I've wasted hours pulling my hair out geting it to work! I've never wasted so much time on an ARexx script!

I ended up debugging it on the shell just to deal with the WW error silences and actually seeing what was happening. I also looked at some script I wrote years ago just to give me soem hints. I have the ARexx manual and Abacus guide but they didn't help much. I got stuck simply trying to extract the file from the path as I needed to send data to AmjgaDOS and back again.

In the end I gave up on that as a simple operation just got too complcated and replaced with an ARexx one liner. So, after all this, here's the final result. With extra crap in between.


/* Export current document as RTF */

Options Results

RequestFile
If (RC>0) Then Exit

/*
File=Result
WWPort=Address()
Address Command
Result='PathPart FILE="'File'"'
Address Value WWPort
*/

Name=SubStr(Result,LastPos('/',Result)+1)
File="RAM:" || Name || ".rtf"

/*
RequestNotify Name
*/

SaveAs 'RTF NAME' File

End

 Status: Offline
Profile     Report this post  

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle