Hi Steve,

I don't use macro recorder much - but have written numerous macros in both
vbs and js. Even wrote some code to get and put files (via http) to a
website from the working document usinga cf page that acts as a gateway on
the webserver.

heres an example of an old script (vbs) that converts cf tags to cfscript
(which of course i don't bother with now for mx only code). It will give you
the idea of what you can do - just have a look at the api for homesite to
see what you can do - there is zipping functionality, file ops and http
too - not to mention stuff to work with the active docs

Sub Main

 'DECLARE VARIABLES
 Dim app, dblTick, sngTick, carRtrn, linFeed, ampSand, snSpace, charTab,
strText, tempStr, bgnStr, endStr

 Set app = Application
 intSelection = app.ActiveDocument.SelLength

 If intSelection < 1 then

  alertNoText = app.MessageBox("You have not selected any text!", "", 0)

 Else

  'GRAB SELECTED TEXT
  strText = app.ActiveDocument.SelText

  Do While instr(strText, "<CFSET ") > 0
   strText = Replace(strText, "<CFSET ", "")
  loop

  Do While instr(strText, "<cfset ") > 0
   strText = Replace(strText, "<cfset ", "")
  loop

  Do While instr(strText, ">") > 0
   strText = Replace(strText, ">", " ;")
  loop

  strText = "<cfscript>" & vbcrlf & strText &  vbcrlf & "</cfscript>"

  'WRITE TEXT BACK TO SCREEN WITH BEGINNING TEXT AND END TEXT AROUND IT
  app.ActiveDocument.SelText = strText

 End If

End Sub

or one (js) to close just unchanged files that are open


function Main()
{
 var app = Application;
 app.SetStatusText("Closing Unmodified Files...");
 total_files = app.DocumentCount;
 for (i = 0; i < total_files; i++) {
     if (!app.ActiveDocument.Modified)
   app.ActiveDocument.Close("True");
  else
   app.NextDoc();
 }
 app.StatusWarning("All Unmodified files closed!");
}



"Steve Onnis" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> I have finally decided to have a play with the macros in Homesite and
found them pretty cool.
>
> For example
>
> Now with a nice keyboard shortcut, I can add a comment block into my pages
which does the following :-
>
> 1) If it's a new document that has not been saved yet, it will ask me for
a file name. if it's a saved document, it grabs the saved
> file name
> 2) Asks me for my name
> 3) Asks me to input a comment/remark for the comment block
>
> In the end it looks like this
>
>
<!--- ---------------------------------------------------------------------
>
> Editor : Steve Onnis
> Edit Date : 4/4/2005 2:40AM
> Filename : fileName.cfm
> Remarks : This is a comment which is inputted via a
>   messabe box popup
>
> --------------------------------------------------------------------- --->
>
> It even inserts the date into the comment for you and tabs out the comment
so it is properly indented with your cursor position in
> your code!!
>
> I even did one for creating new documents and added it into my toolbar.
>
> Its prolly just me but I think this is pretty cool.
>
> What I would love to do is do some parsing with it and for example have it
convert an INSERT query into an UPDATE query for me and
> visa versa
>
> Is anyone else using this sort of thing?
>
> In Dreamweaver MX I did notice a "Commands" area but its disabled for some
reason :(
>
>
>



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to