View Full Version : Solved: Convertiing a Macro to Script

10-09-2005, 12:34 PM
I have a problem seeing input areas (login password, forum posts, etc.) on certain web sites because I use a black background on my screen. I wrote a macro that will toggle between my normal screen colors and a set that permits me to see the ?invisible? areas of those web sites.

It has proved VERY handy, but in order to use it I have to click a button that brings up an Excel workbook, which contains and initiates execution of the macro. It actually goes pretty fast, but it?s a clumsy way to do what I want to do. My question is:

Is there a way to convert the macro into Script so I can ?run? it? I have no background in Script, and I would rather not go through the learning curve of educating myself on a new language just to make this conversion.

The basic statements I use are:
'Declare required API functions
Private Declare Function SetSysColors Lib "user32" (ByVal nChanges&, lpSysColor&, lpColorValues&) As Long
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex&) As Long

Sub ToggleScreenColors()
Dim WinSysColors&, WindowColor, WindowTxtColor
WinSysColors = GetSysColor(COLOR_WINDOW)
If WinSysColors = 0 _
WindowColor = SetSysColors(1, COLOR_WINDOW, RGB(0, 255, 255)) 'Cyan
WindowTxtColor = SetSysColors(1, COLOR_WINDOWTEXT, RGB(0, 0, 0)) 'Black
WindowColor = SetSysColors(1, COLOR_WINDOW, RGB(0, 0, 0)) 'Black
WindowTxtColor = SetSysColors(1, COLOR_WINDOWTEXT, RGB(0, 255, 255)) 'Cyan
End If
End Sub 'ToggleScreenColors'

10-09-2005, 01:46 PM
The problem is that you cannot natively call a Win32 API in scripts, you need a custom control to do it. I have not found any free instances of these.

10-10-2005, 11:39 AM
Thanx for the reply, xld. I was afraid you might say something like that. Oh well ... just wishing.