Hotstring() Context and "X" Option

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Trisolaris
Posts: 79
Joined: 10 Mar 2019, 10:28

Hotstring() Context and "X" Option

Post by Trisolaris » 29 Jun 2022, 09:43

Hi folks,

I'm trying to define a collection of execute hotstrings in AHK 1.1.30.01.
The hotstrings and associated Outlook paths are located in two columns of an excel workbook. When my script starts, the columns are read into an associative array, so that I have the value of column B right next to corresponding value of column A. So far so good.

Here's the general structure of the workbook:
A=hotstring trigger____B=Outlook folder path
book________________\\[email protected]\Archive\Books
it___________________\\[email protected]\Archive\IT

When in Outlook, a hotkey opens a custom gui with an edit control. When I enter e.g. the "book" hotstring there, I'd like to execute a label or function which will move the selected email(s) to the folder specified in column B. For each row of the workbook, the hotstring ends up in dat[1], and the corresponding outlook path in dat[2]. The COM-based Excel operations work just fine, but I really struggle with

a) Making the Hotstring() function work in combination with the execute (X) option.

Code: Select all

HotString(":X:"dat[1], CustomFunction(dat[2]))
b) Providing the necessary context to the created hotstrings:

Code: Select all

#IfWinActive, Move messages ahk_class AutoHotkeyGUI
Any help would be greatly appreciated!

User avatar
flyingDman
Posts: 2791
Joined: 29 Sep 2013, 19:01

Re: Hotstring() Context and "X" Option

Post by flyingDman » 29 Jun 2022, 15:13

Have a look at this thread: viewtopic.php?f=76&t=101344&hilit=Documents%5CSpreadsheets%5Chotstrings.xlsx
and in particular the use of bind. Also look here https://www.autohotkey.com/docs/commands/Hotstring.htm#variant for the use of Hotkey, If
14.3 & 1.3.7

Trisolaris
Posts: 79
Joined: 10 Mar 2019, 10:28

Re: Hotstring() Context and "X" Option

Post by Trisolaris » 01 Jul 2022, 00:15

Many thanks @flyingDman, I'll check those out and post the results here.

Post Reply

Return to “Ask for Help (v1)”