Current Hour & Current Minute

Get help with using AutoHotkey and its commands and hotkeys
Jamesraywebber85
Posts: 2
Joined: 25 Jan 2018, 11:21

Current Hour & Current Minute

25 Jan 2018, 11:29

Good morning,

I am brand new to AutoHotKey & just learning scripting. I currently have this script which puts data in the field through google Chrome. The 17th line is asking for the current hour & line 20 is asking for the current minuet. Can anyone help me out please? I have included the script for your help - thank you in advance.

Code: Select all

{
Run chrome.EXE "http://projects/PWA/ERP Project/Team Portal/Lists/New Triage/NewForm.aspx"
Sleep, 100
WinWait, ERP Triage - New Item - Google Chrome, 
IfWinNotActive, ERP Triage - New Item - Google Chrome, , WinActivate, ERP Triage - New Item - Google Chrome, 
WinWaitActive, ERP Triage - New Item - Google Chrome, 
Sleep, 2000
Send {t}{t}{t}
Send, {Tab}
Sleep, 100
Send {k}
Sleep, 100
Send {tab}
SendInput %CurrentDateandTime%
Send {tab}
Sleep, 100
SendInput %wHour%
Send {tab}
Sleep, 100
SendInput %wMinute%
Send {tab}
Sleep, 100
Send rwebber
Send {tab 3}
Sleep, 100
Send, {2}
Send {tab 2}
Send {k}
Sleep, 100
Send, {Tab 3}
Send {s}{s}
Sleep, 100
Send, {Tab 4}
Sleep, 100
Send rwebber
Sleep, 100
Send {tab 3}
Sleep, 100
Send rwebber
Send {tab 6}
}
Jamesraywebber85
Posts: 2
Joined: 25 Jan 2018, 11:21

Re: Current Hour & Current Minuet

25 Jan 2018, 11:38

Just to clearify, the time on the site is in 12hr format so i need it to know AM or PM
BoBo
Posts: 2519
Joined: 13 May 2014, 17:15

Re: Current Hour & Current Minuet

25 Jan 2018, 11:49

As this is for a productive support environment (?), I'd go with IE and COM to inject that data into your trouble ticket interface. That might look more complicated but is more stable/reliable.
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Current Hour & Current Minute

25 Jan 2018, 11:58

A_Hour, A_Min etc. give current time values.
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Current Hour & Current Minute

25 Jan 2018, 12:01

You may be interested in using FormatTime to process the current time (read the documentation, if you don't pass in an acceptable value, it defaults to using the current time) into a structure of Hour, Minute, and AM/PM as you need.
User avatar
jeeswg
Posts: 6715
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Current Hour & Current Minute

25 Jan 2018, 12:10

Here's a way to get some date/time information.

Code: Select all

q:: ;get hour (AM/PM) and minute
;FormatTime, vDate,, hh mm tt ;e.g. 01 01 PM
FormatTime, vDate,, h m tt ;e.g. 1 1 PM
vHour := StrSplit(vDate, " ")[1]
vMin := StrSplit(vDate, " ")[2]
vAmPm := StrSplit(vDate, " ")[3]
MsgBox, % vHour " " vMin " " vAmPm
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
partof
Posts: 95
Joined: 16 Jan 2016, 08:38

Re: Current Hour & Current Minute

31 Dec 2018, 11:11

Code: Select all

:*:hhh:: ; >> 17h10
SendInput %A_Hour%h%A_Min%
return


:*:hhs:: ; >> 17:10:53
SendInput %A_Hour%:%A_Min%:%A_Sec%
return

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], MannyKSoSo, mladpetco, snowmind and 247 guests