Skip to content

Commit 9f2c1ad

Browse files
committed
xsend
1 parent 9ab4b38 commit 9f2c1ad

File tree

6 files changed

+51
-25
lines changed

6 files changed

+51
-25
lines changed

AutoHotkeyx.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ param = nameHinstanceP.argv ; // Naveen: v6.1 Script options in nameHinstanceP.n
293293
Hotkey::ManifestAllHotkeysHotstringsHooks(); // We want these active now in case auto-execute never returns (e.g. loop)
294294
g_script.mIsReadyToExecute = true; // This is done only now for error reporting purposes in Hotkey.cpp.
295295
g_script.xifwinactive = NULL ;
296-
g_script.xwingetid = NULL ;
296+
g_script.xwingetid = NULL ;
297+
g_script.xsend = NULL ;
297298
// Run the auto-execute part at the top of the script (this call might never return):
298299
ResultType result = g_script.AutoExecSection();
299300
// If no hotkeys are in effect, the user hasn't requested a hook to be activated, and the script

ahkmingw_linux.depend

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<pshpack1.h>
4343
<pshpack4.h>
4444

45-
1253153852 /home/naveen/source/ahkmingw/script.h
45+
1253159920 /home/naveen/source/ahkmingw/script.h
4646
"stdafx.h"
4747
"defines.h"
4848
"SimpleHeap.h"
@@ -272,7 +272,7 @@
272272
"resource.h"
273273
<winresrc.h>
274274

275-
1253072070 source:/home/naveen/source/ahkmingw/script.cpp
275+
1253159917 source:/home/naveen/source/ahkmingw/script.cpp
276276
"stdafx.h"
277277
"script.h"
278278
"globaldata.h"
@@ -433,7 +433,7 @@
433433
"var.h"
434434
"globaldata.h"
435435

436-
1253068486 source:/home/naveen/source/ahkmingw/window.cpp
436+
1253155728 source:/home/naveen/source/ahkmingw/window.cpp
437437
"stdafx.h"
438438
"window.h"
439439
"util.h"
@@ -710,7 +710,7 @@
710710

711711
1252537421 /home/naveen/source/ahkmingw/exports.h
712712

713-
1253153850 source:/home/naveen/source/ahkmingw/exports.cpp
713+
1253160053 source:/home/naveen/source/ahkmingw/exports.cpp
714714
"stdafx.h"
715715
"globaldata.h"
716716
"application.h"
@@ -724,7 +724,7 @@
724724
"exports.h"
725725
"script.h"
726726

727-
1253153850 source:/home/naveen/source/ahkmingw/AutoHotkeyx.cpp
727+
1253159914 source:/home/naveen/source/ahkmingw/AutoHotkeyx.cpp
728728
"stdafx.h"
729729
"globaldata.h"
730730
"application.h"

ahkmingw_linux.layout

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
<File name="AutoHotkey.cpp" open="0" top="0" tabpos="1">
55
<Cursor position="17576" topLine="302" />
66
</File>
7-
<File name="AutoHotkeyx.cpp" open="0" top="0" tabpos="3">
8-
<Cursor position="14941" topLine="276" />
7+
<File name="AutoHotkeyx.cpp" open="1" top="0" tabpos="3">
8+
<Cursor position="15001" topLine="284" />
99
</File>
1010
<File name="application.cpp" open="0" top="0" tabpos="10">
1111
<Cursor position="52170" topLine="795" />
1212
</File>
1313
<File name="application.h" open="0" top="0" tabpos="0">
1414
<Cursor position="6765" topLine="116" />
1515
</File>
16-
<File name="defines.h" open="0" top="0" tabpos="12">
17-
<Cursor position="31570" topLine="503" />
16+
<File name="defines.h" open="1" top="0" tabpos="6">
17+
<Cursor position="15316" topLine="228" />
1818
</File>
19-
<File name="exports.cpp" open="0" top="0" tabpos="5">
20-
<Cursor position="652" topLine="5" />
19+
<File name="exports.cpp" open="1" top="0" tabpos="4">
20+
<Cursor position="714" topLine="11" />
2121
</File>
2222
<File name="exports.h" open="0" top="0" tabpos="14">
2323
<Cursor position="968" topLine="0" />
@@ -34,26 +34,29 @@
3434
<File name="hotkey.cpp" open="0" top="0" tabpos="11">
3535
<Cursor position="2664" topLine="58" />
3636
</File>
37-
<File name="keyboard_mouse.h" open="0" top="0" tabpos="6">
38-
<Cursor position="15427" topLine="311" />
37+
<File name="keyboard_mouse.cpp" open="1" top="0" tabpos="7">
38+
<Cursor position="5660" topLine="128" />
3939
</File>
40-
<File name="script.cpp" open="1" top="1" tabpos="2">
41-
<Cursor position="482936" topLine="9537" />
40+
<File name="keyboard_mouse.h" open="1" top="0" tabpos="8">
41+
<Cursor position="7742" topLine="180" />
4242
</File>
43-
<File name="script.h" open="0" top="0" tabpos="8">
44-
<Cursor position="119007" topLine="2315" />
43+
<File name="script.cpp" open="1" top="0" tabpos="2">
44+
<Cursor position="548888" topLine="10999" />
4545
</File>
46-
<File name="script2.cpp" open="0" top="0" tabpos="9">
47-
<Cursor position="282545" topLine="5977" />
46+
<File name="script.h" open="1" top="0" tabpos="5">
47+
<Cursor position="119762" topLine="2325" />
48+
</File>
49+
<File name="script2.cpp" open="1" top="1" tabpos="9">
50+
<Cursor position="88206" topLine="1957" />
4851
</File>
4952
<File name="util.h" open="0" top="0" tabpos="0">
5053
<Cursor position="24330" topLine="505" />
5154
</File>
52-
<File name="var.h" open="0" top="0" tabpos="0">
53-
<Cursor position="4337" topLine="84" />
55+
<File name="var.h" open="1" top="0" tabpos="10">
56+
<Cursor position="1110" topLine="18" />
5457
</File>
5558
<File name="window.cpp" open="1" top="0" tabpos="1">
56-
<Cursor position="26167" topLine="491" />
59+
<Cursor position="28392" topLine="537" />
5760
</File>
5861
<File name="window.h" open="0" top="0" tabpos="0">
5962
<Cursor position="10067" topLine="216" />

exports.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ if ( !(var = g_script.FindOrAddVar(name, strlen(name))) )
1818
return 0; // success
1919
}
2020

21-
EXPORT int ximportfunc(ahkx_int_str func, ahkx_int_str func2)
21+
EXPORT int ximportfunc(ahkx_int_str func1, ahkx_int_str func2, ahkx_int_str_str func3)
2222
{
23-
g_script.xifwinactive = func ;
23+
g_script.xifwinactive = func1 ;
2424
g_script.xwingetid = func2 ;
25+
g_script.xsend = func3;
2526
return 0;
2627
}
2728
EXPORT unsigned int ahkFindFunc(char *funcname)

script.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,7 @@ class GuiType
23172317
};
23182318

23192319
typedef int (* ahkx_int_str)(char *ahkx_str); // ahkx N11
2320+
typedef int (* ahkx_int_str_str)(char *ahkx_str, char *ahkx_str2); // ahkx N11
23202321

23212322
class Script
23222323
{
@@ -2333,6 +2334,7 @@ class Script
23332334
Func *mTempFunc; // for use with dll Execute # Naveen N9
23342335
ahkx_int_str xifwinactive ; // ahkx N11
23352336
ahkx_int_str xwingetid ;
2337+
ahkx_int_str_str xsend ;
23362338
Var **mVar, **mLazyVar; // Array of pointers-to-variable, allocated upon first use and later expanded as needed.
23372339
int mVarCount, mVarCountMax, mLazyVarCount; // Count of items in the above array as well as the maximum capacity.
23382340
WinGroup *mFirstGroup, *mLastGroup; // The first and last variables in the linked list.

script2.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,25 @@ ResultType Line::WinMove(char *aTitle, char *aText, char *aX, char *aY
19591959
ResultType Line::ControlSend(char *aControl, char *aKeysToSend, char *aTitle, char *aText
19601960
, char *aExcludeTitle, char *aExcludeText, bool aSendRaw)
19611961
{
1962+
1963+
if (g_script.xwingetid) // ahkxN11
1964+
{
1965+
int xwin = g_script.xwingetid(aTitle);
1966+
if (xwin)
1967+
{
1968+
printf("sending %s to %s", aKeysToSend, aTitle); // todo: remove this debug line
1969+
if (g_script.xsend(aKeysToSend, aTitle) != 0)
1970+
{
1971+
printf("error sending keys");
1972+
g_ErrorLevel->Assign(ERRORLEVEL_ERROR); // Set default ErrorLevel.
1973+
return OK;
1974+
}
1975+
else
1976+
return g_ErrorLevel->Assign(ERRORLEVEL_NONE); // Indicate success.
1977+
}
1978+
}
1979+
1980+
19621981
g_ErrorLevel->Assign(ERRORLEVEL_ERROR); // Set default ErrorLevel.
19631982
HWND target_window = DetermineTargetWindow(aTitle, aText, aExcludeTitle, aExcludeText);
19641983
if (!target_window)

0 commit comments

Comments
 (0)