I have a number of existing files containing lower case Transact-SQL that I would like to open and have UE capitalize the keywords. I have the SQL language in my wordfile, and the keywords are capitalized in there. UE will highlight and capitalize the keywords if I re-type them, but how do I get it to do this globally to pre-existing code? Thanks.
I'm going to post a solution created by another user, whose name I can't locate. I remember seeing feedback from users who liked it, and I tried it myself this morning. It appeared to work. Thanks to whoever it was.
"Here is how I do it using UltraEdit-32:
1. Open the file with syntax highlighting and auto-correction enabled
2. Make sure the cursor is positioned at the beginning of the file
3. Record a macro by hitting the following sequence of keys, MAKING NO MISTAKES!!!
Ctrl+Shift+R
Ctrl+<RIGHT ARROW KEY>
<LEFT ARROW KEY>
<SPACE>
<BACKSPACE>
Ctrl+<RIGHT ARROW KEY>
Ctrl+Shift+R
4. BACK UP THE FILE!!!
5. Note the number of characters in the file
6. Hit Ctrl+L
7. Check the box that says "Play macro to End of File"
8. Click the OK button
9. Try not to freak out as UltraEdit-32 seems to eat large chunks of your program source. Aparently the display routine can't quite keep up with the macro processor
10. Scroll 1 line, the source code re-appears. The character count should be the same before and after running the macro
Good luck."
"Here is how I do it using UltraEdit-32:
1. Open the file with syntax highlighting and auto-correction enabled
2. Make sure the cursor is positioned at the beginning of the file
3. Record a macro by hitting the following sequence of keys, MAKING NO MISTAKES!!!
Ctrl+Shift+R
Ctrl+<RIGHT ARROW KEY>
<LEFT ARROW KEY>
<SPACE>
<BACKSPACE>
Ctrl+<RIGHT ARROW KEY>
Ctrl+Shift+R
4. BACK UP THE FILE!!!
5. Note the number of characters in the file
6. Hit Ctrl+L
7. Check the box that says "Play macro to End of File"
8. Click the OK button
9. Try not to freak out as UltraEdit-32 seems to eat large chunks of your program source. Aparently the display routine can't quite keep up with the macro processor
10. Scroll 1 line, the source code re-appears. The character count should be the same before and after running the macro
Good luck."
Software For Metalworking
http://closetolerancesoftware.com
http://closetolerancesoftware.com
I have been searching for something to do this for ages. I love watching macros eat code. This rocks big time
I've been playing with a solution for a while, heres' a macro you can simply run which will position the cursor at the top of the file and play itself to the end. If syntax highlighting and auto-correct are active then the T-SQL reserved words will adjusted accordingly:
Code: Select all
Top
Loop
" "
Key BACKSPACE
Key Ctrl+RIGHT ARROW
IfEof
ExitLoop
EndIf
EndLoop
Re: Auto correct an existing file - problem with the macro
I tried the macro and it mostly worked, but there is a case where it fails.
In this case, it capitalized group_id where it shouldn't have.
Here is a fix I made:
-Supergibbs
PS: I don't know much about macro writing so there is probably a nicer way to write this, maybe without using 'copy' as a 'noop'
Code: Select all
SELECT ext_num, GROUP_id, me.media_buy_sheets_id AS media_buy_sheets_id
FROM media_ext_groups2 meg, media_entries2 me
WHERE meg.group_id = me.media_ext_groups_id
Here is a fix I made:
Code: Select all
Top
Loop
" "
Key BACKSPACE
Loop
Key Ctrl+RIGHT ARROW
IfCharIs "_"
Copy
Else
ExitLoop
EndIf
IfEof
ExitLoop
EndIf
EndLoop
IfEof
ExitLoop
EndIf
EndLoop
PS: I don't know much about macro writing so there is probably a nicer way to write this, maybe without using 'copy' as a 'noop'
hmmm, that got me thinking so I tried replacing the space (" ") with a different character, an underscore did the trick
Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOff
GotoLine 1
Key HOME
Loop
"_"
Key BACKSPACE
Key Ctrl+RIGHT ARROW
IfEof
ExitLoop
EndIf
EndLoop
Awesome, that's a lot better, here is one more minor cleanup (ColumnModeOff, UnixReOff don't matter and HexOff is very unlikely needed, plus Top does GotoLine 1; Key HOME)
-Jesse
Code: Select all
InsertMode
Top
Loop
"_"
Key BACKSPACE
Key Ctrl+RIGHT ARROW
IfEof
ExitLoop
EndIf
EndLoop