Page 2 of 2

Re: Masonjar13's Library List

Posted: 30 Aug 2017, 03:06
by Masonjar13
Added getCurrentTime() and getUTCOffset() (both require urlDownloadToVar() and strToLower())

Both use http://www.timeanddate.com, which uses TLS 1.2. If you're receiving an error from urlDownloadToVar(), see this page.

Examples:

Code: Select all

country:="Canada"
region:="Ontario"
timezone:="IST"


cTime:=getCurrentTime(country,region)
if(!cTime)
    msgbox,,Error,Area not found
else
    msgbox,,Time,% "Current time in " . (region?region . ", ":"") . country . ":`n`n" . cTime.hour . ":" . cTime.minute . cTime.ampm . ", " . cTime.date

tTime:=getCurrentTime(timezone,,1)
if(!tTime)
    msgbox,,Error,Timezone not found
else
    msgbox,,Time,% "Current time in " . timezone . ":`n`n" . tTime.hour . ":" . tTime.minute . tTime.ampm . ", " . tTime.date
exitApp

Code: Select all

timezone:="IST"


UTCOffset:=getUTCOffset(timezone)
if(!UTCOffset)
    msgbox,,Error,Timezone not found
else
    msgbox,,UTC Offset,% "Offset for " . timezone . ": " . UTCOffset.sign . UTCOffset.hour . ":" . UTCOffset.minute
exitApp
The reason for getting the UTC offset is to allow client-side math to be performed to a_nowUTC for an active clock. Much more efficient than having to query the server constantly.

Code: Select all

timezone:="EDT"

UTCO:=getUTCOffset(timezone)
if(!UTCO)
    msgbox,,Error,Timezone not found
else
    setTimer,activeClock,100
return

activeClock:
cStamp:=a_nowUTC
if(UTCO.sign="+")
    cStamp+=UTCO.hour * 10000 + UTCO.minute * 100
else if(UTCO.sign="-")
    cStamp-=UTCO.hour * 10000 + UTCO.minute * 100
else{
    setTimer,activeClock,off
    msgbox,,Error,Sign could not be retrieved
}
formatTime,timezoneCTime,% cStamp,h:mmtt
tool(timezone . ": " . timezoneCTime)
return

esc::exitApp

Re: Masonjar13's Library List

Posted: 25 Jan 2018, 21:14
by Masonjar13
Important update!

With the release of AutoHotkey 1.1.27.00, Min() has been added as a native function. This function does not operate the same, so I've renamed all related functions (see newest commit).

Re: Masonjar13's Library List

Posted: 14 Feb 2018, 22:28
by Masonjar13
Update!

Fixed exec[A]Func in threadMan class. I hadn't actually used it, so I never really knew if it worked or not (and nobody mentioned anything). Both allow up to 10 parameters. If there's a way to do a dynamic call so hard-coded exceptions aren't needed, please let me know!

Re: Masonjar13's Library List

Posted: 06 Mar 2018, 19:20
by pneumatic
Hi Masonjar

Came across a post of yours here regarding animated cursors not being restored after hiding them
https://autohotkey.com/board/topic/5727 ... ntry654705

Not sure if you had seen the fix, and I couldn't find it in your library, but it seems the animations can be restored by the example here
https://autohotkey.com/board/topic/3260 ... em-cursor/

Code: Select all

SPI_SETCURSORS := 0x57
DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORS, UInt,0, UInt,0, UInt,0 ) ; Reload the system cursors
It seems to work. Even if I change to different cursors in the windows mouse control panel, they are restored to those cursors and with animations. However this is on Windows 7.

I wanted this feature for the borderless full screen mode issue when the mouse cursor gets displayed on top of the game window. The Borderless Gaming app has this fix, and I wanted it in my own as well, and restoring the cursor properly with full animations.

Re: Masonjar13's Library List

Posted: 06 Mar 2018, 20:22
by Masonjar13
I stopped trying to do it, because I came up with a solution more fitted. My problem was when the cursor would be visible over videos, especially when using VLC. So I made a 1x1 gui with WinSet,Transparent, locked the mouse buttons/mouse movement, and placed the gui to the cursor coordinates.

Glad to see there's a proper way to restore cursors though; thanks for letting me know!

Re: Masonjar13's Library List

Posted: 08 Mar 2018, 01:15
by Masonjar13
Turns out that Dazzlepod is blocking some VPN servers, some of which I happen to be using. If anyone knows of an alternative site that uses minimal bandwidth (such as a single json file) (location necessary), please let me know!

Re: Masonjar13's Library List

Posted: 16 Mar 2018, 13:46
by burque505
Hi Masonjar13, maybe it's too resource-heavy for your purposes, but this one works well for me through a VPN.
Regards,
burque505

Re: Masonjar13's Library List

Posted: 17 Mar 2018, 11:51
by Masonjar13
That's actually not bad at 60kb, but still pretty heavy. Fortunately, I found what I was looking for: https://ipapi.co/json/. I'll implement this as a secondary to Dazzlepod, because it appears to be in beta and may not always be free to use.

For those interested, visit the main site to see what all their API can do. It's quite nice!

Edit: I lied. Kept the old stuff in comments, but since this also supports v6, and the other one I had in there for v6 has limited queries per IP, I've just replaced it entirely.

On that note, externalIP() has been updated. Returning object changed slightly (info in comments).

Re: Masonjar13's Library List

Posted: 17 Mar 2018, 16:42
by burque505
Thanks for that link! Now that's what I call lightweight. Just tested it through the VPN, works fine.

Re: Masonjar13's Library List

Posted: 14 Apr 2018, 14:42
by Masonjar13
Seems like Dazzlepod is now working through my VPN now. Still keeping the new one, of course, but at least I can use their nmap scan with it again :)

Update!
Added stringify(obj)
Added addScript and addFile methods to threadMan class

Since stringify seems kind of ambiguous, I'll explain why I wrote it. Objects can't be set to DLL threads via ahkassign, so I needed a workaround. I could be wrong, since I don't actually look at the change logs for _H, but the addScript and addFile functions seem to be new, or I at least didn't notice them in the help file prior. By making an object a string, you can effectively give it an object by adding it as code.

Code: Select all

#include <threadMan>

testObj:={key1:"content for key1"}
testThread:=new threadMan("AutoHotkey.dll")
testThread.newFromFile("example2.ahk")
testThread.addScript("testObj:=" . stringify(testObj),1)
while(testThread.status())
    sleep 100
testThread:=
exitApp

Code: Select all

while(!isObject(testObj))
    sleep 10
for i,a in testObj
    msgbox % "key: " . i . "`nvalue: " . a
exitApp

Re: Masonjar13's Library List

Posted: 17 Apr 2018, 12:30
by Masonjar13
Updated the readme. Each function/class now shows required other functions/libraries (if applicable) and a short description. Doesn't look all that pretty, but at least there's more info!

Re: Masonjar13's Library List

Posted: 11 Aug 2018, 19:15
by Masonjar13
Update!
Changed the readme; all functions and descriptions are now in a table.
I ripped out the guts from PinAuth/PIN class to make a base class for a db. PIN will now be an extended class of the db class.

Check the commit for more details!

Re: Masonjar13's Library List

Posted: 15 Oct 2018, 23:05
by CyL0N
Sup dude,Awesome lib.

externalIP() returns ipInfo instead of ipInfoList,just thought you'd want to fix that...

Re: Masonjar13's Library List

Posted: 15 Oct 2018, 23:41
by Masonjar13
CyL0N wrote:
15 Oct 2018, 23:05
Sup dude,Awesome lib.
Thanks, glad you like it!
CyL0N wrote:
15 Oct 2018, 23:05
externalIP() returns ipInfo instead of ipInfoList,just thought you'd want to fix that...
:eh: Strange.. My local copy is correct. Thanks for pointing that out, fixed :thumbup: