Masonjar13's Library List

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Masonjar13's Library List

24 May 2016, 18:17

I'm always making new functions, so I decided to post a decent amount of them here. Several are modified functions of others' and should be noted as such. If they derived from someone elses code and isn't noted as such, please let me know, thanks.

Note: some are just commands turned into functions. You may also notice syntax style varies, which is due to some being written as long as 3 years ago.

The library has been moved to Github.
Last edited by Masonjar13 on 29 Jul 2016, 02:38, edited 6 times in total.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
florisvos
Posts: 20
Joined: 15 Apr 2016, 06:26

Re: Masonjar13's Library List

26 May 2016, 12:23

Interesting! I very often turn to google to find the exact way of typing certain AHK functions, or I turn to previous scripts to find some code-lines I need (instead of writing it again from scratch).

I suppose it is very helpfull to have a list of functions stored somewhere where you can always turn to when making a new script... No need to turn to google or other scripts all the time! Not sure if I will ever need to convert an hours to milliseconds or something like that - but I really like the concept of a list like this :)
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

26 May 2016, 12:29

florisvos wrote:I suppose it is very helpfull to have a list of functions stored somewhere where you can always turn to when making a new script.
You can save these to your standard library, so you won't ever need to include them. Check here.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
florisvos
Posts: 20
Joined: 15 Apr 2016, 06:26

Re: Masonjar13's Library List

26 May 2016, 12:49

Masonjar13 wrote:
florisvos wrote:I suppose it is very helpfull to have a list of functions stored somewhere where you can always turn to when making a new script.
You can save these to your standard library, so you won't ever need to include them. Check here.
Thanks so much! Never knew that! So simple but so helpful, I'm sure!
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Masonjar13's Library List

12 Jul 2016, 21:14

Nice collection :)
However, you should use one of the following to get the Ip for less bandwidth usage. ;)

http://dazzlepod.com/ip/me.json
http://checkip.dyndns.org
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

12 Jul 2016, 21:40

Thank you :)
Had I known this existed.. I'll update it soon. It'll be pretty quick, seeing as I don't have to work with any HTML shenanigans. Thanks a lot for this! :thumbup:
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Masonjar13's Library List

12 Jul 2016, 21:58

@Masonjar13 No problem, my friend! :D
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

12 Jul 2016, 23:07

It has been updated. The fact that the "ISP" portion is much longer slightly annoys me, but it works and tells the information it needs to. I implemented a seemingly sound method to get rid of the excess. It's consistent across the IP's I've tested with, anyway. I've also kept the old version in the post as well, noted as such.

Using an old bandwidth monitor I wrote, the difference is quite significant: old method hits (in Kb) from 42-148, where the new method is 3-6. That's 1400-2466 percent less bandwidth used ;)

P.S. If someone has a problem with my excess ridding method for the organization/ISP string (cutting off too much or too little), post the string and I'll see if I can fix it.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
Guest

Re: Masonjar13's Library List

12 Jul 2016, 23:52

Using a JSON lib instead of RegEx. ;)

Code: Select all

IPInfo := externalIP()
MsgBox, % IPInfo.ip "`n"
    . IPInfo.prefix "`n"
    . IPInfo.country_code "`n"
    . IPInfo.asn "`n"
    . IPInfo.city "`n"
    . IPInfo.country "`n"
    . IPInfo.region "`n"
    . IPInfo.hostname "`n"
    . IPInfo.longitude "`n"
    . IPInfo.latitude "`n"
    . IPInfo.organization

externalIP(){
    static URL := "http://dazzlepod.com/ip/me.json"
    return json_toobj(urlDownloadToVar(URL)) ; https://autohotkey.com/board/topic/96244-func-convert-objects-tofrom-json-like-strings/
}
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

13 Jul 2016, 02:30

Seems like more of a hassle than it's worth for just one file. :roll: If you already use the library, that makes perfect sense, but I'd prefer to: A) keep it simple. B) keep claimed copyright out of my library. I also have no need to work with JSON files, this would be the first and possibly last.
To each their own; I won't be adding that to the first post.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Masonjar13's Library List

13 Jul 2016, 08:51

I thought of the same thing Masonjar13 :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Guest

Re: Masonjar13's Library List

13 Jul 2016, 11:16

I prefer the JSON lib to regex, but that's just me.
permDel
Delete highlighted files (does not recycle)
Doesn't Shift+Delete do this already?

@joedf You thought the same thing as who?
Guest

Re: Masonjar13's Library List

13 Jul 2016, 11:41

Code: Select all

for i, v in externalIP()
    Msg .= """" i """: """ v """`n"
MsgBox, % Msg
return

externalIP() {
    ipInfo := {}
    for i, v in StrSplit(Trim(urlDownloadToVar("http://dazzlepod.com/ip/me.json"), " {}`r`n"), "`n", "`r") {
        s := StrSplit(v, ":", " ,""")
        ipInfo[s.1] := s.2
    }
    return ipInfo
}
Guest

Re: Masonjar13's Library List

13 Jul 2016, 11:53

Another version. This might be better than using StrSplit to split the line at ":", since that could fail if the second part contains a ":".

Code: Select all

externalIP() {
    ipInfo := {}
    for i, v in StrSplit(Trim(urlDownloadToVar("http://dazzlepod.com/ip/me.json"), " {}`r`n"), "`n", "`r")        
        ipInfo[Trim(SubStr(v, 1, (p := InStr(v, ":")) - 1), " """)] := Trim(SubStr(v, p + 1), " , """)
    return ipInfo
}
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

13 Jul 2016, 13:21

Guest wrote:
permDel
Delete highlighted files (does not recycle)
Doesn't Shift+Delete do this already?
Correct, but it prompts the user. Maybe there's a way to remove the prompt though? I didn't bother with doing so at the time.

For everyone else writing variants of externalIP(): by all means, continue to do so if you feel like it :thumbup: but I won't be changing my version, as I made an exception for "organization" to be "ISP," and also trimmed it. My computer doesn't notice a difference using RegEx; the one I'm using now is virtually instant. Just tested using a_tickCount and my for-loop is less than one tick.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Masonjar13's Library List

14 Jul 2016, 10:08

Guest wrote:@joedf You thought the same thing as who?
I thought of utilizing the json, but then I told myself it's going a little overboard for a small self-contained/independent function. :mrgreen:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

29 Jul 2016, 02:41

The library has been moved to Github (link on first post). It'll be easier for me to maintain it this way ;)
I'll still post updates here, probably.
  • Added strI()
  • Added regExMatchI()
  • Added regExReplaceI()
  • Added strReplaceI()
  • Added mtos()
  • Updated randStr() - will likely have another update very soon
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

29 Jun 2017, 19:24

Update!

Finally, I've pushed an update to my git rep. :thumbup: Below are the additions and edits.
  • Updates:
    • externalIP - Fixed ISP (dazzlepod updated their ISP value a while back), added extra values to the returning object, and condensed the code.
    • urlDownloadToVar - Added raw option.
  • New functions:
    • audioRouter (class)
    • fileUnblock
    • getImageSize
    • getSelected
    • invertCaseChr
    • invertCaseStr
    • mouseOverWin
    • strToLower
    • strToUpper
I probably should have put invertCaseChr inside invertCaseStr, seeing as it supersedes it.. :think: I'll have to go and make sure it doesn't break anything I already have, though.

Edit: Added "ip" parameter to externalIP to allow look-up of other IP addresses.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: Masonjar13's Library List

01 Jul 2017, 00:53

Masonjar13
Nice library :thumbup: Thank you :)
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Masonjar13's Library List

16 Jul 2017, 05:59

vasili111 wrote:Masonjar13
Nice library :thumbup: Thank you :)
No problem, glad you like it!
  • Added toolSpeak() (similar to tool(), but uses SAPI.SpVoice to vocalize the given string)
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: JoeWinograd, return and 72 guests