Jump to content

Recommended Posts

Posted

What does -3 mean?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted
31 minutes ago, SadBunny said:

EndFunc   ;==>quitter

 

34 minutes ago, SadBunny said:

Just add the required amount of milliseconds to the return value of TimerDiff().

HotKeySet("{ESC}", "quitter")

$timer = TimerInit()

While True
    Sleep(100)
    ConsoleWrite(TimerDiff($timer) + 10000 & @CRLF)
WEnd

Func quitter()
    Exit
EndFunc   ;==>quitter

 

No, how to set the timer value of for example 2:33.(sorry for my English)

Posted

... I think OP needs to set the starting time (instead of just starting from 00:00:00)
You could set a time offset equal to your wanted start time and then add it to the actual calculated TimerDiff()
maybe something like this?:

#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <Timers.au3>
#include <Date.au3>

Global $TimeLabel
Global $timer
Global $Secs
Global $Mins
Global $Hour
Global $Time

Global $iMyStartTime = _TimeToTicks(02, 33, 00) ; <--- set your wanted start time here (hh,mm,ss)

$ParentWindow = GUICreate('MyGUI', 400, 400)

$timer = TimerInit()
AdlibRegister("Timer", 50)
$TimeLabel = _WinAPI_CreateWindowEx(0, 'Static', '', BitOR($WS_CHILD, $WS_VISIBLE), 5, 228, 100, 14, $ParentWindow)

GUISetState()


Func Timer()
    _TicksToTime($iMyStartTime + Int(TimerDiff($timer)), $Hour, $Mins, $Secs) ; <--- add your start time offset to TimerDiff()
    $Time = StringFormat("Time: " & "%02i:%02i:%02i", $Hour, $Mins, $Secs)
    _WinAPI_SetWindowText($TimeLabel, $Time)
EndFunc   ;==>Timer

Do

Until GUIGetMsg() = -3

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

  • Moderators
Posted

wasd-w,

Perhaps this?

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <UpDownConstants.au3>

Global $iReqMin = 99, $iLastSec = 99

$hGUI = GUICreate("Test", 500, 500)

GUICtrlCreateLabel("Min:", 10, 10, 50, 20)
$cInputMin = GUICtrlCreateInput("0", 70, 10, 80, 20)
GUICtrlCreateUpdown($cInputMin, $UDS_WRAP)
GUICtrlSetLimit(-1, 10, 0)
GUICtrlCreateLabel("Sec:", 10, 50, 50, 20)
$cInputSec = GUICtrlCreateInput("0", 70, 50, 80, 20)
GUICtrlCreateUpdown($cInputSec, $UDS_WRAP)
GUICtrlSetLimit(-1, 59, 0)

$cStartTimer = GUICtrlCreateButton("Start", 10, 200, 80, 30)
$cStopTimer = GUICtrlCreateButton("Stop", 10, 250, 80, 30)
GUICtrlSetState($cStopTimer, $GUI_DISABLE)

$cLabelTimer = GUICtrlCreateLabel("00:00", 10, 300, 200, 50)
GUICtrlSetFont($cLabelTimer, 18)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cStartTimer
            GUICtrlSetState($cStartTimer, $GUI_DISABLE)
            GUICtrlSetState($cStopTimer, $GUI_ENABLE)
            $iReqMin = GUICtrlRead($cInputMin)
            $iReqSec = GUICtrlRead($cInputSec)
            GUICtrlSetData($cLabelTimer, StringFormat("%02i", $iReqMin) & ":" & StringFormat("%02i", $iReqSec))
            GUICtrlSetData($cInputMin, "0")
            GUICtrlSetData($cInputSec, "0")
        Case $cStopTimer
            GUICtrlSetState($cStartTimer, $GUI_ENABLE)
            GUICtrlSetState($cStopTimer, $GUI_DISABLE)
            $iReqMin = 99
            $iLastSec = 99
            GUICtrlSetData($cLabelTimer, "00:00")
    EndSwitch

    If $iReqMin <> 99 And @SEC <> $iLastSec Then
        $iReqSec -= 1
        If $iReqSec = -1 Then
            $iReqMin -= 1
            $iReqSec = 59
        EndIf
        GUICtrlSetData($cLabelTimer, StringFormat("%02i", $iReqMin) & ":" & StringFormat("%02i", $iReqSec))
        If $iReqMin + $iReqSec = 0 Then
            MsgBox($MB_SYSTEMMODAL, "Timer", "Ring, ring!")
            GUICtrlSetState($cStartTimer, $GUI_ENABLE)
            $iReqMin = 99
        EndIf
        $iLastSec = @SEC
    EndIf


WEnd

M23

P.S. When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders what they wrote and it just pads the thread unnecessarily.

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted
2 hours ago, Chimp said:

... I think OP needs to set the starting time (instead of just starting from 00:00:00)
You could set a time offset equal to your wanted start time and then add it to the actual calculated TimerDiff()
maybe something like this?:

#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <Timers.au3>
#include <Date.au3>

Global $TimeLabel
Global $timer
Global $Secs
Global $Mins
Global $Hour
Global $Time

Global $iMyStartTime = _TimeToTicks(02, 33, 00) ; <--- set your wanted start time here (hh,mm,ss)

$ParentWindow = GUICreate('MyGUI', 400, 400)

$timer = TimerInit()
AdlibRegister("Timer", 50)
$TimeLabel = _WinAPI_CreateWindowEx(0, 'Static', '', BitOR($WS_CHILD, $WS_VISIBLE), 5, 228, 100, 14, $ParentWindow)

GUISetState()


Func Timer()
    _TicksToTime($iMyStartTime + Int(TimerDiff($timer)), $Hour, $Mins, $Secs) ; <--- add your start time offset to TimerDiff()
    $Time = StringFormat("Time: " & "%02i:%02i:%02i", $Hour, $Mins, $Secs)
    _WinAPI_SetWindowText($TimeLabel, $Time)
EndFunc   ;==>Timer

Do

Until GUIGetMsg() = -3

 

Tnx):lol:

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
×
×
  • Create New...