Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Script] tomoe_uehara's home made =)


  • Please log in to reply
69 replies to this topic
tomoe_uehara
  • Members
  • 2112 posts
  • Last active: Apr 06 2014 06:00 PM
  • Joined: 05 Sep 2009
Hi... I have some scripts to share. Maybe some people will think that my scripts are lame mwahahahaha!! Posted Image

Binary Clock
/*
  AutoHotkey Version: 1.x
  Language:       English
  Platform:       Win9x/XP
  Author:         tomoe_uehara

  Script Function:
	Creates a Binary Clock, I got the idea (and how to read it) from http://www.urbanjunkie.co.uk/product.php/426/0/binary-clock
	It has autosave window position, alwaysontop, transparent window, and also you can change the colors
  Date of Creation: 
    25/04/2010 - 01:31:42
*/

#NoEnv
#SingleInstance, Force
SendMode Input
SetWorkingDir %A_ScriptDir%

; Default Setting
AOT=0
size=w10 h10

; BinaryClock.INI check
IfExist, %A_ScriptDir%\BinaryClock.ini
Gosub IniRead
Else
Gosub CreateINI

; GUI Menu
Menu, MyMenu, Add, About, About
Menu, MyMenu, Add,
Menu, MyMenu, Add, Always On Top, AOT
Menu, MyMenu, Add, Transparent Window, Trans
Menu, MyMenu, Add, Set GUI Color, SetGUIColor
Menu, MyMenu, Add, Set Clock Color, setclockcolor
Menu, MyMenu, Add,
Menu, MyMenu, Add, Exit, GuiClose

; GUI Create
Gui, color, %guicolor%
Gui, Add, Progress, c%ONColor% Background%OFFColor% x6 y52 %size% vLED3
Gui, Add, Progress, c%ONColor% Background%OFFColor% x6 y72 %size% vLED4
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y12 %size% vLED5
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y32 %size% vLED6
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y52 %size% vLED7
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y72 %size% vLED8
Gui, Add, Progress, c%ONColor% Background%OFFColor% x46 y32 %size% vLED10
Gui, Add, Progress, c%ONColor% Background%OFFColor% x46 y52 %size% vLED11
Gui, Add, Progress, c%ONColor% Background%OFFColor% x46 y72 %size% vLED12
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y12 %size% vLED13
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y32 %size% vLED14
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y52 %size% vLED15
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y72 %size% vLED16
Gui, Add, Progress, c%ONColor% Background%OFFColor% x86 y32 %size% vLED18
Gui, Add, Progress, c%ONColor% Background%OFFColor% x86 y52 %size% vLED19
Gui, Add, Progress, c%ONColor% Background%OFFColor% x86 y72 %size% vLED20
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y12 %size% vLED21
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y32 %size% vLED22
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y52 %size% vLED23
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y72 %size% vLED24
Gui, -MaximizeBox -MinimizeBox
Gui, Show, h86 w124 x%posx% y%posy%, Binary Clock
Gosub ApplyAOT
WinSet, Transparent, %trans%, Binary Clock
Gosub Check
SetTimer, Check, 1000
Return

IniRead:
IniRead, AOT, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
IniRead, PosX, %A_ScriptDir%\BinaryClock.INI, Setting, PosX, 20
IniRead, PosY, %A_ScriptDir%\BinaryClock.INI, Setting, PosY, 20
IniRead, GUIColor, %A_ScriptDir%\BinaryClock.INI, Setting, GuiColor
IniRead, ONColor, %A_ScriptDir%\BinaryClock.INI, Setting, ONColor
IniRead, OFFColor, %A_ScriptDir%\BinaryClock.INI, Setting, OFFColor
IniRead, Trans, %A_ScriptDir%\BinaryClock.INI, Setting, Trans
Return
CreateINI:
IniWrite, 0, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
IniWrite, 10, %A_ScriptDir%\BinaryClock.INI, Setting, PosX
IniWrite, 10, %A_ScriptDir%\BinaryClock.INI, Setting, PosY
IniWrite, 000000, %A_ScriptDir%\BinaryClock.INI, Setting, GUIColor
IniWrite, 00FF00, %A_ScriptDir%\BinaryClock.INI, Setting, ONColor
IniWrite, 000000, %A_ScriptDir%\BinaryClock.INI, Setting, OFFColor
IniWrite, 255, %A_ScriptDir%\BinaryClock.INI, Setting, Trans
Reload
Return

ApplyAOT:
If AOT = 1
{
	Menu, MyMenu, ToggleCheck, Always On Top
	WinSet, AlwaysOnTop, On, Binary Clock
}
Return

; The heart of the script...
Check:
Time = %A_Hour%%A_Min%%A_Sec%
Loop, 6
{
T%A_Index% := SubStr(Time, A_Index, 1)
X%A_Index% := bin(T%A_Index%)
}
Binary = %x1%%x2%%x3%%x4%%x5%%x6%
Loop, 24
{
rr := SubStr(Binary, A_Index, 1)
if rr = 1
status%A_Index% = 100
Else
status%A_Index% = 0
power := status%A_Index%
GuiControl,, LED%A_Index%, %power%
}
; The window autosave
IniRead, PosX, %A_ScriptDir%\BinaryClock.INI, Setting, PosX, 20
IniRead, PosY, %A_ScriptDir%\BinaryClock.INI, Setting, PosY, 20
WinGetPos, X, Y,,, Binary Clock
If PosX != X
IniWrite, %X%, %A_ScriptDir%\BinaryClock.INI, Setting, PosX
If PosX != Y
IniWrite, %Y%, %A_ScriptDir%\BinaryClock.INI, Setting, PosY
Return

GuiContextMenu:
Menu, MyMenu, Show
Return

trans:
transold := trans
GUI, 4:Add, Text, w400, Please set the transparency level`n(Have no effect on Windows 9x and NT4)`n`n1 = Invisible, 255 = Opaque
Gui, 4:Add, Slider, Line10 Page10 TickInterval10 ToolTip w400 vtrans Range1-255 g4preview, %trans%
Gui, 4:Add, Text
GUI, 4:Add, Button, Center w400 h40 default g4save, Save
GUI, 4:Add, Button, Center w400 g4cancel, Cancel
Gui, 4:Show,, Transparency Option
Return

4save:
Gui, 4:Submit
IniWrite, %trans%, %A_ScriptDir%\BinaryClock.INI, Setting, Trans
Reload
4cancel:
Gui, 4:Destroy
WinSet, Trans, %transold%, Binary Clock
Return

4preview:
WinSet, Trans, %trans%, Binary Clock
Return

About:
MsgBox, 4160, Do you think you're geek enough?,This Binary Clock is made by tomoe_uehara @ 25/04/2010 - 20:47:35`n`nYou don't know how to read it?`nThen visit http://www.urbanjunkie.co.uk/product.php/426/0/binary-clock`n`n`nI hope you like it... =P, 60
Return

AOT:
WinSet, AlwaysOnTop, toggle, Binary Clock
Menu, MyMenu, ToggleCheck, Always On Top
If AOT = 0
IniWrite, 1, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
Else
IniWrite, 0, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
return

SetGUIColor:
Gui, 2:Destroy
Gui, 2:Add, Text, w300 Bold center, Please specify the background color of the GUI`n(RGB Hex Format)
Gui, 2:Add, Edit, w300 vguicolor Limit6 Uppercase center, %guicolor%
Gui, 2:Add, Text
Gui, 2:Add, Button, w300 h40 default g2save, Save
Gui, 2:Add, Button, w300 g2cancel, Cancel
Gui, 2:show,, Set GUI Color
Return

2save:
gui, 2:submit
IniWrite, %guicolor%, %A_ScriptDir%\BinaryClock.INI, Setting, GUIColor
Reload
2cancel:
gui, 2:destroy
Return

setclockcolor:
Gui, 3:Destroy
Gui, 3:Add, Text, w300 Bold center, Please specify the "ON" clock color.`n(RGB Hex Format)
Gui, 3:Add, Edit, w300 voncolor Limit6 Uppercase center, %ONColor%
Gui, 3:Add, Text
Gui, 3:Add, Text, w300 Bold center, Please specify the "OFF" clock color.`n(RGB Hex Format)
Gui, 3:Add, Edit, w300 voffcolor Limit6 Uppercase center, %OFFColor%
Gui, 3:Add, Text
Gui, 3:Add, Button, w300 h40 default g3save, Save
Gui, 3:Add, Button, w300 g3cancel, Cancel
Gui, 3:show,, Set Clock Color
Return

3save:
gui, 3:submit
IniWrite, %ONColor%, %A_ScriptDir%\BinaryClock.INI, Setting, ONColor
IniWrite, %OFFColor%, %A_ScriptDir%\BinaryClock.INI, Setting, OFFColor
Reload
3cancel:
gui, 3:destroy
Return

GuiClose:
ExitApp

Bin(x){
If x = 0
r = 0000
If x = 1
r = 0001
If x = 2
r = 0010
If x = 3
r = 0011
If x = 4
r = 0100
If x = 5
r = 0101
If x = 6
r = 0110
If x = 7
r = 0111
If x = 8
r = 1000
If x = 9
r = 1001
Return r
}


ColorMix
/*
AutoHotkey Version: 1.x
Language:       English
Platform:       Win9x/XP
Author:         tomoe_uehara

Script Function:
	A GUI for mix & matching colors
Date of Creation:
	04-11-08 / 17:47:57
*/
#NoEnv
#SingleInstance, Force
SendMode Input
SetWorkingDir %A_ScriptDir%
; ---------------------------------
reds = 00
greens = 00
blues = 00
tones = 00
gui destroy
gui, add, Text,, Red:`t
Gui, Add, Edit, vreds limit2 gbunglon ys, %reds%
gui, add, slider,  vslidera gslider1 range0-255 tooltip section altsubmit ys w280 tickinterval20 page10
gui, add, Text, xm section, Green:`t
Gui, Add, Edit, vgreens limit2 gbunglon ys, %greens%
gui, add, slider, vsliderb gslider2 range0-255 tooltip section altsubmit ys w280 tickinterval20 page10
gui, add, Text, xm section, Blue:`t
Gui, Add, Edit, vblues limit2 gbunglon ys, %blues%
gui, add, slider, vsliderc gslider3 range0-255 tooltip altsubmit ys w280 tickinterval20  page10
Gui, Add, Progress, w360 h240 cwhite vprogre xm background000000
gui, font, s24
gui, add, edit, xm section readonly vproedit, %reds%%greens%%blues%
gui, font
Gui, Add, Button, w170 h50 ys -tabstop center, E&XIT
gui, Add, Button, w40 h50 ys -tabstop center, ?
gui -sysmenu +owndialogs -theme +altsubmit
Gui, Show,, Color Mix n Match -- tomoe_uehara
return
button?:				; Added at 01-06-08 / 03:01:34
random, redz, 00, 255
random, greenz, 00, 255
random, bluez, 00, 255
dox = reds
dix = %redz%
gosub randomizer
dox = greens
dix = %greenz%
gosub randomizer
dox = blues
dix = %bluez%
gosub randomizer
return
randomizer:
SetFormat, integer, hex
dix += 0
cuk := dix
SetFormat, integer, d
StringTrimleft, cuk, dix, 2
dix := cuk
guicontrol, text, %dox%, %dix%
return
slider1:
dox = reds
dix = %slidera%
goto sliders
slider2:
dox = greens
dix = %sliderb%
goto sliders
slider3:
dox = blues
dix = %sliderc%
goto sliders
sliders:
SetFormat, integer, hex
dix += 0
cuk := dix
SetFormat, integer, d
StringTrimleft, cuk, dix, 2
dix := cuk
length:=StrLen(dix)
if length < 2
dix = 0%Dix%
guicontrol, text, %dox%, %dix%
return
bunglon:
if reds is not alnum
reds = 00
if greens is not alnum
greens = 00
if blues is not alnum
blues = 00
if tones is not alnum
tones = 00
gui, submit, nohide
lenred := StrLen(reds)
if lenred = 1
reds = 0%reds%
lengreen := StrLen(greens)
if lengreen = 1
greens = 0%greens%
lenblue := StrLen(blues)
if lenblue = 1
lentone := StrLen(tones)
if lentone = 1
tones = 0%tones%
tonex=0x%tones%
redx=0x%reds%
greenx=0x%greens%
bluex=0x%blues%
SetFormat, integer, d
tonex += 0
redx += 0
greenx += 0
bluex += 0
SetFormat, integer, hex
GuiControl +Background%reds%%greens%%blues%, progre
guiControl,, slidera, %redx%
guiControl,, sliderb, %greenx%
guiControl,, sliderc, %bluex%
guiControl,, sliderd, %tonex%
GuiControl,, proedit, %reds%%greens%%blues%
SetFormat, integer, d
return
ButtonEXIT:
exitapp


Elesar
  • Members
  • 696 posts
  • Last active: Jun 20 2014 08:38 PM
  • Joined: 28 Jun 2007
Hmm, I like the clock :p
Haven't tried the other one yet.

Eedis
  • Members
  • 1775 posts
  • Last active: Sep 26 2014 05:59 PM
  • Joined: 12 Jun 2009
I've made a binary clock, it requires an install for pictures though.

And on the ColorMix program, you should have the edit boxes display the number in decimal format instead of hex. Because not all people know how to read hex.
<!-- m -->http://www.autohotke... ... taller.exe<!-- m -->
;Creator: Eedis
;Email: Killerbender53@yahoo.com

;;;;;;;;;;;;;;
;Auto Execute;
;;;;;;;;;;;;;;
setbatchlines, -1
settimer, time, 1000
mpos=Bottom-Right
yy=%A_ScreenHeight%
yy-=73
xx=%A_Screenwidth%
xx-=120

;;;;;;;;;;;;;;;;
;Gui/Menu build;
;;;;;;;;;;;;;;;;
menu, tray, NoStandard
menu, Possub, Add, Top-Left, tleft
menu, Possub, Add, Top-Right, tright
menu, Possub, Add, Bottom-Left, bleft
menu, Possub, Add, Bottom-Right, bright
menu, Possub, check, Bottom-Right

menu, tray, add, Set position, :Possub
menu, tray, add, About, About
menu, tray, add
menu, tray, add, Exit, Exit

Gui, 2:Color, FF8040
Gui, 2:Font, S11 CGreen, Papyrus
Gui, 2:Add, Button, gokay x132 y320 w100 h30 , Okay
Gui, 2:Add, Text, x14 y75 w340 h240 , A Binary Clock is simply a clock that tells you what time it is in binary. The dots on the far left represents the hour`, then the minutes`, then the seconds. A solid dot means 1`, and hollow dot means 0.`n`nAuthor: Eedis`nWebsite: http://www.autohotkey.net/~Eedis`nLanguage: AutoHotKey`nVersion: 1.0
Gui, 2:Font, S24 CGreen Bold Underline, Papyrus
Gui, 2:Add, Text, x77 y10 w210 h50 , Binary Clock

Gui, Color, FF8040
gui, -border toolwindow AlwaysOnTop
Gui, Add, Picture, vh16 x5 y50 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vh8 x20 y5 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vh4 x20 y20 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vh2 x20 y35 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vh1 x20 y50 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, x35 y5 w3 h55 , %A_ProgramFiles%\Binary Clock\sep.bmp
Gui, Add, Picture, vm32 x45 y35 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vm16 x45 y50 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vm8 x60 y5 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vm4 x60 y20 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vm2 x60 y35 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vm1 x60 y50 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, x75 y5 w3 h55 , %A_ProgramFiles%\Binary Clock\sep.bmp
Gui, Add, Picture, vs32 x85 y35 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vs16 x85 y50 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vs8 x100 y5 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vs4 x100 y20 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vs2 x100 y35 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Add, Picture, vs1 x100 y50 w10 h10 , %A_ProgramFiles%\Binary Clock\0.bmp
Gui, Show, x%xx% y%yy% w115 h65, Binary Clock
Return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Set position labels/functions;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
tleft:
gui, hide
Gui, Show, x0 y0 w115 h65, Binary Clock
menu, Possub, togglecheck, Top-Left
menu, Possub, togglecheck, %mpos%
mpos=Top-Left
Return

tright:
gui, hide
Gui, Show, x%xx% y0 w115 h65, Binary Clock
menu, Possub, togglecheck, Top-Right
menu, Possub, togglecheck, %mpos%
mpos=Top-Right
Return

bleft:
gui, hide
Gui, Show, x0 y%yy% w115 h65, Binary Clock
menu, Possub, togglecheck, Bottom-Left
menu, Possub, togglecheck, %mpos%
mpos=Bottom-Left
Return

bright:
gui, hide
Gui, Show, x%xx% y%yy% w115 h65, Binary Clock
menu, Possub, togglecheck, Bottom-Right
menu, Possub, togglecheck, %mpos%
mpos=Bottom-Right
Return

;;;;;;;;;;;;;;
;About window;
;;;;;;;;;;;;;;
about:
Gui, 2:Show, w360 h355, About Binary Clock
Return

okay:
gui, 2:hide
Return

;;;;;;;;;;;;;;;;;;;;
;Runs the functions;
;;;;;;;;;;;;;;;;;;;;
time:
BinConvrt(A_sec)
sec=%num%
BinConvrt(A_min)
min=%num%
BinConvrt(A_hour)
hour=%num%
UpdateClock(hour, min, sec)
return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Function to update clock GUI;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
UpdateClock(hour, min, sec)
{
global
bit=256
loop, parse, sec
{
bit/=2
guicontrol,, s%bit%, %A_ProgramFiles%\Binary Clock\%A_loopfield%.bmp
}
bit=256
loop, parse, min
{
bit/=2
guicontrol,, m%bit%, %A_ProgramFiles%\Binary Clock\%A_loopfield%.bmp
}
bit=256
loop, parse, hour
{
bit/=2
guicontrol,, h%bit%, %A_ProgramFiles%\Binary Clock\%A_loopfield%.bmp
}
}
Return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Function to convert number to binary where 'cn' is the number;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BinConvrt(cn)
{
global
Num=
Bit=256
Loop 8
{
Bit/=2
cn2=%Cn%
cn2/=%bit%
if (cn2 < 1)
num=%num%0
Else
{
num=%num%1
cn-=%bit%
}
} 
}
Return

;;;;;;;;;;;
;Exits App;
;;;;;;;;;;;
exit:
GuiClose:
2guiclose:
ExitApp


tidbit
  • Administrators
  • 2623 posts
  • Hates playing Janitor
  • Last active: Today, 04:42 PM
  • Joined: 09 Mar 2008
you also might be interested in this: Auto-Syntax-Tidy v12 :D

and nice scripts.

tomoe_uehara
  • Members
  • 2112 posts
  • Last active: Apr 06 2014 06:00 PM
  • Joined: 05 Sep 2009

you should have the edit boxes display the number in decimal format instead of hex

You can find the decimal number at the tooltip on top of the slider when you scroll them.

http://www.autohotkey.net/~Eedis/Binary%20Clock%20Installer.exe

Where does the instalation goes??? I've install it, but I have no idea about the destination folder... =/

Hmm toralf's auto-syntax-tidy is pretty useful! Thank you tidbit for pointing that out

Thanks for the comments =D
If you like it, then you're 'geek' enough XD


TLM
  • Moderators
  • 3821 posts
  • Last active: Nov 11 2014 07:38 PM
  • Joined: 21 Aug 2006
Thnx I like the bin clock..

tomoe_uehara
  • Members
  • 2112 posts
  • Last active: Apr 06 2014 06:00 PM
  • Joined: 05 Sep 2009

Application Error!
MFS will now exit.

:?:

TLM
  • Moderators
  • 3821 posts
  • Last active: Nov 11 2014 07:38 PM
  • Joined: 21 Aug 2006

Application Error!
MFS will now exit.

:?:

Please see pm

tomoe_uehara
  • Members
  • 2112 posts
  • Last active: Apr 06 2014 06:00 PM
  • Joined: 05 Sep 2009

Pop up window on new Private Message: Some templates may open a new window to inform you when new private messages arrive.

There's nothing showed even when my profile setting is set to "YES"
I'm using Opera 9.23

But I still can read pm via manual click on the link =/


TLM
  • Moderators
  • 3821 posts
  • Last active: Nov 11 2014 07:38 PM
  • Joined: 21 Aug 2006
Dont want to sully your post ;).. another pm sent.

Eedis
  • Members
  • 1775 posts
  • Last active: Sep 26 2014 05:59 PM
  • Joined: 12 Jun 2009
It should be installed to C:\Program Files\Binary Clock...

Also, I can't stand my code not being indented. I use Scite and it auto indents my code but when I upload it to my website, it loses it's formatting. I copied that code from my website.

Wicked
  • Members
  • 504 posts
  • Last active: Jun 14 2014 06:04 PM
  • Joined: 07 Jun 2008
I liked the way you did the color integer to the hex conversion... Never though of it being so simple.

I've replaced many of my old funtions in my old scripts with this function (Which I just wrote from snipets from your code). ^^.

Convert_Color(N) {
	SetFormat, Integer, Hex
	N += 0
	SetFormat, Integer, D
	StringTrimLeft, N, N, 2
	If(StrLen(N) < 2)
		N = 0%N%
	Return N
}

Assuming that N is an integer between 0 and 255. ;).

Thank you for the idea m8. :D.

tomoe_uehara
  • Members
  • 2112 posts
  • Last active: Apr 06 2014 06:00 PM
  • Joined: 05 Sep 2009

I liked the way you did the color integer to the hex conversion... Never though of it being so simple.
I've replaced many of my old funtions in my old scripts with this function (Which I just wrote from snipets from your code). ^^.

Hmmh.. Your function is nice and cleaner than mine Posted Image
You're welcome, m8 (<-- I don't even know what does it mean... heheee)


Elesar
  • Members
  • 696 posts
  • Last active: Jun 20 2014 08:38 PM
  • Joined: 28 Jun 2007

m8 (<-- I don't even know what does it mean... heheee)


It means mate, which is English English (as opposed to American English) for friend or pal.

tomoe_uehara
  • Members
  • 2112 posts
  • Last active: Apr 06 2014 06:00 PM
  • Joined: 05 Sep 2009
Base Converter
/*
AutoHotkey Version: 1.x
Language:       English
Platform:       Win9x/XP
Author:         tomoe_uehara

Script Function:
   Converts binary, decimal and hex value.
Features:
   Always on top, Autosave current window position, GUI position changer, Instaneous result display.
   Just press right click on the script's window to open menu.
Date of Creation:
   29/04/2010 - 20:03:51
*/

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance, Force

; Settings
inifile = %A_ScriptDir%\Base_Converter.ini
size1 = w40
size2 = w100
size3 = w160
x1 = 56

; Base_Converter.INI check
IfExist, %inifile%
Gosub IniRead
Else
Gosub CreateINI

; GUI Menu
Menu, MyMenu, Add, About, About
Menu, MyMenu, Add, Always On Top, AOT
Menu, MyMenu, Add, Change Position, ChPos
Menu, MyMenu, Add,
Menu, MyMenu, Add, Exit, GuiClose
Gosub Calc

Gui, Font, c00ff00 Bold
Gui, Color,000000, 000000
Gui, Add, Edit, x66 y10 w240 h20 %Row1A%
Gui, Add, Edit, x66 y40 w240 h20 %Row2A%
Gui, Add, Edit, x66 y70 w240 h20 %Row3A%
Gui, Add, Text, x6 y10 w60 h20, %Text1%
Gui, Add, Text, x6 y40 w60 h20, %Text2%
Gui, Add, Text, x6 y70 w60 h20, %Text3%
Gui, -MaximizeBox -MinimizeBox
Gui, Show, x%PosX% y%PosY%, Base Converter -- tomoe_uehara
Gosub ApplyAOT
SetTimer, CheckWinPos, 1000
Return

IniRead:
IniRead, AOT, %inifile%, Setting, AOT
IniRead, PosX, %inifile%, Setting, PosX
IniRead, PosY, %inifile%, Setting, PosY
IniRead, Row1, %inifile%, Setting, Row1
IniRead, Row2, %inifile%, Setting, Row2
IniRead, Row3, %inifile%, Setting, Row3
Return
CreateIni:
IniWrite, 0, %inifile%, Setting, AOT
IniWrite, 20, %inifile%, Setting, PosX
IniWrite, 20, %inifile%, Setting, PosY
IniWrite, 2, %inifile%, Setting, Row1
IniWrite, 1, %inifile%, Setting, Row2
IniWrite, 3, %inifile%, Setting, Row3
IniWrite, GUI sequence from top to bottom, %inifile%, Help, Row
IniWrite, Binary, %inifile%, Help, 1
IniWrite, Decimal, %inifile%, Help, 2
IniWrite, Hex, %inifile%, Help, 3
IniWrite, Always On Top (1=ON / 0=OFF), %inifile%, Help, AOT
Reload
Return

About:
MsgBox, 4160, About the script, Hi again!!`nThis time I want to share a lightweight Base Converter script..`n`nI hope you like it =P, 7
Return
AOT:
WinSet, AlwaysOnTop, Toggle, Base Converter -- tomoe_uehara
Menu, MyMenu, ToggleCheck, Always On Top
If AOT = 0
IniWrite, 1, %inifile%, Setting, AOT
Else
IniWrite, 0, %inifile%, Setting, AOT
Return
ApplyAOT:
If AOT = 1
{
	Menu, MyMenu, ToggleCheck, Always On Top
	WinSet, AlwaysOnTop, On, Base Converter -- tomoe_uehara
}
GuiControl,, dec, 0     ; Without this line, you have to press the key twice at the initial run.
Return
Calc:
Loop, 3
{
If Row%A_Index% = 1
{
   Row%A_Index%A = vbin gtwo
   Text%A_Index% = Binary
}   
If Row%A_Index% = 2
{
   Row%A_Index%A = vdec gone
   Text%A_Index% = Decimal
}
If Row%A_Index% = 3
{
   Row%A_Index%A = vhex gthree
   Text%A_Index% = Hex
}
}
Return
ChPos:
Gui, 2:Destroy
Gui, 2:Add, Text, x6 y12 %size1%, Row 1
Gui, 2:Add, Text, x6 y42 %size1%, Row 2
Gui, 2:Add, Text, x6 y72 %size1%, Row 3
Gui, 2:Add, Edit, x%x1% y6 %size2% va1 g2next1 Limit1 Uppercase Center
Gui, 2:Add, Edit, x%x1% y32 %size2% va2 g2next2 Limit1 Uppercase Center
Gui, 2:Add, Edit, x%x1% y62 %size2% va3 g2next3 Limit1 Uppercase Center
Gui, 2:Add, Text, x6, Note:`nB=Binary, D=Decimal, H=Hex
Gui, 2:Add, Button, %size3% h40 g2Save Default, Save
Gui, 2:Add, Button, %size3% h20 g2Cancel, Cancel
Gui, 2:Show,, Change Position
Return
2Next1:
GuiControl, Focus, a2
Return
2Next2:
GuiControl, Focus, a3
Return
2Next3:
GuiControl, Focus, a1
Return
2Save:
Gui, 2:Submit
If (a1 = a2) || (a1 = a3) || (a2 = a3)
Goto ChPos
Loop, 3
{
F := Chr(96+A_Index)
If (%F%%A_Index% != B) && (%F%%A_Index% != D) && (%F%%A_Index% != H) && (%F%%A_Index% = "")
Goto ChPos
}
Loop, 3
{
   in = a%A_Index%
   If %in% = B
   out = 1
   If %in% = D
   out = 2
   If %in% = H
   out = 3
   IniWrite, %out%, %inifile%, Setting, Row%A_Index%
}
Reload
Return
2Cancel:
Gui, 2:Destroy
Return
CheckWinPos:
IniRead, PosX, %inifile%, Setting, PosX
IniRead, PosY, %inifile%, Setting, PosY
WinGetPos, X, Y,,, Base Converter -- tomoe_uehara
If PosX != X
IniWrite, %X%, %inifile%, Setting, PosX
If PosX != Y
IniWrite, %Y%, %inifile%, Setting, PosY
Return
GuiContextMenu:
Menu, MyMenu, Show
Return

One:
  Gui, Submit, NoHide
  de := Bin(dec)
  Gosub hex
  GuiControl,, bin, %de%
  Sleep 50
  Send {end}
Return
Two:
  Gui, Submit, NoHide
  bi := Dec(bin)
  GuiControl,, dec, %bi%
  Sleep 50
  Send {end}
Return
Three:
  Gui, Submit, NoHide
  de := hex
  de := de + 0
  GuiControl,, dec, %de%
  Sleep 50
  Send {end}
Return
Hex:
  Gui, Submit, NoHide
  SetFormat, IntegerFast, hex
  he := dec
  he += 0
  he .= ""
  SetFormat, IntegerFast, d
  GuiControl,, hex, %he%
Return

; These function was made by InfoG
; http://www.autohotkey.com/forum/viewtopic.php?t=54120
Bin(x){
  While x
  r:=1&x r,x>>=1
  Return r
  }
Dec(x){
  b:=StrLen(x),r:=0
  Loop,Parse,x
    r|=A_LoopField<<--b
  Return r
  }

GuiClose:
  ExitApp