ComputorEdge AutoHotkey Scripts and Useful Utility Downloads

Post your working scripts, libraries and tools for AHK v1.1 and older
Dzenid
Posts: 1
Joined: 11 Apr 2020, 04:03

Re: ComputorEdge AutoHotkey Scripts and Useful Utility Downloads

28 May 2020, 12:31

Nice, Jack,,, my admiration.
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Update for Ryan's RegEx Tester

20 Jul 2020, 14:40

Ryan's RegEx Tester sits near the top of my list of favorite AutoHotkey scripts. That's why I added it to this list of AutoHotkey scripts.

toralf has posted an updated version of RegEx Tester in this forum. I've added the link to the ComputorEdge AutoHotkey Scripts page.
gibbons6546
Posts: 31
Joined: 07 Apr 2020, 11:53

Re: ComputorEdge AutoHotkey Scripts and Useful Utility Downloads

20 Jul 2020, 22:44

Thanks. I appreciate your work as well as the compilation of scripts for the community. I just started using QuickLinks.
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Measuring Distances on Your Computer Screen—MouseMeasure Onscreen Ruler

09 Aug 2020, 06:12

I've added a new sample script for measuring distances on your computer screen: MouseMeasure.ahk.

The MouseMeasure.ahk script uses the mouse to calculate a calibrated distance between two points on the computer monitor.

To Calibrate Range:
  1. Locate mouse cursor at start point — CTRL+LButton and hold.
  2. Drag mouse to end of scale and release the left mouse button.
  3. Enter length of scale and units (i.e.15 Miles).
Manual Calibration: CTRL+ALT+Z

To Measure Distance:
  1. Locate mouse cursor at start point — SHIFT+LButton and hold.
  2. Drag mouse to end of measurement and release the left mouse button.
  3. Distance displayed in tooltip and saved to Clipboard for paste operation.
CTRL+ALT+F12 for Help Message.

Image
Last edited by jackdunning on 24 Nov 2020, 08:11, edited 1 time in total.
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

On Screen Ruler Using GDIPlus Graphics

05 Sep 2020, 16:49

I've updated the MouseMeasure.ahk script to use GDIPlus Graphics. The graphics are much smoother. I discuss the GDIPlus functions (Hellbent's version) in "How to Draw Lines with AutoHotkey Using Windows GDIPlus Graphics"

Image

To calibrate the app range:

1. Set mouse cursor at start point — CTRL+LButton and release.
2. Move mouse cursor to end of a known scale.
3. Press the Alt key.
4. Enter length of scale and units (i.e. 10 miles), then Submit.

Manual Calibration: CTRL+ALT+Z

To Measure Distance:

1. Set mouse cursor at start point — CTRL+LButton and release.
2. Draw line over target distance.
3. Press the Shift key.
4. Distance displayed and saved to Clipboard.

Use cursor keys to move mouse cursor single pixel increments.

To clear measurement line and ToolTip, press Delete.

Ctrl+Escape to Exit App.

CTRL+ALT+F12 for this Help Message.
Last edited by jackdunning on 24 Nov 2020, 08:13, edited 2 times in total.
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Multi-Leg On-Screen Measurements

08 Oct 2020, 15:25

I've added a multi-leg capability to MouseMeasureMultiLine.ahk for capturing distances around the corner. Plus, insert calcualted leg distances in any document or edit field using temporary Hotkeys.

Image

For more information, see the blogs:

"Measure Multiple Line Segments with an AutoHotkey On-Screen Ruler"
"Track Graphic Line Measurement Segments Using AutoHotkey Arrays"
"Sending Multiple Saved Data Items to Documents and Forms in AutoHotkey (Temporary Hotkeys)"
Last edited by jackdunning on 24 Nov 2020, 08:15, edited 1 time in total.
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Temporary Single-key Hotkeys for Multipaste.ahk Script

24 Nov 2020, 08:04

I changed the MultiPaste.ahk script by adding single-digit Hotkeys only active when the MsgBox opens. Each key inserts the individual text parsed from a selected section.

Image

Hotkeys deactivate upon closing the window.

Discussed in the blog, "Sending Multiple Saved Data Items to Documents and Forms in AutoHotkey (Temporary Hotkeys)."
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Control for Shortcuts in Startup Folder

11 Jan 2021, 17:35

I think you'll find other such scripts but this one, AutoStartupControl.ahk, offers a barebones menu System Tray right-click menu listing shortcuts located in the Windows Startup folder.

Image

I discuss the steps involved in writing the script in:

Auto-Loading AutoHotkey Scripts Booting Windows December 14, 2020
When Collecting File Information from Windows Folders Using AutoHotkey December 21, 2020
Adding Startup Folder Shortcuts to a System Tray Menu (AutoHotkey Startup Control) December 28, 2020
Add Submenus to the Auto-Startup Menu to Increase Options (AutoHotkey Startup Control) January 4, 2021
Peeking at Notes Inside Auto-Startup AHK Script Files (AutoHotkey Startup Control) January 11, 2021
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Instant Years, Months, Days Calculation for Selected Text

27 Mar 2021, 08:04

Added a modified version of the HowLongYearsMonthsDays.ahk script for instant timespan calculation: HowLongInstant.ahk. It works by selecting a section of text which includes the start and stop date as the first and last date in the selection.

Image

The Hotkey combination CTRL+ALT+WIN+h activates the parsing, reformatting, and calculating.

The script consists of five parts:
  1. The Standard Clipboard Routine to capture selected text.
  2. A two-date RegEx for identifying and capturing the target dates.
  3. The DateConvert() function from the DateStampConvert.ahk script formats the parsed dates as a standard TimeDate stamp (YYYYMMDD).
  4. The HowLong() function found in the HowLongYearsMonthsDays.ahk script calculates the timespan by running using the two TimeDate stamps as parameters.
  5. Instantly displays the results in a MsgBox.

Note: Uses the Switch command in the MonthConvert() function to evaluate non-English month names.
neogna2
Posts: 590
Joined: 15 Sep 2016, 15:44

Re: Multi-Leg On-Screen Measurements

30 Mar 2021, 15:14

@jack dunning Thank you for MouseMeasureMultiLine.ahk . Nice to have on map sites with no built in distance measurement tools. One quibble is that only 20 lines can be added because adding a 21th line triggers "Error: Max window number is 20". Caused by a limit to show at most 20 ToolTips at once I presume, https://www.autohotkey.com/docs/commands/ToolTip.htm
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

MouseMeasureMultiLine.ahk Limitations

31 Mar 2021, 04:48

@neogna2 says "Caused by a limit to show at most 20 ToolTips at once"

Yes, I note the 20 ToolTip limitation in my blog "Track Graphic Line Measurement Segments Using AutoHotkey Arrays." If you need more line segments than that you may need to remove (or disable after 20) the ToolTip feature.

Another limitation: Only 9 temporary Hotkeys active (1-9) for the first 9 segments for inserting data into documents. This can be remedied by adding letters to the list of temporary Hotkeys. See "Sending Multiple Saved Data Items to Documents and Forms in AutoHotkey (Temporary Hotkeys)."
neogna2
Posts: 590
Joined: 15 Sep 2016, 15:44

Re: MouseMeasureMultiLine.ahk Limitations

01 Apr 2021, 03:32

jackdunning wrote:
31 Mar 2021, 04:48
Yes, I note the 20 ToolTip limitation in my blog
Ok, a known issue then.

I noticed that if you click to add a leg while moving the mouse there is sometimes a gap between the red lines of the distance segments. Especially if the mouse is moved quickly.
gap.png
gap.png (5.79 KiB) Viewed 2572 times
Looks like we can fix that with a line that updates the mouse screen positions for ex and ey variables immediately after Lbutton, instead of waiting 1-50ms for next timer call to DrawStuff label.

Code: Select all

#If (active_Draw=1)
LButton::
    MouseGetPos,ex,ey ; update position for DrawStuff immediately
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Date Calculation Adding (or Subtracting) Years, Months, and/or Days

22 Apr 2021, 13:32

DateCalc.ahk function for calculating the calendar date when adding (or subtracking) years, months, and/or days.

Code: Select all

StartDate := "20200913"
Years := 2
Months := 8
Days := 21


NewDate := DateCalc(StartDate,Years,Months,Days)

FormatTime, Start , %StartDate%, LongDate
FormatTime, New , %NewDate%, LongDate


MsgBox,, DateCalc, % Start "`r`rAdd:`r`tYears " Years "`r`tMonths " Months "`r`tDays " Days "`r`r" New

DateCalc(Date := "",Years := 0,Months := 0,Days := 0)
{
	If (Date = "")
		Date := A_Now
	Months := SubStr(Date,5,2)+Months
    CalcYears := Floor(Months/12) + Years
    CalcMonths := Mod(Months,12)
	If (CalcMonths <= 0)
	{
		CalcYears := CalcMonths = 0 ? CalcYears-1 : CalcYears
		CalcMonths := CalcMonths + 12
	}
	NewDate := Substr(Date,1,4)+CalcYears . Format("{:02}", CalcMonths) . Substr(Date,7,2)
	NewDate += Days , Days
	Return NewDate
}
This DateCalc(StartDate,Years,Months,Days) function calculates a new date from any StartDate by providing Years, Months, and/or Days (+ or -) as parameters. See "Calculating Dates in AutoHotkey by Adding Years, Months, and/or Days."

The function uses the AutoHotkey Floor() and Mod() functions to account for calculating months and years by doing old-fashion division arithmetic with remainders. See "Fake Math Tricks Using the Floor() and Mod() Functions."
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Inserting Folder and Filenames from Windows to AutoHotkey Menus

10 Aug 2021, 14:41

Added FilesMenuLoad.ahk for inserting Windows File Explorer structures into a pop-up menu.
This barebones script loads the file structure into an AutoHotkey menu (including all subdirectories as submenus). Set TopMenu to the starting folder.

Any file selected from the menu runs with its default program.

See "Adding Folders and Files from Windows to AutoHotkey Menus."

Code: Select all

TopMenu := "C:\Users\" A_UserName "\QuickLinks", LastMenu := "C:\Users\" A_UserName "\QuickLinks"

Loop Files, C:\Users\%A_UserName%\QuickLinks\*.*, DFR  ; Recurse into subfolders.
{
	; Skip any file that is H or S (System).
	If InStr(A_LoopFileAttrib, "H") or InStr(A_LoopFileAttrib, "S") 
		Continue
	; Add to Menu	
	Menu, %A_LoopFileDir%, Add, %A_LoopFileName% , Action
	If (A_LoopFileDir != LastMenu) and (LastMenu != TopMenu)
		AddMenu(LastMenu)
	; Save menu name
	LastMenu := A_LoopFileDir
}
AddMenu(LastMenu)

Menu, %TopMenu%, Show

Return


Action:

Run, % A_ThisMenu . "\" . A_ThisMenuItem

Return

AddMenu(MenuName)
{
	SplitPath, MenuName , DirName, OutDir, OutExtension, OutNameNoExt, OutDrive
	Menu, %OutDir%, Add, %DirName%, :%MenuName%
}

; ^!#m::Menu, %TopMenu%, Show
User avatar
kunkel321
Posts: 1049
Joined: 30 Nov 2015, 21:19

Re: ComputorEdge AutoHotkey Scripts and Useful Utility Downloads

23 Nov 2021, 14:58

Hey Jack,
Do you cover associative arrays in any of your books? I've been trying to learn how to work with them, but I can't seem to wrap my thick head around them. All those for, if, dot.()s just confuse the heck out of me. LOL.
ste(phen|ve) kunkel
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: ComputorEdge AutoHotkey Scripts and Useful Utility Downloads

24 Nov 2021, 01:37

cool!

Thank you for sharing!

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 148 guests