[function collection] AHK-Rare with comfortable Gui for searching

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

[function collection] AHK-Rare with comfortable Gui for searching

15 Dec 2018, 11:02

Image

Image

I will sometimes post here, if I found more interesting functions to my collection AHK-Rare.
I need more and more time to add new functions as I want to add a clear description to each new feature. Therefore, I will post in more frequent but less but better prepared functions.
This time I added the following:
  • Ansi2Oem() - using Ansi2Unicode and Unicode2Ansi functions
  • Oem2Ansi() - using Ansi2Unicode and Unicode2Ansi functions
  • Ansi2UTF8() - using Ansi2Unicode and Unicode2Ansi functions
  • UTF82Ansi() - using Ansi2Unicode and Unicode2Ansi functions
  • FindChildWindow() - new version! - If there was no title or text for the childwindow, the returned value was empty, so this function can handle now a new search parameter -Class or ClassNN-
  • StdoutToVar_CreateProcess() - Runs a command line program and returns its output
  • DNSQuery() - retrieve IP adresses or host/domain names from DNS
  • CreateDIB() - a wonderfull function by SKAN to draw tiled backgrounds (like chess pattern) to a gui, it can also draw gradients
  • GuiControlLoadImage() - scale down a picture to fit the given width and height of a picture control
  • Gdip_ResizeBitmap() - returns resized bitmap
  • Gdip_CropBitmap() - returns cropped bitmap. Specify how many pixels you want to crop (omit) from each side of bitmap rectangle
  • FontClone() - backup hFont in memory for further processing
  • GuiDefaultFont() - returns the default Fontname & Fontsize
  • DateDiff() - returns the difference between two timestamps in the specified units
  • ObjectNameChange() - titlebar hook to detect when title changes, (Lexikos’ code)
  • StrGetDimAvgCharWidth() - average width of a character in pixels
  • BlockKeyboard() - block keyboard, and unblock it through usage of keyboard
  • GetFileFormat() - retreaves the codepage format of a file
  • RunUTF8() - if a .exe file really requires its command line to be encoded as UTF-8, the following might work (a lexikos function)
  • Is64bitProcess() - check if a process is running in 64bit
  • getSessionId() - this functions finds out ID of current session
  • SetTrayIcon() - sets a hex coded icon to as try icon
  • HashFile() - calculate hashes (MD2,MD5,SH1,SHA256, SHA384, SHA512) from file
Last edited by Frosti on 09 Sep 2019, 00:19, edited 3 times in total.
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare

16 Feb 2019, 12:45

37 new Gems for the collection:
  • ExtratIcon() - extract icon from a resource file
  • GetIconSize() -determines the size of the icon (Lexikos function)
  • Gdip_GetHICONDimensions() - get icon dimensions
  • FoxitInvoke() - wm_command wrapper for FoxitReader Version:9.1
  • WinSaveCheckboxes() - save the status of checkboxes in other apps
  • GetButtonType() - uses the style of a button to get it’s name
  • KeyValueObjectFromLists() - merge two lists into one key-value object, useful for 2 two lists you retreave from WinGet
  • List2Array() - function uses StrSplit () to return an array
  • CRC32() - CRC32 function, uses MCode
  • MeasureText() - Measures the single-line width and height of the passed text
  • Gdip_BitmapReplaceColor() - using Mcode to replace a color with a specific variation
  • Gdi_ExtFloodFill() - fills an area with the current brush
  • Gdip_AlphaMask32v1() - 32bit Gdip-AlphaMask with MCode - one of two builds
  • Gdip_AlphaMask32v2() - 32bit Gdip-AlphaMask with MCode- second of two builds
  • Gdip_AlphaMask64() - 64bit Gdip-AlphaMask with MCode
  • CircleCrop() - gdip circlecrop with MCode
  • ExploreObj() - renewed function to print contents of an object
  • PIDfromAnyID() - for easy retreaving of process ID’s (PID)
  • sortArray() - well working function (*with example*)
  • GetCallStack() - retrieves the current callstack
  • Traceback() - get stack trace
  • WrapText() - basic function to wrap a text to a given width (length)
  • processPriority() - retrieves the priority of a process via PID
  • Array_Gui() - shows your array as an interactive TreeView
  • MoveMouse_Spiral() - move mouse in a spiral
  • TV_GetItemText() - retrieves the text/name of the specified treeview node
  • WinEnum() - wrapper for Enum(Child)Windows from cocobelgica. a different solution to that one I collected before
  • SetHoverText() - change control’s text on mouseover
  • Menu_Show() - its an alternative to Menu, Show, which can display menu without blocking monitored messages
  • CreateMenu() - creates menu from a string in which each item is placed in new line and hierarchy is defined by Tab character on the left (indentation)
  • CreateDDMenu() - Creates dropdown menu from a string in which each item is placed in new line and hierarchy is defined by Tab character on the left (indentation)
  • FormatByteSize() - give’s back the given bytes in KB, MB, GB …. (for AHK_V1 and a second function for AHK_V2)
  • PathCombine() - combine the 2 routes provided in a single absolute path
  • GetParentDir() - small RegEx function to get parent dir from a given string
  • DirGetParent() - returns a string containing parent dir, it’s possible to set the level of parent dir
  • WinWaitProgress() - Waits for the progress bar on a window to reach (>=) a given value (a Lexikos function)
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

Re: [function collection] AHK-Rare

17 Feb 2019, 11:41

@Frosti, thank you very much for additions. I appreciate your diligence in collecting these.
Regards,
burque505
EDIT: In the hope it will come in handy for someone, I've included the list (not the functions themselves, just name and numbers) as .html and .xlsx in a zip archive. I put a copy of 'AHK-rare.ahk' in there also.
Attachments
AHK-Rare-xlsx-html-20190217.zip
(308.14 KiB) Downloaded 272 times
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare

17 Feb 2019, 17:07

Nice that you have thought about a better presentation. I appreciate your help. I've been using Typora to write the readme.md. It's easy to export readme.md-file to html by using Typora.

It would be best if I continued to work on my "search / copy / paste" script. Unfortunately, I am still stuck with the clean parsing of the functions.
That's why I started setting each function an individual key like this <05.01.000001>. This key should be fixed forever no matter how I split this file one time.

I had also thought about MD5 hashes. No idea, I'm just not a programmer and I try something and mostly I reject it.
If someone does not use Scite4Autohotkey and in case he uses it then my formatting only works with the same settings I use. Otherwise it looks damn confusing.

I also do not want to use a database because I want to leave the functions displayable in any text editor.
Actually, I do not have a really good idea yet, so I put the project in front of me.

It is already very time consuming to add a description to each function and then I also check regularly if the functions do not appear in any library.
I have 150 new functions to check before I can publish them.
It is important that the collected functions are really rare. Therefore the name: AHK-Rare.

About an idea that makes little work and facilitates sorting I would be very happy.
seven
Posts: 8
Joined: 22 Mar 2016, 02:16

Re: [function collection] AHK-Rare

27 Jun 2019, 14:37

Very nice, thank you Frosti.
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare

01 Jul 2019, 06:04

19 new gems:
GetProcessMemoryInfo() - get informations about memory consumption of a process
SetTimerEx() - Similar to SetTimer, but calls a function, optionally with one or more parameters
get_png_image_info() - Getting PNG image info
RapidHotkey() - Using this function you can send keystrokes or launch a Label by pressing a key several times.
hk() - Disable all keyboard buttons
ScriptExist() - true oder false if script is running or not
GetStartupWindowState() - to check, if script exe was launched by windows’s shortcut with MAXIMIZE
SetTextAndResize() - resizes a control to adapt to updated values
HWNDToClassNN() - a different approach to get classNN from handle
GetBitmapFromAnything() - Supports paths, icon handles and hBitmaps
LV_HeaderFontSet() - sets font for listview headers
UpdateScrollBars() - immediate update of the window content when using a scrollbar
SelectFolder() - the Common File Dialog lets you add controls to it
IsCheckboxStyle() - checks style(code)[/b] if it’s a checkbox
DropShadow() - Drop Shadow On Borderless Window, (DWM STYLE)[/b]
GetGuiClassStyle() - returns the class style of a Autohotkey-Gui
SetGuiClassStyle() - sets the class style of a Autohotkey-Gui
RandomString() - builds a string with random char of specified length
LV_SetSI() - set icon for row “subItem” within Listview
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

Re: [function collection] AHK-Rare

01 Jul 2019, 13:29

@Frosti, thanks for the new finds! I always look forward to them.
Regards,
burque505
potscrubber
Posts: 36
Joined: 09 Sep 2017, 01:51
Location: Aotearoa
Contact:

Re: [function collection] AHK-Rare

11 Jul 2019, 22:20

I might be wrong, but it seems to me that FindChildWindow() has dependencies with GetClassNN(), GetClassNN_EnumChildProc() which do not seem to incuded.
Versions of them may be found here https://autohotkey.com/board/topic/85114-detecting-new-child-window/ - I'm not sure if they are correct though.
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare

13 Jul 2019, 21:20

Much thanks. I will check it in 2 weeks after my holidays. I used FindChildWindow() function in my medical repository. It´s not a fast function and by rarely using it like I did I must always rethink how to use it. Please check Addendum.ahk from my ''Addendum für AlbisOnWindows'' -Github repository. There could be a working example. This is the only thing I can do for you at this time.
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare **NOW WITH CODE PREVIEWER**

31 Jul 2019, 17:51

I have provided a working alpha version of my tool (AHK-Rare_TheGui) for a clear representation of the contents of the AHK-Rare file on Github.
Image
-----------------------------------------------------------------------------------------------------------------------------
THINGS ARE DONE
-----------------------------------------------------------------------------------------------------------------------------
1. Upper area: here all functions are displayed for selection.
2. lower area: is used to show the embedded detailed informations.
3 Tabs are here:
a) the highlightet code tab
b) code examples tab (also highlightet)
c) a keyword sorted description tab
(b,c - only if available)
3. A basic search function (using RegExMatch) is yet programmed.
4. With a right click on the displayed code or the
detailed description, the function will be transferred to the clipboard, so it can be easily pasted into your editor.
-----------------------------------------------------------------------------------------------------------------------------
MISSING THINGS
-----------------------------------------------------------------------------------------------------------------------------
1. Gui size and position can not be restored yet
2. The search function should have two options, Basic and RegEx
[indent=1]At the moment only RegEx is activated. In future, however, it should be possible
to combine several terms by logical 'and' and / or logical 'or' (Basic-Mode).
[/indent]
3. Highlighting the search term(s) in the RichEdit controls
4. Keywords should be displayed in the description tab with a larger font
5. Tabs without content should be disabled

It would be nice if someone could help me to get points 3 and 4 of the missing things!

Update: I`m correcting some issues in script. (08.09.2019)
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare with comfortable Gui for searching

14 Sep 2019, 17:48

AHK-Rare GUI:
Fixed many issue’s in the parsing algorithm. Small changes to gui layout. The EXAMPLE(s) and DESCRIPTION tabs will be highlighted if they have content.
Basic search is working very basic. The output in the DESCRIPTION tab is clearer now. Unfortunately, I still have not got any differently colored description keys.

+14 functions
01 LVM_GetItemText() - gets the text of a ListView item or subitem *(newer function for all AHK versions including 64bit - from jballi)
02 NumStr() - Use NumStr() to format a float or to pad leading characters (any character!) to a numeric string
03 SetWidth() - increases a string’s length by adding spaces to it and aligns it Left/Center/Right
04 Replicate() - replicates one char x-times
05 Space() - generates a string containing only spaces
06 GetPriority() - ascertains the priority level for an existing process
07 ProcessCreationTime() - ascertains the creation time for an existing process and returns a time string
08 ProcessOwner() - returns the Owner for a given Process ID
09 ColorAdjL() - adjust luminance for a given RGB color
10 Filexpro() - retreaves file extended properties Object
11 SoundExC() - phonetic algorithm for indexing names by sound
12 PixelCheckSum() - Generates a CheckSum for a region of pixels in Screen/Window
13 Control_GetFont() - Given an handle to a GuiControl, Control_GetFont() will return the Fontname & Fontsize
14 GetElementByName() - search for one element by name
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: [function collection] AHK-Rare with comfortable Gui for searching

15 Sep 2019, 14:33

I just downloaded it as a zip from github.

When I run ahk-rare.ahk I get a duplicate function error line 168
When I run ahkrarethegui I get a cant load icon error line 043
User avatar
jballi
Posts: 724
Joined: 29 Sep 2013, 17:34

Re: [function collection] AHK-Rare with comfortable Gui for searching

15 Sep 2019, 19:57

Hey Frosti, I just found this. Interesting stuff.

I haven't gone through all of it but I noticed that LVM_GetItemText function that I posted a while back is out of date. It will probably still work but there are several design choices that are Microsoft friendly (zero-based indexes) but are not very AutoHotkey friendly (1-based indexes). I updated and enhanced the function late last year and renamed the function to LVM_GetText. If you are interested, you can find the new function here.
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare with comfortable Gui for searching

16 Sep 2019, 01:23

@jballi : yes it is. I actually trying to get this to work. I will change this function.
@AHK-Student: AHK-Rare.ahk is not a file to run. I leave the extensions .ahk for easier recognition in Scite4Autohotkey, Notepad++, ...
This icon error is unknown to me. Do you use a 64bit Unicode version of Autohotkey?
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: [function collection] AHK-Rare with comfortable Gui for searching

16 Sep 2019, 13:56

Frosti wrote:
16 Sep 2019, 01:23
@jballi : yes it is. I actually trying to get this to work. I will change this function.
@AHK-Student: AHK-Rare.ahk is not a file to run. I leave the extensions .ahk for easier recognition in Scite4Autohotkey, Notepad++, ...
This icon error is unknown to me. Do you use a 64bit Unicode version of Autohotkey?
I got it to run, real great tool, :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup:
shipaddicted
Posts: 94
Joined: 15 Jul 2016, 19:57

Re: [function collection] AHK-Rare with comfortable Gui for searching

20 Sep 2019, 18:16

OK I feel like a total idiot. I can't figure out how to run this GUI. Clicking on ahk-rare.ahk, I get the same error mentioned above -- duplicate function error line 168 (I was literally just guessing on how to run this before I found AHKStudent's comment above since there are no user instructions. )

The first time I clicked on ahkrarethegui, I saw the icon pop up in my task tray, but nothing else happened. After a little searing around, I found a popup (popunder?) below ALL my other windows asking me if I wanted to allow Internet Explorer to access something or other (don't remember all of what it said). I said yes and then another popup came up asking me to find an app to make the file run.

At that point, wasn't sure what app it was talking about (it could have been from some other stuff I was doing last night and I never saw it). But before I could investigate further, I accidentally clicked outside of that app box and it closed on me.

Now when I click on ahkrarethegui, I get the icon in the task tray but absolutely nothing else happens. The icon is also in my system tray, but "Reload" does nothing. Exiting and then restarting ahkrarethegui does the same as above.

I looked through about 300 lines of the code to see if a Hotkey was mentioned to open the GUI, but I didn't see anything.

Some supersupersuper basic instructions on how to get this thing running would be greeeeeaaaaattttt ;)
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [function collection] AHK-Rare with comfortable Gui for searching

21 Sep 2019, 06:18

shipaddicted wrote:
20 Sep 2019, 18:16
Some supersupersuper basic instructions on how to get this thing running would be greeeeeaaaaattttt
How to show the GUI :idea:
  • AHK-Rare.ahk is not a file to run. The extensions .ahk is for easier recognition in Scite4Autohotkey
  • AHKRareTheGui.ahk is the file to run but first you have to delete the old AHK-Rare.ini file for a new one to be created (with your screen settings)
Cheers
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: [function collection] AHK-Rare with comfortable Gui for searching

21 Sep 2019, 07:15

  • I fixed the problem with screen resolution.
    Now the gui detects if the script it's running on 2k or 4k Monitor (only if it's the primary monitor).
    And it is taken care that the Gui is created within the visible range of the monitor.
    So nobody has to delete the ini file. Without my fix you would have to do this every time you change the screen resolution from 4k to 2k.
    (I'm working from home in a 4k RDP session on the workstation. The calculator has only a 2k monitor. When I come to work, some windows are still outside the visible display of the monitor. That's why I quickly realized what problem you had.)
  • The AHK-Rare logo has a width of 660 pixels. This looks good on a 4k monitor, but for 2k monitors, the image is scaled to half the size now.
  • AHK-Rare.ahk was renamed AHK-Rare.txt because it caused too much confusion.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 162 guests