Sign in to follow this  
Followers 0
WideBoyDixon

Yet another clock

15 posts in this topic

#1 ·  Posted (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 HERE

WBD

EDIT: Fixed jumping second hand, included new themes and moved the code to Google

Edited by WideBoyDixon

Share this post


Link to post
Share on other sites



That is really nice!

Share this post


Link to post
Share on other sites

Pretty sharp WideBoy!!!

Now to add in the alarm settings... :)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by youknowwho4eva

Giggity

Share this post


Link to post
Share on other sites

very nice

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by WideBoyDixon

Share this post


Link to post
Share on other sites

@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

 

 

 

Share this post


Link to post
Share on other sites

Nice :)

I'm having a hard time with that clock, perhaps make an option to change it to a digital cloak?

Share this post


Link to post
Share on other sites

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

I 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

Share this post


Link to post
Share on other sites

Nice Clock! I like the ability to change the themes.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

oh,my god, so big a clock!

very nice, keep up!

Share this post


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
Sign in to follow this  
Followers 0