CREdit list - http://www.geocities.com/plamen_p/credit/index.html

--------------------------- ListBot Sponsor --------------------------
Start Your Own FREE Email List at http://www.listbot.com/links/joinlb
----------------------------------------------------------------------

Hi Storm Ice,

i've written the following vb-macro, that will do the job

Kind regards

Benjamin.


'-------------------------------------------------------------------------------
Public Sub
Beautifier()
'-------------------------------------------------------------------------------
'Name and Path of temporary file to use
const TempFile= "C:\Temp\CREdit_BTF.TMP"

'Change this to any command you like:
const BeautifierCommand="CMD /C Type "  
'remark:
'This calls the command interpreter from WindowsNT to execute the type
command
'The syntax for Win9x will be: "COMMAND /C Type "
'Instead of the type command insert filename and path of your beautifier
'executable


Dim cFileContents
Dim NewDoc
Dim SaveRet
Dim sh


        'Duplicate the active document to a new one
        Application.ActiveDocument.Selection.SelectAll
        cFileContents=Application.ActiveDocument.Selection.Text
        Set NewDoc=Application.Documents.Add()
        NewDoc.Selection.Text=cFileContents
        
        'Save new document as temporary file
        SaveRet=NewDoc.Save(TempFile,False)
        
        'Check if document was saved properly
        If SaveRet=dsSaveSucceeded then
                'Close the new document
                NewDoc.Close
                
                'Run the defined beautifier command on new created temprary file and
                'wait for return
                Set sh=CreateObject("WScript.Shell")
                sh.Run BeautifierCommand & TempFile,,True
                
                'Reopen temmporary file
                Application.Documents.Open TempFile
                
                'Duplicate to new document
                Set NewDoc=Application.ActiveDocument
                Application.ActiveDocument.Selection.SelectAll
                cFileContents=Application.ActiveDocument.Selection.Text
                Application.Documents.Add().Selection.Text=cFileContents               
 
                
                'Close temporary file
                NewDoc.Close
                
        Else
                'Display error message if temporary file could not be saved for any
                'reason
                MsgBox "Error saving temporary File"
        End
If

'-------------------------------------------------------------------------------
End
Sub
'-------------------------------------------------------------------------------




-----Original Message-----
From: Storm Ice [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 9:22 PM
To: [EMAIL PROTECTED]
Subject: Saving AS in credit tool?


CREdit list - http://www.geocities.com/plamen_p/credit/index.html

--------------------------- ListBot Sponsor --------------------------
Get low APR NextCard VISA, in 30 seconds!
1. Fill in the brief application
2. Receive approval decision in 30 seconds
3. Get rates as low as 2.99% Intro or 9.99% Ongoing
   APR and now annual fee!
                  Apply NOW!

http://on.linkexchange.com/?ATID=27&AID=2269
----------------------------------------------------------------------

I have a "C beautifier" dos program, which indents and
spaces a c file from the command line.  To use it, I
would want the Credit tool to save the working file as
a TEMPORARY FILE, then run the beautifier on it, and
then revert the file to see the changes that the
beautifier made.  

Is there a way to do this in CRedit?  Thanks.  If not,
I guess I can always indent perfectly to begin with,
but it's just a neat feature.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/


______________________________________________________________________
To unsubscribe, write to [EMAIL PROTECTED]

-- 
Sent through GMX FreeMail - http://www.gmx.net


______________________________________________________________________
To unsubscribe, write to [EMAIL PROTECTED]

Reply via email to