VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Tip for viewing code in this web forum

3 REPLIES 3
Reply
Message 1 of 4
wivory
166 Views, 3 Replies

Tip for viewing code in this web forum

As most of you are probably aware the new web interface in this forum does not faithfully reproduce indentation which is a pain when trying to understand the code somebody has posted. (In fairness to the web administrators this appears to be a function of the way HTML treats multiple spaces.)

Selecting and copying the code off the web page and pasting it into something like Notepad produces the same result. However the HTML source does hold the indentation, so with a bit of mucking around you can reformat the code as the originator intended. Unfortunately I couldn't make this work in Notepad, so you need to get yourself an editor with a smarter Replace function like TextPad.

1. Open the HTML source for the post. In Internet Explorer do this by right-clicking the page and choosing View Source which will open it in Notepad.
2. Use the Find command to locate the beginning of the code block you want.
3. The code continues straight across the one line but eventually wraps to the next line(s) so you'll probably need to scroll across to find the end of the code. Hold down Shift and click at the end of the code to select the whole code block, then copy it to the clipboard.
4. Switch to your smarter editor and paste in the code.
5. Replace the HTML line-break tag with a newline. In TextPad you do this by saying Find "
", Replace with "\n" and ticking the Regular Expression box.
6. Grab your lemonade, sit back, and leisurely view the formatted code! 😉

Regards

Wayne Ivory
IT Analyst Programmer
Wespine Industries Pty Ltd
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: wivory

Cool, Wayne! You could also use PFE - Professional File Editor [which is free, not sure about TextPad]. With it you can create/store/run your own macros for the find/replace in step 5 - I'm lazy that way:) Mike -- ___________________________ Mike Tuersley CADalyst's AutoCAD Clinic Rand IMAGINiT Technologies
Message 3 of 4
Anonymous
in reply to: wivory

Or, in the ubiquitous MS Word, step 5 would be replace
with ^p James
Message 4 of 4
Anonymous
in reply to: wivory

You're right about the limits of html and how it treats multiple spaces. However, there are a few additional tips in the help section: http://www.autodesk.com/discussiongroup-help listed under
How do I include formatted code snippets in my message?

1. Attach code samples (all forums now allow attachments)
2. Use pre tags around code (see help for syntax)

See my test post as an example of the results using pre tag: http://discussion.autodesk.com/thread.jspa?threadID=321400

Note: the negative side effect of this is that the "pre" tags display in the nntp view.


Eric Wright
Discussion Groups Manager
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost