Jump to content

Monitoring colours - PixelSearch and PixelCheckSum - (Moved)


Recommended Posts

Hello everyone,

I have several signals on the screen that need to be monitored while a program is running. These signals are scattered around an image which is maximized on 4  equal resolution screens - the AutoIT Window Info does not recognize any objects on the program meaning that I'm left with the PixelSearch() and PixelCheckSum() functions to monitor the signals:

The signals are as small as a 5x5 pixel area and their coordinates are known.

I've been digging around for a while now in this forum about the PixelSearch() and PixelCheckSum()  and found some interesting and useful ideas for the use of them. I also came across some other UDF functions like MultiMon(), FastFind(), TtColXY() and the ImageSearch2015 scripts that might be useful for the final output. I don't know if hovering the mouse by using TtColXY() and output its ToolTip() information onto the log file will be faster than using PixelSearch() and/or PixelCheckSum() in a loop for all signals' coordinates.

The colours of the signals are below:

red - 0x00FF00 (opaque red)

green - 0x00FF00 (opaque green)

yellow - 0xFFFF00 (opaque yellow)

black - 0x000000 (opaque black, default colour)

EDIT:

The desired output is to monitor and record/log the changes and status of each inside a .txt file or a .csv with the below format: 

Local Machine Time        Signal,      Change,               delta-t

14:32:07                  Signal1     Green - Yellow         DELTA-t1
14:34:02                  Signal1     Yellow - Red           DELTA-t1
14:35:14                  Signal2     Yellow - Red           DELTA-t2

...

Below is the code I came up with. 

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <misc.au3>
#include <Date.au3>
#include <Array.au3>
#include <File.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <WinAPIHObj.au3>

Global $program_name, $program_open, $Wname, $tCurrent
Global $button_xy[2] = [150, 175]
Global $iniColour, $ColourCheck, $NewCheck

Global $Red, $Green, $Blue, $Nil
Global $sFilePath = @ScriptDir & "\Signals_status.txt"
Global $SignalID[10] = ["Signal_1", "Signal_2", "Signal_3", "Signal_4", "Signal_5", "Signal_6", "Signal_7", "Signal_8", "Signal_9", "Signal_10"]

$program_name = "Signals.exe"
$Wname = "Training Task 3"

$program_open = ShellExecute($program_name, @ScriptDir)

WinWait($Wname)


$iniColour = "0x" & Hex(PixelGetColor($button_xy[0], $button_xy[1]), 6)

;~ $iniChecksum = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5), 6)

$ColourCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6)
ConsoleWrite(_ColourID($iniColour) & " // " & _ColourID($ColourCheck) & @CRLF)

;~ $ColourCheck = "0x " & Hex(PixelGetColor($button_xy[0], $button_xy[1]), 6)

$iniColour = $ColourCheck
;$iniChecksum = $currentCheck

Do

;~ While 1

    _WindowOnTop()
    _Close_Notepad()

    $NewCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6)
    $tCurrent = _NowCalc()

    $LogFile = FileOpen($sFilePath, 2)
    FileWriteLine($LogFile, "Local Machine Time        " & "Signal,      " & "Change,               " & "delta-t")


;~  $ColourCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6)

    If $ColourCheck <> $NewCheck Then ;If there's a colour change from the current colour

        $ColourCheck = $NewCheck
        Local $tChange, $NewCheckID, $ColourCheckID, $sLogMsg

        $tChange = _NowCalc()
        ConsoleWrite("Colour changed!" & @CRLF)

        $ColourCheckID = _ColourID($ColourCheck)

        $NewCheckID = _ColourID($NewCheck)

        $iTimeDiffh = _DateDiff('h', $tChange, $tCurrent) ; time difference in hours
        $iTimeDiffm = _DateDiff('n', $tChange, $tCurrent) ; time difference in minutes
        $iTimeDiffs = _DateDiff('s', $tChange, $tCurrent) ; time difference in  seconds

        $durationCheckSum = $iTimeDiffh & ":" & $iTimeDiffm & ":" & $iTimeDiffs ; Timestamp of the signal until PixelCheckSum

        $sLogMsg = "    " & $SignalID[0] & "          " & $ColourCheckID & " - " & $NewCheckID & "          " & $durationCheckSum

        _FileWriteLog($LogFile, $sLogMsg)

    ElseIf $ColourCheck = $NewCheck Then

        Local $Colour_check = _ColourID("0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6))
        ConsoleWrite($tCurrent & " " & $Colour_check & @CRLF)

    EndIf

    FileClose($sFilePath)

Until Not ProcessExists($program_name) And Not WinExists($Wname)


_IsProgramOpen()

Func _Close_Notepad()
    $notepad_open = ProcessExists("notepad.exe") ? ProcessClose("notepad.exe") : ProcessClose("notepad.exe")
    $notepad_open = WinActive("[CLASS:Notepad]") ? WinClose("[CLASS:Notepad]") : ProcessClose("notepad.exe")
EndFunc   ;==>_Close_Notepad

Func _ColourID($sColour)

    $Red = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\2"))
    $Green = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\3"))
    $Blue = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\4"))

    If $Green > $Blue And $Red > $Blue And $Green >= 0xB0 And $Red >= 0xB0 Then
        $sCol = "Yellow"
    ElseIf $Blue > 0xE0 And $Green > 0xE0 And $Red > 0xE0 Then
        $sCol = "White"
    ElseIf $Blue > 0x50 And $Blue = $Green And $Blue = $Red Then
        $sCol = "Grey"
    ElseIf $Red > $Green And $Red > $Blue And $Red > 0x70 Then
        $sCol = "Red"
    ElseIf $Green > $Red And $Green >= $Blue And $Green > 0x70 Then
        $sCol = "Green"
    ElseIf $Blue > $Red And $Blue > $Green And $Blue > 0x70 Then
        $sCol = "Blue"
    Else
        $sCol = "Nil"
    EndIf

    Return $sCol
EndFunc   ;==>_ColourID

Func _WindowOnTop()

    WinActivate($Wname)
    WinSetOnTop($Wname, "", $WINDOWS_ONTOP)
    Opt("MouseCoordMode", 0)

EndFunc   ;==>_WindowOnTop

Func _IsProgramOpen()
    If Not ProcessExists($program_name) And Not WinExists($Wname) Then
        Break(1)
    EndIf
EndFunc   ;==>_IsProgramOpen

When the program is running, the window opens in the centre of the screen however, the PixelChecksum function is not looking at the correct area. In addition:

1 - I'm not sure about how to put the message into the log file.

2 - I tested this script but it is not recording the message into the log file.

3 - Is there other way to calculate the duration in these lines?

$iTimeDiffh = _DateDiff('h', $tChange, $tCurrent) ; time difference in hours
        $iTimeDiffm = _DateDiff('n', $tChange, $tCurrent) ; time difference in minutes
        $iTimeDiffs = _DateDiff('s', $tChange, $tCurrent) ; time difference in  seconds

        $durationCheckSum = $iTimeDiffh & ":" & $iTimeDiffm & ":" & $iTimeDiffs ; Timestamp of the signal until PixelCheckSum

        $sLogMsg = "    " & $SignalID[0] & "          " & $ColourCheckID & " - " & $NewCheckID & "          " & $durationCheckSum

        _FileWriteLog($LogFile, $sLogMsg)

Thanks in advance!

Edited by Dave1
Came up with some ideas for the code
Link to post
Share on other sites
  • Developers

 

3 minutes ago, Dave1 said:

In addition, I'm not sure on which of the topics I would have to post this so I opened a new one - please advise if this goes against the rules!

* start of standard messages*
Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

That is the problem with PixelSearch running over an application that nobody knows about.  How do you think we can KNOW if the coordinates you have entered in your script are correct ? 

If you want help, you should consider using an application we actually can run.  Break you code to the simplest form and use Paint as the target application.  Provide a jpg image of the locations and colors you are looking for.  This is the best way to proceed if you want to get useful help.

Link to post
Share on other sites

You're right, I forgot to attach it - apologies for that!

 

EDIT: The attachment is a test executable - I'm trying to make the code work with this sample .exe for now. The future aim is to loop the script to monitor the signals in several locations on the screen.

Edited by Jos
rar with exe removed.
Link to post
Share on other sites

you don't need to install it, however if you don't feel comfortable in opening the .exe I can understand - I wouldn't trust it too.

EDIT:

The window of the program, once it opens, it's always in the same position and it doesn't change - it's in the centre of the screen. The problem that I see is that the PixelChecksum function is not looking in the correct place (centre of the button - [150, 175]) even though I wrote the UDF _WindowOnTop() with the "PixelCoordMode" set to "0".

Below is a picture of the program when it is executed. Does this help? Let me know if there's more I can provide you to help understand the problem in the above code.

 

program_snipp.jpg

Edited by Dave1
Link to post
Share on other sites
  • Developers

When you want help you need to post your Source here in a code box!

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Hi @Jos, I've posted a code already in the first post of this thread but please find below the most recent code I have for this.

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <misc.au3>
#include <Date.au3>
#include <Array.au3>
#include <File.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <WinAPIHObj.au3>

Global $program_name, $program_open, $WButton, $Wname, $tCurrent
Global $button_xy[2] = [150, 175]
Global $iniColour, $ColourCheck, $ColourCheckID, $NewCheck

Global $Red, $Green, $Blue, $Nil
Global $sFilePath = @ScriptDir & "\Signals_status.txt"
Global $SignalID[10] = ["Signal_1", "Signal_2", "Signal_3", "Signal_4", "Signal_5", "Signal_6", "Signal_7", "Signal_8", "Signal_9", "Signal_10"]


$program_name = "Training Task 3.exe"
$Wname = "Training Task 3"
$program_open = ShellExecute($program_name, @ScriptDir)
WinWait($Wname)


Do
    _WindowOnTop()
    $ColourCheck = "0x" & Hex(PixelGetColor($button_xy[0], $button_xy[1], $Wname), 6)

    ;$ColourCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] + 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6)
    ;   ConsoleWrite(_ColourID($iniColour) & " // " & _ColourID($ColourCheck) & @CRLF)
    ;ConsoleWrite("  " & _ColourID($ColourCheck) & @CRLF)
    $LogFile = FileOpen($sFilePath, 2)
    FileWriteLine($LogFile, "Local Machine Time        " & "Signal,      " & "Change,               " & "delta-t")

    ;While 1


    _Close_Notepad()

    ;$NewCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6)
    $NewCheck = "0x" & Hex(PixelGetColor($button_xy[0], $button_xy[1], $Wname), 6)
    $tCurrent = _NowCalc()

    ;$ColourCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6)

    If $NewCheck <> $ColourCheck Then

        $ColourCheck = $NewCheck

        Local $tChange, $NewCheckID, $sLogMsg
        $tChange = _NowCalc()

        $ColourCheckID = _ColourID($ColourCheck)

        $NewCheckID = _ColourID($NewCheck)
        ConsoleWrite($tCurrent & " Colour changed to " & $NewCheckID & @CRLF)

        $iTimeDiffh = _DateDiff('h', $tChange, $tCurrent) ; time difference in hours
        $iTimeDiffm = _DateDiff('n', $tChange, $tCurrent) ; time difference in minutes
        $iTimeDiffs = _DateDiff('s', $tChange, $tCurrent) ; time difference in  seconds

        $durationCheckSum = $iTimeDiffh & ":" & $iTimeDiffm & ":" & $iTimeDiffs ; Timestamp of the signal until PixelCheckSum

        $sLogMsg = "    " & $SignalID[0] & "          " & $ColourCheckID & " - " & $NewCheckID & "          " & $durationCheckSum

        _FileWriteLog($LogFile, $sLogMsg)

    ElseIf $NewCheck = $ColourCheck Then
        ; _WindowOnTop()
        Local $Colour_check = _ColourID("0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6))
        ConsoleWrite($tCurrent & " Same colour! " & $Colour_check & @CRLF)

    EndIf

    FileClose($sFilePath)
    ;WEnd

Until Not ProcessExists($program_name) And Not WinExists($Wname)


Func _Close_Notepad()
    $notepad_open = ProcessExists("notepad.exe") ? ProcessClose("notepad.exe") : ProcessClose("notepad.exe")
    $notepad_open = WinActive("[CLASS:Notepad]") ? WinClose("[CLASS:Notepad]") : ProcessClose("notepad.exe")
EndFunc   ;==>_Close_Notepad

Func _ColourID($sColour)

    $Red = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\2"))
    $Green = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\3"))
    $Blue = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\4"))

    If $Green > $Blue And $Red > $Blue And $Green >= 0xB0 And $Red >= 0xB0 Then
        $sCol = "Yellow"
    ElseIf $Blue > 0xE0 And $Green > 0xE0 And $Red > 0xE0 Then
        $sCol = "White"
    ElseIf $Blue > 0x50 And $Blue = $Green And $Blue = $Red Then
        $sCol = "Grey"
    ElseIf $Red > $Green And $Red > $Blue And $Red > 0x70 Then
        $sCol = "Red"
    ElseIf $Green > $Red And $Green >= $Blue And $Green > 0x70 Then
        $sCol = "Green"
    ElseIf $Blue > $Red And $Blue > $Green And $Blue > 0x70 Then
        $sCol = "Blue"
    Else
        $sCol = "Nil"
    EndIf

    Return $sCol
EndFunc   ;==>_ColourID

Func _WindowOnTop()

    WinSetOnTop($Wname, "", $WINDOWS_ONTOP)
    WinActivate($Wname)
    AutoItSetOption("PixelCoordMode", 0)

EndFunc   ;==>_WindowOnTop

Func _IsProgramOpen()
    If Not ProcessExists($program_name) And Not WinExists($Wname) Then
        Break(1)
    EndIf
EndFunc   ;==>_IsProgramOpen

I wonder how to apply the Do... Until // While... WEnd in this code.

@Nine - good point, I'll check that once I run it on my other computer - I'll edit this reply asap.

 

Link to post
Share on other sites

From what i seen ,your are clear to post what you want. No mod has declared any edicts .

They generally say something to the effect of asking others to stay out of it, (the topic or post at hand) after they have made a post of inquiry to the OP or other personages.

Edited by Somerset
clarification.
Link to post
Share on other sites
4 hours ago, JockoDundee said:

....and the lingering staff presence, I am fearful of violating the “posting while mods are working” edict.

lol, I agree that this pic. :
program_snipp.jpg

is nothing like anything that makes any sense for any purpose that I can think of.
Use common sense, and if you feel like working on the code, ...have fun :)

..unless a mod. starts asking questions about the post itself ( other than "wrong forum" or "learn to post" ) ;) 

Link to post
Share on other sites

Given the posts above, I think I'm entitled to an explanation of some sort. :)

Given the forum rules and the "dicey" content, I realized now that posting the .exe is not (and never was!) a good practice and I can understand the questioning of its nature regarding rules number 3 and number 9 of the forum rules. This post and its code are not meant to be applied to games nor bots nor is, in any way, malware :) The deletion of it makes it crystal clear the moderation team has acted upon it and their action is in favour of the Forum rules.

As human, I live and learn! 😅 

3 hours ago, argumentum said:

is nothing like anything that makes any sense for any purpose that I can think of.

I posted the above picture to give an idea on how the visual interface is. As the title of the window implies - it is a training task (I know, a bit dull 🙄). It is a simple one I was given since this is my first interaction with AutoIT.

The purpose of getting the code in post 10 to work for this single signal is to loop it in the future for different windows of the same nature (regardless of the layout).

 

Link to post
Share on other sites
46 minutes ago, Dave1 said:

Given the posts above, I think I'm entitled to an explanation of some sort.

sure, although you should know that my original intention was not to explain, but only inquire about the status of the thread, with regard to posting substantive responses.
I do not myself make such decisions, but I have been asked to sense the possibility of an impending action and refrain if one seems imminent.

unfortunately, and after careful consideration, I was forced to evaluate your thread as CCC, using the Moody’s system of creditworthiness.

because of the perceived risk of default, and in search of a safe harbor, I asked for clarification from the powers that be.

that’s “sort” of an explanation, no?

Code hard, but don’t hard code...

Link to post
Share on other sites
4 hours ago, JockoDundee said:

sure, although you should know that my original intention was not to explain, but only inquire about the status of the thread, with regard to posting substantive responses.
I do not myself make such decisions, but I have been asked to sense the possibility of an impending action and refrain if one seems imminent.

unfortunately, and after careful consideration, I was forced to evaluate your thread as CCC, using the Moody’s system of creditworthiness.

because of the perceived risk of default, and in search of a safe harbor, I asked for clarification from the powers that be.

that’s “sort” of an explanation, no?

Again - living and learning! Thanks for the explanation. Is there something I can do to get that rating to go up? Or is it a lost cause that I cannot help/control and depends on the actual subject of the post itself (being trendy somehow)?

Moving into the code matter - what's the impact on the possibility of having more people looking at this thread? Is the rating something that hinders people from actually looking at it and state their opinion on the code/post? Or is it something internal to the moderation team and is none of my business? (I'm just curious! 🙄)

Anyways, if someone cares to look at the code in post 10, please do! I'd be glad to exchange ideas on it! :)

Link to post
Share on other sites
On 3/9/2021 at 11:34 AM, Nine said:

Like I said make your code work with Paint if you want help.

Give the true image, make sure anybody can run your script, and you will get some help.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By BlueSkyMemory
      While Scite doesn't support high dpi, I open it in compatibility settings. But it brings another problem:My au3 app automatically enables high dpi, causing gui disorder.
      I've tried #AutoIt3Wrapper_Res_HiDpi=N but it doesn't work. I'd appreciate it if you could offer some help. Thanks.
    • By edubensa
      Hi! Can someone help me with this? I upgraded from SciTe Edit Lite to full version. Now every time I edit a script it opens on a new SciTe tab, but I want it opens on a new window like before the upgrade. Can someone help me with that? Thanks!!
    • By BugFix
      When posting scripts to platforms that use different tab settings (e.g. GitHub), they are ripped from their formatting.
      Thus, it is better to replace all tabs with spaces in the correct position before posting. I have created the following Lua script for this purpose. It replaces all tabs with the appropriate number of spaces in the document opened in SciTE. By default a tab width of 4 characters is used. But other values are also possible, details about this and the installation and usage are at the beginning of the script.
      -- TIME_STAMP 2022-05-01 11:28:55 v 0.1 --[[ == Installation == • Store the file to "YOUR-PATH/TabReplaceSciTE.lua" • New entry in your "SciTEUser.properties" (find a free command number, in example is "49" used, and a free shortcut) #49 Replace TAB with spaces command.name.49.*=Replace TAB with spaces command.49.*=dofile "YOUR-PATH/TabReplaceSciTE.lua" command.mode.49.*=subsystem:lua,savebefore:no command.shortcut.49.*=Ctrl+Alt+Shift+R • If your sources has different values for TAB width, you can modify the command call in this script (last line), "TabReplace_FileInSciTE(2)" or "TabReplace_FileInSciTE(8)". Or add a property to your "SciTEUser.properties" to have more flexibility: # The currently used tab.size, which is replaced by spaces # Without this property or with empty value "4" is used. tab.replace.width=2 Then change the last line in this script to: TabReplace_FileInSciTE(props['tab.replace.width']) == Usage == • Open any script. • Hit the shortcut. • In the opened document, all TAB will be replaced by the number of spaces corresponding to the TAB position in the line. ]] ---------------------------------------------------------------------------------------------------- --[[ in...: _line A line of text whose TAB are to be replaced by spaces. .....: _tabsize TAB size in number of characters. If it is omitted, 4 is used. out..: The line, with TAB replaced if necessary, and the number of replacements. ]] ---------------------------------------------------------------------------------------------------- TabReplace_Line = function(_line, _tabsize) if _line:find('^[\r\n]+$') then return _line, 0 end -- only a line break if _line == '' then return _line, 0 end -- only a empty string local posTab = _line:find('\t') if posTab == nil then return _line, 0 end -- no TAB included _tabsize = _tabsize or 4 -- default TAB width local tTab, s, sRep, iLen, sumLen = {}, ' ', '', 0, 0 while posTab ~= nil do -- calculation replacement string, taking into account characters to be inserted iLen = (_tabsize - ((posTab + sumLen -1) % _tabsize)) sumLen = sumLen + iLen -1 -- total length of the replacements sRep = s:rep(iLen) -- create replacement string table.insert(tTab, sRep) -- save to table posTab = _line:find('\t', posTab +1) -- find next TAB end local idx = 0 _line = _line:gsub('\t', function() idx = idx +1 return tTab[idx] end) return _line, idx end ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- --[[ Replaces all TAB in the file currently open in SciTE ]] ---------------------------------------------------------------------------------------------------- TabReplace_FileInSciTE = function(_tabsize) local caret = editor.CurrentPos local fvl = editor.FirstVisibleLine local content = '' if _tabsize == '' then _tabsize = nil end for i=0, editor.LineCount -1 do local line = editor:GetLine(i) line = line or '' line = TabReplace_Line(line, _tabsize) content = content..line end editor:BeginUndoAction() editor:ClearAll() editor:InsertText(0, content) editor:EndUndoAction() editor.CurrentPos = caret editor:SetSel(caret, caret) editor.FirstVisibleLine = fvl end ---------------------------------------------------------------------------------------------------- TabReplace_FileInSciTE(4) -- If required: Change the TAB size here  
      TabReplaceSciTE.lua
    • By mrider
      Greetings all,
      I went looking around for dark themes for SciTE and didn't have much luck.  No wish to necro-post, but I found this post -> A dark theme for SciTE but it seems as if things were ended at a single change for AutoIt where I was hoping for a comprehensive dark theme.  I currently have a dark desktop in Mint where xed, the terminal emulator, vim, and etcetera do an acceptable job of showing the dark theme.  Then I load SciTE and get blinded.  To resolve this, I'm currently working on creating a set of lang.properties files that use the Solarized themes (both light and dark).  The mechanism is simple enough: I wrote a small Perl program which parsed all the properties files and extracted all the distinct color values.  Then I assigned indexes to all the distinct colors, and wrote the colors themselves out to a separate properties file.  Next I parsed that and I used the formula for reducing the color palette to fewer colors as a baseline for generating the Solarized light theme - which turned out surprisingly less awful than I would have guessed.  Next I generated a color theme where all the colors are reversed for the Solarized dark theme.  The result is dark, but the individual source files I look at still need more help (Perl was particularly bad).  At this point, it is possible on my computer to switch to either the Solarized light or dark theme with one line of text in my user options file.
      Now I'm working my way through source-code cleaning up the result.  My first stop is completing Perl, but AutoIt is my next stop.  I'm happy to put the modified files out there for all to use (if you want them).
      I'm willing to do all the legwork for all the properties files.  The problem is that I'm only familiar with some of the languages that SciTE recognizes (for example - I wouldn't know Baan if it bit me on the butt).  I looked all around both the Solarized website and the Scintilla/SciTE website, and I can't find any reference files that can be used to test the colors.  Which means that any language I don't understand will get the colors chosen by the algorithm, which is admittedly fairly rough. 
       
      Which leads me to this post: What would be particularly useful would be code samples in different languages.  The more of the style numbers that are touched in that language the better.  I don't care if the code is "quality" code, I'm more interested in whether the code snip is properly colorized (for some values of "proper").  I understand that nobody is obligated to help me with "my project".  However, I promise that I will do my best with any code snips in any language and I will post the results here.  I'm using xed and vim as my templates, so my results will (mostly) resemble results there.
      I'll post my work here as time progresses, I'll probably have a working version for Perl and AutoIt in the next few days, and I'll do my best with other languages going forward.  As I say, I welcome code snips in any language that SciTE colorizes using a properties file.
       
      Edit1: Attached is the first Solarized Version.  I have only tested this in the default install of SciTE.  I'm certain there are going to be differences between the default install and the full version, but I don't yet know what those differences will be.  To use this:
      Detach the zip file. Drop the folder into your profile directory.  For example: C:\Users\mrider\Solarized . Open your local options file in SciTE (Options -> Open User Options File). Add the line "import Solarized\SolarDark" (without the quotes) to your file. You can turn the dark theme on and off with a comment character (#) at the beginning of the statement. Enable "Solar Light" theme similarly using "import Solarized\SolarLight". As I say, this doesn't work in the full version, so only use this if you are using the basic version.  I'll chase the full version next.
       
      Edit2: Attached is the second Solarized Version.  This works with the full install of SciTe, but so far I've only tested it with Autoit, Batch Files, and Perl.  I'll keep expanding the languages as I go.  To use this:
      Detach the zip file. I had to navigate to "C:\Program Files (x86)\AutoIt3\SciTE" and relax the file permissions to perform the next step. Drop the folder in the SciTE install directory (it doesn't seem to work in one's profile directory). Open your local options file in SciTE (Options -> Open User Options File) - note that this opens the user properties file inside the SciTE directory, not your profile. Add the line "import Solarized\SolarDark" (without the quotes) to your file. You can turn the dark theme on and off with a comment character (#) at the beginning of the statement. Enable "Solar Light" theme similarly using "import Solarized\SolarLight".  
      Solarized_AutoIt_SciTE_version_only.zip
      Solarized_SciTE_Full_Install.zip
    • By beautifulsoup
      Hi All,
      I'm not sure if its possible that I'm trying to achieve, I've looked into https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/AutoIt3Wrapper.html and such resources for help, but I cant really find the answer to my question.
      So upon compiling the script in SciTE, the exe file is given a Description under file Properties>Details. I understand, that  one can enter info manually there and it can even implement the version automatically with each compilation.
       
      What I'm trying to achieve is to somehow include the "@ScriptName" in the Details>File Description Field. But as I see no variable can be taken after "#" in this case.
       
      Do You think its achievable? (Win 10)
       
      Much obliged for taking time on reading this.
       
      Kind Regards,
      Brave


×
×
  • Create New...