WideBoyDixon Posted May 19, 2009 Share Posted May 19, 2009 (edited) I found another GDI+ clock program so again I set about converting it to AutoIt. I've attached a ZIP with the script and a number of themes that can be used. You can create your own themes by creating PNG files for the dial and the various needles. You also need to specify the coordinates for the centre of the images and put all the information in the clockSettings.ini file.You'll be pleased to know that this one uses minimal CPU as I'm using WM_TIMER to draw the clock so the main program loop is one big Sleep (one minute at a time). I'd be very interested to see if anyone makes new skins for this.The full package can be downloaded from HEREWBDEDIT: Fixed jumping second hand, included new themes and moved the code to Google Edited May 20, 2009 by WideBoyDixon [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
gseller Posted May 19, 2009 Share Posted May 19, 2009 That is really nice! Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2009 Share Posted May 19, 2009 Pretty sharp WideBoy!!! Now to add in the alarm settings... 8) Link to comment Share on other sites More sharing options...
martin Posted May 19, 2009 Share Posted May 19, 2009 (edited) I found another GDI+ clock program so again I set about converting it to AutoIt. I've attached a ZIP with the script and a number of themes that can be used. You can create your own themes by creating PNG files for the dial and the various needles. You also need to specify the coordinates for the centre of the images and put all the information in the clockSettings.ini file. You'll be pleased to know that this one uses minimal CPU as I'm using WM_TIMER to draw the clock so the main program loop is one big Sleep (one minute at a time). I'd be very interested to see if anyone makes new skins for this. WBD It lovely! One small thing though, the centre of the clock jumps up and down when the second hand comes round to the 6. Edited May 19, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 19, 2009 Author Share Posted May 19, 2009 I know about the jumping ... I'll try and investigate. It's got something to do with using GDI+ to rotate the images I think. Just for fun, I've added a new theme on the first post ... An AutoIt3 clock WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
youknowwho4eva Posted May 19, 2009 Share Posted May 19, 2009 (edited) The second hand also moves 62 times per revolution. And the minute hand moves when @sec = 0. I'm guessing some of the placement issues are caused by you dividing 0 by a number at certain places. Edit: I looked through, and can't understand 85% of everything but changing the 3 drawneedle calls to If @min <> 0 Then _DrawNeedle($graph, $hourNeedle, $aH[0], $aH[1], @HOUR * 30 + (@MIN / 2)) Else _DrawNeedle($graph, $hourNeedle, $aH[0], $aH[1], @HOUR * 30) EndIf If @sec <> 0 Then _DrawNeedle($graph, $minuteNeedle, $aM[0], $aM[1], @MIN * 6 + (@SEC / 10)) Else _DrawNeedle($graph, $minuteNeedle, $aM[0], $aM[1], @MIN * 6) EndIf _DrawNeedle($graph, $secondNeedle, $aS[0], $aS[1], @SEC * 6) seems to fix the @sec = 0 and probably the rarer @min = 0 that I haven't ran it long enough to see. Edited May 19, 2009 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
mesale0077 Posted May 19, 2009 Share Posted May 19, 2009 very nice Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 19, 2009 Author Share Posted May 19, 2009 If @min <> 0 Then _DrawNeedle($graph, $hourNeedle, $aH[0], $aH[1], @HOUR * 30 + (@MIN / 2)) Else _DrawNeedle($graph, $hourNeedle, $aH[0], $aH[1], @HOUR * 30) EndIf If @sec <> 0 Then _DrawNeedle($graph, $minuteNeedle, $aM[0], $aM[1], @MIN * 6 + (@SEC / 10)) Else _DrawNeedle($graph, $minuteNeedle, $aM[0], $aM[1], @MIN * 6) EndIf Totally unnecessary? If @MIN = 0 Then @MIN / 2 = 0. That's not divide BY zero; it's dividing zero by 2 or 10. The above won't make any difference. I experimented with the following replacement for _DrawNeedle(): Func _DrawNeedle($graph, $pNeedle, $nNeedleCenterX, $nNeedleCenterY, $rAngle) Local $status = DllCall($ghGDIPDll, "int", "GdipRotateWorldTransform", "hwnd", $graph, "float", $rAngle, "int", 1) $status = DllCall($ghGDIPDll, "int", "GdipTranslateWorldTransform", "hwnd", $graph, "float", $aD[0], "float", $aD[1], "int", 1) _GDIPlus_GraphicsDrawImageRect($graph, $pNeedle, -$nNeedleCenterX - ($rAngle = 180), -$nNeedleCenterY - ($rAngle = 180), _ _GDIPlus_ImageGetWidth($pNeedle), _GDIPlus_ImageGetHeight($pNeedle)) $status = DllCall($ghGDIPDll, "int", "GdipResetWorldTransform", "hwnd", $graph) EndFunc ;==>_DrawNeedle That seems to solve the jump but it's not very elegant. I'm not sure why GDI+ is getting the rotation wrong :-/ WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 20, 2009 Author Share Posted May 20, 2009 (edited) Just for fun, I created another theme for this. It's my first stab at emulating a Mickey Mouse watch. See first post. WBD EDIT: Removed attachment and moved code to Google. Edited May 20, 2009 by WideBoyDixon [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
GreenCan Posted July 9, 2009 Share Posted July 9, 2009 @WideBoyDixon, A bit late for a reaction but anyhow... congrats with your GDI clock, well done GreenCan Contributions CheckUpdate - SelfUpdating script ------- Self updating script Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple MsgBox with CountDown ------------------- MsgBox with visual countdown Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV) USB Drive Tools ------------------------------ Tool to help you with your USB drive management Input Period udf ------------------------------ GUI for a period input Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette Excel Chart UDF ----------------------------- Collaboration project with water GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm TaskListAllDetailed --------------------------- List All Scheduled Tasks Computer Info --------------------------------- A collection of information for helpdesk Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only) Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane Oracle SQL Report Generator ------------- Oracle Report generator using SQL SQLite Report Generator ------------------- SQLite Report generator using SQL SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access Animated animals ----------------------------- Fun: Moving animated objects Perforated image in GUI --------------------- Fun: Perforate your image with image objects UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool Visual Image effect (GUI) -------------------- Visually apply effects on an image Link to comment Share on other sites More sharing options...
yehia Posted July 9, 2009 Share Posted July 9, 2009 i like it so much but i was wondering how did u draw the pngs of alarm and the normal clock both r awesome i mean the light reflections and the shadow after the alarm My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
Info Posted July 9, 2009 Share Posted July 9, 2009 Nice I'm having a hard time with that clock, perhaps make an option to change it to a digital cloak? Link to comment Share on other sites More sharing options...
WideBoyDixon Posted July 9, 2009 Author Share Posted July 9, 2009 i like it so much but i was wondering how did u draw the pngs of alarm and the normal clock both r awesomei mean the light reflections and the shadow after the alarmI didn't draw them. I took them from the original code that I converted.Nice I'm having a hard time with that clock, perhaps make an option to change it to a digital cloak?That would kinda delete the purpose of using GDI+ to rotate the hands of the clock.WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
dantay9 Posted July 10, 2009 Share Posted July 10, 2009 Nice Clock! I like the ability to change the themes. Link to comment Share on other sites More sharing options...
netxfly Posted July 10, 2009 Share Posted July 10, 2009 oh,my god, so big a clock! very nice, keep up! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now