Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Notepad++ User Defined Language help
New Posts  All Forums:Forum Nav:

Notepad++ User Defined Language help

post #1 of 8
Thread Starter 
I've been doing a lot of CNC work and would like to create a custom language for GCode. If you don't know what that is, do not worry. GCode is the code that you use to do the actual machining on a CNC. What I want to do is (in my eyes) rather simple.

GCode has a letter followed by a number. The most common ones you'll see are N, F, G, and X, Y and Z. I would like each letter/number type to have a different color. There isn't really any 'opening' and 'closing' of commands or sections so that doesn't really matter. A line of code may look like this:
Code:
N5 G0 X25.000 Y7.500

and I'd like it to appear
Code:
N5 [COLOR="DarkRed"]G0[/COLOR] [COLOR="Green"]X25.000[/COLOR] [COLOR="Olive"]Y7.500[/COLOR]


Anyone know how to do that in Notepad++'s User-Defined Dialogue?
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
post #2 of 8
Hi. If I follow your requirements, you can set it up like this.

1. Open the 'User-Defined' dialog in Notepad++.
2. Create a new language (e.g. GCode).
3. Set prefix-mode based color schemes for each of the letters.

Here's an example based on your sample:

note1.png

4. Select your new GCode language and it will color as specified, which will look something like this:

note2.png

Is that what you had in mind? smile.gif
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
post #3 of 8
Thread Starter 
That's perfect. It will make it much easier to scan the code and find similar commands. Thanks!

edit: Can I set more than just 4 prefixes? I'm messing with the XML file itself but can't seem to figure it out.
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
post #4 of 8
Ah yes, I see what you mean. Let me tinker with the XML for a minute and see if I can figure it out. thinking.gif
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
post #5 of 8
Thread Starter 
I saw on a random web search that you can only have 4. I have no idea if that has changed however. I did find that you can add more than one entry to a box so I put x y and z all there like this:
Code:
x y z
and it applies the same effects to all of them as separate entries. That helps some if I don't mind them being the same color.
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
post #6 of 8
Quote:
Originally Posted by IEATFISH;14384140 
I saw on a random web search that you can only have 4. I have no idea if that has changed however. I did find that you can add more than one entry to a box so I put x y and z all there like this:
Code:
x y z
and it applies the same effects to all of them as separate entries. That helps some if I don't mind them being the same color.

I tried modifying the exported XML directly (to add additional keywords), but the editor just seems to reject anything outside of the expected format on import. Drat! Well I suppose you can color code any keywords, but only up to 4 styles with this method.

If I happen to find that it's easy to do in another freeware source editor, would you be interested in that?
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
post #7 of 8
Thread Starter 
Quote:
Originally Posted by tjwurzburger;14384277 
I tried modifying the exported XML directly (to add additional keywords), but the editor just seems to reject anything outside of the expected format on import. Drat! Well I suppose you can color code any keywords, but only up to 4 styles with this method.

If I happen to find that it's easy to do in another freeware source editor, would you be interested in that?

Possibly, though I think 4 styles should be enough. This will help scan a thousand line file for the specific codes I'm looking for easy enough.
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
Gunmetal Tower
(23 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2600K ASUS P8Z68-V GEN3 Asus GTX 580 CORSAIR Vengeance 16GB 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 830 256GB Western Digital Caviar Black 640GB LG DVD Corsair H80 
OSMonitorMonitorKeyboard
Microsoft Windows 8.1 Professional 64 Bit Asus PB278Q Dell 1907FPc  Ducky 9008-G2 Browns and Reds 
PowerCaseMouseMouse Pad
ABS SL1050 1050W Antec P280 Logitech G700 Mionix Propus 380 
AudioAudioAudioAudio
HT | OMEGA Claro Halo Audio Technica ATH-A900X Audio Technica ATH-AD900 M-Audio AV 40 
OtherOtherOther
Logitech USB Desktop Microphone APC Back-UPS XS 1500 Wacom Intuos4 
  hide details  
Reply
post #8 of 8
Sounds good. If you need some automation (i.e. coding) to aid you in your task, just send me a PM and I'll be all over it. I'm getting a little bored on sabbatical. smile.gif
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Notepad++ User Defined Language help