Tapatalk

Anyone interested in aiding in porting color schemes to UltraEdit?

Anyone interested in aiding in porting color schemes to UltraEdit?

32
Basic UserBasic User
32

PostDec 13, 2008#1

Right now I have a very very basic AutoIt script that aids in converting Visual Studio Schemes over to UltraEdit, and I'll likely have another to aid with Vim Schemes....or combined the two.

Anyways its no walk in the park yet by any means, but it has gotten a lot easier to do.

I'll likely expand to porting Gedit & Mirc schemes as well in time.

Right now just looking for helping hands, as I'm not making a dime off of this, and its mildly fun bit of customization to tweak your color scheme in UE.

So anyone game?

Possible Vim ports
Possible Visual Studio Ports

PostDec 26, 2008#2

Well I guess not...well then the project is closed then...as I'm frankly not excited enough about the project to go it alone.

Well here is the sample code for starting the work on Visual Studio schemes.

Code: Select all

; AutoIt Version: 3.2.12.1

#include <Array.au3>
#include <Color.au3>
#include <File.au3>

$message = 'Hold down Ctrl or Shift to choose multiple files.'

$files = FileOpenDialog( $message , @DesktopDir & '\' , '(*.vssettings)' , 1 + 4 )

If @error Then
	MsgBox( 4096 , '' , 'No File(s) chosen' )
Else
	$files = StringSplit( $files , '|' )
	If $files[0] = 1 Then
		$h = 1
		$path = ''
	Else
		$h = 2
		$path = $files[1] & '\'
	EndIf

	; Loop Through Selected Files
	For $i = $h To $files[0]
		; Open Active Read File
		$file1 = FileOpen( $path & $files[$i] , 0 )

		; Check if file opened for reading OK
		If $file1 = -1 Then
			MsgBox( 0 , 'Error' , 'Unable to open file.' )
			ExitLoop
		EndIf

		; Delete Old File
		$file2 = $path & StringLeft( $files[$i] , StringInStr ( $files[$i] , '.' , 0 , -1 ) - 1 ) & ' Colors.txt'
		FileDelete( $file2 )

		; Read in lines of text until the EOF is reached
		Dim $array[1] = [0]
		While 1
			$line = FileReadLine( $file1 )
			If @error = -1 Then ExitLoop

			; Store Values to Array
			$find = StringRegExp( $line , '(?i)item name="(.*?)" foreground="(.*?)" background="(.*?)" boldfont="(.*?)"' , 1 )
			If @error = 0 Then
				$string = $find[0] & ' FG=' & _UEC( $find[1] ) & ' BG=' & _UEC( $find[2] ) & ' BF=' & $find[3]
				$search = _ArrayBinarySearch( $array , $string , 1 )
				If $search = -1 Then
					_ArrayAdd( $array , $string )
					$array[0] = $array[0] + 1
					_ArraySort( $array , 0 , 1 )
				EndIf
			EndIf
		WEnd
		FileClose( $file1 )
		If $array[0] <> 0 Then
			_FileWriteFromArray( $file2 , $array , 1 )
		EndIf
	Next
EndIf

MsgBox( 4096 , 'AutoIt' , 'Finished' )

Func _UEC( $i )
	; Convert to PowerBuilder Format
	; (65536 * blue) + (256 * green) + (red)
	Return ((65536 * _ColorGetRed( $i )) + (256 * _ColorGetGreen( $i )) + (_ColorGetBlue( $i )))
EndFunc
Here is some additional information for those so inclined to pursue such a venture in the future.

Code: Select all

[User Color Schemes]
#=NAME
;FG;BG		< Plain Text
;FG;BG		< Selected Text
;FG;BG		< Active Line
;FG;0		< Spaces, Tabs, Line Ends
;FG;BG		< Ruler, Line Number Column
;FG;BG		< Workspace Manager / Output Window
;0;BG		< Bookmarks
;0;BG		< Column Marker
;0;BG		< Brace Highlight
;0;BG		< Folding Background

/////////////////////////////////////////////////////

[Language # Colors]
Colors=
FG,		< Normal Text
FG,		< Comments
FG,		< Comment Blocks
FG,		< Strings
FG,		< Numbers
FG,		< Word List 1
FG,		< Word List 2
FG,		< Word List 3
FG,		< Word List 4
FG,		< Word List 5
FG,		< Word List 6
FG,		< Word List 7
FG,		< Word List 8
Colors Auto Back=
#,		< Normal Text	 (1=Yes 0=No)
#,		< Comments	 (1=Yes 0=No)
#,		< Comment Blocks (1=Yes 0=No)
#,		< Strings	 (1=Yes 0=No)
#,		< Numbers	 (1=Yes 0=No)
#,		< Word List 1	 (1=Yes 0=No)
#,		< Word List 2	 (1=Yes 0=No)
#,		< Word List 3	 (1=Yes 0=No)
#,		< Word List 4	 (1=Yes 0=No)
#,		< Word List 5	 (1=Yes 0=No)
#,		< Word List 6	 (1=Yes 0=No)
#,		< Word List 7	 (1=Yes 0=No)
#,		< Word List 8	 (1=Yes 0=No)
Colors Back=
BG,		< Normal Text
BG,		< Comments
BG,		< Comment Blocks
BG,		< Strings
BG,		< Numbers
BG,		< Word List 1
BG,		< Word List 2
BG,		< Word List 3
BG,		< Word List 4
BG,		< Word List 5
BG,		< Word List 6
BG,		< Word List 7
BG,		< Word List 8
Font Style=
0,		< Normal Text	 (0=Normal 1=Bold 2=Italic 3=Underline) !N\A!
#,		< Comments	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Comment Blocks (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Strings	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Numbers	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 1	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 2	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 3	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 4	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 5	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 6	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 7	 (0=Normal 1=Bold 2=Italic 3=Underline)
#,		< Word List 8	 (0=Normal 1=Bold 2=Italic 3=Underline)