AHK commands for Excel =MID() & =VALUE() Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
WeThotUWasAToad
Posts: 108
Joined: 19 Nov 2013, 08:44

AHK commands for Excel =MID() & =VALUE()

20 Mar 2017, 22:01

Hello,

What AHK commands mimic the following two Excel functions?

=MID()
Syntax: MID(text, start_num, num_chars)

=VALUE()
Syntax: VALUE(text)

For example, the following formula extracts a string of 3 characters beginning with character #2:
=MID("W369A4KM",2,3) = "369"

And this formula converts a text string (of numbers) to a numeric value:
=VALUE("369") = 369

So combined,
=VALUE(MID("W369A4KM",2,3)) = 369

Can someone post the equivalent AHK formulas, both individually and combined?

Thanks
FanaticGuru
Posts: 534
Joined: 30 Sep 2013, 22:25

Re: AHK commands for Excel =MID() & =VALUE()  Topic is solved

21 Mar 2017, 12:28

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

X := SubStr("W369A4KM", 2, 3)
MsgBox % X
X := X / 3 + 5
MsgBox % X
There is not really much use for a command like "Value" in AHK. AHK does not have variable types and pretty much treats a variable like a string or a number as needed.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
WeThotUWasAToad
Posts: 108
Joined: 19 Nov 2013, 08:44

Re: AHK commands for Excel =MID() & =VALUE()

22 Mar 2017, 22:34

FanaticGuru wrote:There is not really much use for a command like "Value" in AHK. AHK does not have variable types and pretty much treats a variable like a string or a number as needed.

Thanks FG. That's really helpful (including the comment re variables). I need to find/create a chart showing equivalent functions because I am far more comfortable with Excel formulas than with AHK.
FanaticGuru
Posts: 534
Joined: 30 Sep 2013, 22:25

Re: AHK commands for Excel =MID() & =VALUE()

Yesterday, 01:01

WeThotUWasAToad wrote:Thanks FG. That's really helpful (including the comment re variables). I need to find/create a chart showing equivalent functions because I am far more comfortable with Excel formulas than with AHK.


It is best to use AHK functions when possible but if you really need to use an Excel function in AHK you can, assuming Excel is installed on the computer.
https://autohotkey.com/boards/viewtopic.php?p=133783#p133783

It allows stuff like this.

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

Xl := ComObjCreate("Excel.Application") ; This only needs to be done once in the script (basically starts a hidden Excel running)
Payment := Xl.WorksheetFunction.Pmt(5 / 1200, 6 * 12, -10000) ; Monthly Payment for $10,000 loan at 5% for 6 years.
MsgBox % Payment
Xl.Quit() ; Close your hidden Excel before ending your script, could make this an OnExit routine
Which is useful for accessing the vast number of specialized functions available in Excel.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers

Return to “Ask For Help”

Who is online

Users browsing this forum: andr3as, jebusformayor, jNizM, monkey_squad, Shinobiwan and 21 guests