OpenKeyWord  Version: 426, Datum:
AutoItX3.cs
1 #region Header
2 /*
3  ==============================================================================
4  Author: Zoltan Hrabovszki <zh@openkeyword.de>
5 
6  Copyright © 2012, 2013, 2014, 2015 IT-Beratung Hrabovszki
7  www.OpenKeyWord.de
8  ==============================================================================
9 
10  This file is part of OpenKeyWord.
11 
12  OpenKeyWord is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  OpenKeyWord is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with OpenKeyWord. If not, see <http://www.gnu.org/licenses/>.
24 
25  Diese Datei ist Teil von OpenKeyWord.
26 
27  OpenKeyWord ist Freie Software: Sie können es unter den Bedingungen
28  der GNU General Public License, wie von der Free Software Foundation,
29  Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
30  veröffentlichten Version, weiterverbreiten und/oder modifizieren.
31 
32  OpenKeyWord wird in der Hoffnung, dass es nützlich sein wird, aber
33  OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
34  Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
35  Siehe die GNU General Public License für weitere Details.
36 
37  Sie sollten eine Kopie der GNU General Public License zusammen mit
38  OpenKeyWord erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
39 */
40 #endregion Header
41 
42 namespace OKW.GUI.AUI
43 {
44  using System;
45  using System.Collections.Generic;
46  using System.Runtime.InteropServices;
47  using System.Text;
48 
49  internal static class AutoItX3
50  {
51  #region Fields
52 
53  // source: http://www.autoitscript.com/forum/topic/72905-c-use-of-the-dll-some-idears-for-you/
54  // NOTE: This is based on AutoItX v3.3.0.0 which is a Unicode version
55  // NOTE: My comments usually have "jcd" appended where I am uncertain.
56  // NOTE: Optional parameters are not supported in C# yet so fill in all fields even if just "".
57  // NOTE: Be prepared to play around a bit with which fields need values and what those value are.
58  // NOTE: In previous versions we used byte[] to return values like this:
59  // byte[] returnclip = new byte[200]; //at least twice as long as the text string expected +2 for null,(Unicode is 2 bytes)
60  // AutoItX3Declarations.AU3_ClipGet(returnclip, returnclip.Length);
61  // clipdata = System.Text.Encoding.Unicode.GetString(returnclip).TrimEnd('\0');
62  // Now we are returning Unicode we can use StringBuilder instead like this:
63  // StringBuilder clip = new StringBuilder(); //passing a parameter here will not work, we must asign a length
64  // clip.Length = 200; //the number of chars expected plus 1 for the terminating null
65  // AutoItX3Declarations.AU3_ClipGet(clip,clip.Length);
66  // MessageBox.Show(clip.ToString());
67  // NOTE: The big advantage of using AutoItX3 like this is that you don't have to register
68  // the dll with windows and more importantly you get away from the many issues involved in
69  // publishing the application and the binding to the dll required.
70  // The below constants were found by Registering AutoItX3.dll in Windows
71  // , adding AutoItX3Lib to References in IDE
72  // ,declaring an instance of it like this:
73  // AutoItX3Lib.AutoItX3 autoit;
74  // static AutoItX3Lib.AutoItX3Class autoit;
75  // ,right clicking on the AutoItX3Class and then Goto Definitions
76  // and seeing the equivalent of the below in the MetaData window.
77  // So far it is working
78  // NOTE: easier way is to use "DLL Export Viewer" utility and get it to list Properties also
79  // "DLL Export Viewer" is from http://www.nirsoft.net
80  // Definitions
81  public const int AU3_INTDEFAULT = -2147483647; // "Default" value for _some_ int parameters(largest negative number)
82  public const int ERROR = 1;
83  public const int SW_HIDE = 2;
84  public const int SW_MAXIMIZE = 3;
85  public const int SW_MINIMIZE = 4;
86  public const int SW_RESTORE = 5;
87  public const int SW_SHOW = 6;
88  public const int SW_SHOWDEFAULT = 7;
89  public const int SW_SHOWMAXIMIZED = 8;
90  public const int SW_SHOWMINIMIZED = 9;
91  public const int SW_SHOWMINNOACTIVE = 10;
92  public const int SW_SHOWNA = 11;
93  public const int SW_SHOWNOACTIVATE = 12;
94  public const int SW_SHOWNORMAL = 13;
95  public const int VERSION = 110; // was 109 if previous non-unicode version
96 
97  const string AUTOITX3_DLL = @"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll";
98 
99  #endregion Fields
100 
101  #region Methods
102 
103  // AU3_API long WINAPI AU3_AutoItSetOption(LPCWSTR szOption, long nValue);
104  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
105  public static extern int AU3_AutoItSetOption([MarshalAs(UnmanagedType.LPWStr)] string Option, int Value);
106 
107  // AU3_API void WINAPI AU3_BlockInput(long nFlag);
108  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
109  public static extern void AU3_BlockInput(int Flag);
110 
111  // AU3_API long WINAPI AU3_CDTray(LPCWSTR szDrive, LPCWSTR szAction);
112  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
113  public static extern int AU3_CDTray(
114  [MarshalAs(UnmanagedType.LPWStr)] string Drive,
115  [MarshalAs(UnmanagedType.LPWStr)] string Action);
116 
117  // AU3_API void WINAPI AU3_ClipGet(LPWSTR szClip, int nBufSize);
118  // Use like this:
119  // StringBuilder clip = new StringBuilder();
120  // clip.Length = 4;
121  // AutoItX3Declarations.AU3_ClipGet(clip,clip.Length);
122  // MessageBox.Show(clip.ToString());
123  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
124  public static extern void AU3_ClipGet([MarshalAs(UnmanagedType.LPWStr)]StringBuilder Clip, int BufSize);
125 
126  // AU3_API void WINAPI AU3_ClipPut(LPCWSTR szClip);
127  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
128  public static extern void AU3_ClipPut([MarshalAs(UnmanagedType.LPWStr)] string Clip);
129 
130  // AU3_API long WINAPI AU3_ControlClick(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, LPCWSTR szButton, long nNumClicks, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY);
131  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
132  public static extern int AU3_ControlClick(
133  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
134  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
135  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
136  [MarshalAs(UnmanagedType.LPWStr)] string Button,
137  int NumClicks,
138  int X,
139  int Y);
140 
141  // AU3_API void WINAPI AU3_ControlCommand(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, LPCWSTR szCommand, LPCWSTR szExtra, LPWSTR szResult, int nBufSize);
142  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
143  public static extern void AU3_ControlCommand(
144  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
145  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
146  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
147  [MarshalAs(UnmanagedType.LPWStr)] string Command,
148  [MarshalAs(UnmanagedType.LPWStr)] string Extra,
149  [MarshalAs(UnmanagedType.LPWStr)] StringBuilder Result,
150  int BufSize);
151 
152  // AU3_API long WINAPI AU3_ControlDisable(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
153  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
154  public static extern int AU3_ControlDisable(
155  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
156  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
157  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
158 
159  // AU3_API long WINAPI AU3_ControlEnable(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
160  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
161  public static extern int AU3_ControlEnable(
162  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
163  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
164  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
165 
166  // AU3_API long WINAPI AU3_ControlFocus(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
167  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
168  public static extern int AU3_ControlFocus(
169  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
170  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
171  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
172 
173  // AU3_API void WINAPI AU3_ControlGetFocus(LPCWSTR szTitle, LPCWSTR szText, LPWSTR szControlWithFocus, int nBufSize);
174  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
175  public static extern void AU3_ControlGetFocus(
176  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
177  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
178  [MarshalAs(UnmanagedType.LPWStr)] StringBuilder ControlWithFocus,
179  int BufSize);
180 
181  // AU3_API void WINAPI AU3_ControlGetHandle(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPCWSTR szControl, LPWSTR szRetText, int nBufSize);
182  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
183  public static extern void AU3_ControlGetHandle(
184  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
185  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
186  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
187  [MarshalAs(UnmanagedType.LPWStr)] StringBuilder RetText,
188  int BufSize);
189 
190  // AU3_API long WINAPI AU3_ControlGetPosHeight(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
191  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
192  public static extern int AU3_ControlGetPosHeight(
193  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
194  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
195  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
196 
197  // AU3_API long WINAPI AU3_ControlGetPosWidth(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
198  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
199  public static extern int AU3_ControlGetPosWidth(
200  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
201  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
202  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
203 
204  // AU3_API long WINAPI AU3_ControlGetPosX(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
205  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
206  public static extern int AU3_ControlGetPosX(
207  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
208  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
209  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
210 
211  // AU3_API long WINAPI AU3_ControlGetPosY(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
212  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
213  public static extern int AU3_ControlGetPosY(
214  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
215  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
216  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
217 
218  // AU3_API void WINAPI AU3_ControlGetText(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, LPWSTR szControlText, int nBufSize);
219  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
220  public static extern void AU3_ControlGetText(
221  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
222  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
223  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
224  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder ControlText,
225  int BufSize);
226 
227  // AU3_API long WINAPI AU3_ControlHide(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
228  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
229  public static extern int AU3_ControlHide(
230  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
231  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
232  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
233 
234  // AU3_API void WINAPI AU3_ControlListView(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, LPCWSTR szCommand, LPCWSTR szExtra1, LPCWSTR szExtra2, LPWSTR szResult, int nBufSize);
235  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
236  public static extern void AU3_ControlListView(
237  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
238  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
239  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
240  [MarshalAs(UnmanagedType.LPWStr)] string Command,
241  [MarshalAs(UnmanagedType.LPWStr)] string Extral1,
242  [MarshalAs(UnmanagedType.LPWStr)] string Extra2,
243  [MarshalAs(UnmanagedType.LPWStr)] StringBuilder Result,
244  int BufSize);
245 
246  // AU3_API long WINAPI AU3_ControlMove(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight);
247  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
248  public static extern int AU3_ControlMove(
249  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
250  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
251  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
252  int X,
253  int Y,
254  int Width,
255  int Height);
256 
257  // AU3_API long WINAPI AU3_ControlSend(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, LPCWSTR szSendText, /*[in,defaultvalue(0)]*/long nMode);
258  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
259  public static extern int AU3_ControlSend(
260  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
261  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
262  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
263  [MarshalAs(UnmanagedType.LPWStr)] string SendText,
264  int Mode);
265 
266  // AU3_API long WINAPI AU3_ControlSetText(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, LPCWSTR szControlText);
267  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
268  public static extern int AU3_ControlSetText(
269  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
270  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
271  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
272  [MarshalAs(UnmanagedType.LPWStr)] string fpsControlText);
273 
274  // AU3_API long WINAPI AU3_ControlShow(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl);
275  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
276  public static extern int AU3_ControlShow(
277  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
278  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
279  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl);
280 
281  // AU3_API void WINAPI AU3_ControlTreeView(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl, LPCWSTR szCommand, LPCWSTR szExtra1, LPCWSTR szExtra2, LPWSTR szResult, int nBufSize);
282  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
283  public static extern void AU3_ControlTreeView(
284  [MarshalAs(UnmanagedType.LPWStr)] string fpsTitle,
285  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
286  [MarshalAs(UnmanagedType.LPWStr)] string fpsControl,
287  [MarshalAs(UnmanagedType.LPWStr)] string Command,
288  [MarshalAs(UnmanagedType.LPWStr)] string Extra1,
289  [MarshalAs(UnmanagedType.LPWStr)] string Extra2,
290  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result,
291  int BufSize);
292 
293  // AU3_API void WINAPI AU3_DriveMapAdd(LPCWSTR szDevice, LPCWSTR szShare, long nFlags, /*[in,defaultvalue("")]*/LPCWSTR szUser, /*[in,defaultvalue("")]*/LPCWSTR szPwd, LPWSTR szResult, int nBufSize);
294  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
295  public static extern void AU3_DriveMapAdd(
296  [MarshalAs(UnmanagedType.LPWStr)] string Device,
297  [MarshalAs(UnmanagedType.LPWStr)] string Share,
298  int Flags,
299  [MarshalAs(UnmanagedType.LPWStr)] string User,
300  [MarshalAs(UnmanagedType.LPWStr)] string Pwd,
301  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result,
302  int BufSize);
303 
304  // AU3_API long WINAPI AU3_DriveMapDel(LPCWSTR szDevice);
305  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
306  public static extern int AU3_DriveMapDel([MarshalAs(UnmanagedType.LPWStr)] string Device);
307 
308  // AU3_API void WINAPI AU3_DriveMapGet(LPCWSTR szDevice, LPWSTR szMapping, int nBufSize);
309  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
310  public static extern void AU3_DriveMapGet(
311  [MarshalAs(UnmanagedType.LPWStr)] string Device,
312  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Mapping,
313  int BufSize);
314 
315  // AU3_API long AU3_error(void);
316  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
317  public static extern int AU3_error();
318 
319  // AU3_API long WINAPI AU3_IniDelete(LPCWSTR szFilename, LPCWSTR szSection, LPCWSTR szKey);
320  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
321  public static extern int AU3_IniDelete(
322  [MarshalAs(UnmanagedType.LPWStr)] string Filename,
323  [MarshalAs(UnmanagedType.LPWStr)] string Section,
324  [MarshalAs(UnmanagedType.LPWStr)] string Key);
325 
326  // AU3_API void WINAPI AU3_IniRead(LPCWSTR szFilename, LPCWSTR szSection, LPCWSTR szKey, LPCWSTR szDefault, LPWSTR szValue, int nBufSize);
327  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
328  public static extern void AU3_IniRead(
329  [MarshalAs(UnmanagedType.LPWStr)] string Filename,
330  [MarshalAs(UnmanagedType.LPWStr)] string Section,
331  [MarshalAs(UnmanagedType.LPWStr)] string Key,
332  [MarshalAs(UnmanagedType.LPWStr)] string Default,
333  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Value,
334  int BufSize);
335 
336  // AU3_API void WINAPI AU3_Init(void);
337  // Uncertain if this is needed jcd
338  [DllImport(AUTOITX3_DLL, SetLastError = true, CharSet = CharSet.Auto)]
339  public static extern void AU3_Init();
340 
341  // AU3_API long WINAPI AU3_IniWrite(LPCWSTR szFilename, LPCWSTR szSection, LPCWSTR szKey, LPCWSTR szValue);
342  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
343  public static extern int AU3_IniWrite(
344  [MarshalAs(UnmanagedType.LPWStr)] string Filename,
345  [MarshalAs(UnmanagedType.LPWStr)] string Section,
346  [MarshalAs(UnmanagedType.LPWStr)] string Key,
347  [MarshalAs(UnmanagedType.LPWStr)] string Value);
348 
349  // AU3_API long WINAPI AU3_IsAdmin(void);
350  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
351  public static extern int AU3_IsAdmin();
352 
353  // AU3_API long WINAPI AU3_MouseClick(/*[in,defaultvalue("LEFT")]*/LPCWSTR szButton, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY, /*[in,defaultvalue(1)]*/long nClicks, /*[in,defaultvalue(-1)]*/long nSpeed);
354  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
355  public static extern int AU3_MouseClick(
356  [MarshalAs(UnmanagedType.LPWStr)] string Button,
357  int x,
358  int y,
359  int clicks,
360  int speed);
361 
362  // AU3_API long WINAPI AU3_MouseClickDrag(LPCWSTR szButton, long nX1, long nY1, long nX2, long nY2, /*[in,defaultvalue(-1)]*/long nSpeed);
363  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
364  public static extern int AU3_MouseClickDrag(
365  [MarshalAs(UnmanagedType.LPWStr)] string Button,
366  int X1,
367  int Y1,
368  int X2,
369  int Y2,
370  int Speed);
371 
372  // AU3_API void WINAPI AU3_MouseDown(/*[in,defaultvalue("LEFT")]*/LPCWSTR szButton);
373  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
374  public static extern void AU3_MouseDown([MarshalAs(UnmanagedType.LPWStr)] string Button);
375 
376  // AU3_API long WINAPI AU3_MouseGetCursor(void);
377  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
378  public static extern int AU3_MouseGetCursor();
379 
380  // AU3_API long WINAPI AU3_MouseGetPosX(void);
381  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
382  public static extern int AU3_MouseGetPosX();
383 
384  // AU3_API long WINAPI AU3_MouseGetPosY(void);
385  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
386  public static extern int AU3_MouseGetPosY();
387 
388  // AU3_API long WINAPI AU3_MouseMove(long nX, long nY, /*[in,defaultvalue(-1)]*/long nSpeed);
389  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
390  public static extern int AU3_MouseMove(int X, int Y, int Speed);
391 
392  // AU3_API void WINAPI AU3_MouseUp(/*[in,defaultvalue("LEFT")]*/LPCWSTR szButton);
393  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
394  public static extern void AU3_MouseUp([MarshalAs(UnmanagedType.LPWStr)] string Button);
395 
396  // AU3_API void WINAPI AU3_MouseWheel(LPCWSTR szDirection, long nClicks);
397  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
398  public static extern void AU3_MouseWheel([MarshalAs(UnmanagedType.LPWStr)] string Direction, int Clicks);
399 
400  // AU3_API long WINAPI AU3_Opt(LPCWSTR szOption, long nValue);
401  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
402  public static extern int AU3_Opt([MarshalAs(UnmanagedType.LPWStr)] string Option, int Value);
403 
404  // AU3_API unsigned long WINAPI AU3_PixelChecksum(long nLeft, long nTop, long nRight, long nBottom, /*[in,defaultvalue(1)]*/long nStep);
405  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
406  public static extern int AU3_PixelChecksum(int Left, int Top, int Right, int Bottom, int Step);
407 
408  // AU3_API long WINAPI AU3_PixelGetColor(long nX, long nY);
409  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
410  public static extern int AU3_PixelGetColor(int X, int Y);
411 
412  // AU3_API void WINAPI AU3_PixelSearch(long nLeft, long nTop, long nRight, long nBottom, long nCol, /*default 0*/long nVar, /*default 1*/long nStep, LPPOINT pPointResult);
413  // Use like this:
414  // int[] result = {0,0};
415  // try
416  // {
417  // AutoItX3Declarations.AU3_PixelSearch(0, 0, 800, 000,0xFFFFFF, 0, 1, result);
418  // }
419  // catch { }
420  // It will crash if the color is not found, have not been able to determin why jcd
421  // The AutoItX3Lib.AutoItX3Class version has similar problems and is the only function to return an object
422  // so contortions are needed to get the data from it ie:
423  // int[] result = {0,0};
424  // object resultObj;
425  // AutoItX3Lib.AutoItX3Class autoit = new AutoItX3Lib.AutoItX3Class();
426  // resultObj = autoit.PixelSearch(0, 0, 800, 600, 0xFFFF00,0,1);
427  // Type t = resultObj.GetType();
428  // if (t == typeof(object[]))
429  // {
430  // object[] obj = (object[])resultObj;
431  // result[0] = (int)obj[0];
432  // result[1] = (int)obj[1];
433  // }
434  // When it fails it returns an object = 1 but when it succeeds it is object[X,Y]
435  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
436  public static extern void AU3_PixelSearch(
437  int Left,
438  int Top,
439  int Right,
440  int Bottom,
441  int Col,
442  int Var,
443  int Step,
444  int[] PointResult);
445 
446  // AU3_API long WINAPI AU3_ProcessClose(LPCWSTR szProcess);
447  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
448  public static extern int AU3_ProcessClose([MarshalAs(UnmanagedType.LPWStr)]string Process);
449 
450  // AU3_API long WINAPI AU3_ProcessExists(LPCWSTR szProcess);
451  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
452  public static extern int AU3_ProcessExists([MarshalAs(UnmanagedType.LPWStr)]string Process);
453 
454  // AU3_API long WINAPI AU3_ProcessSetPriority(LPCWSTR szProcess, long nPriority);
455  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
456  public static extern int AU3_ProcessSetPriority([MarshalAs(UnmanagedType.LPWStr)]string Process, int Priority);
457 
458  // AU3_API long WINAPI AU3_ProcessWait(LPCWSTR szProcess, /*[in,defaultvalue(0)]*/long nTimeout);
459  // Not checked jcd
460  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
461  public static extern int AU3_ProcessWait([MarshalAs(UnmanagedType.LPWStr)]string Process, int Timeout);
462 
463  // AU3_API long WINAPI AU3_ProcessWaitClose(LPCWSTR szProcess, /*[in,defaultvalue(0)]*/long nTimeout);
464  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
465  public static extern int AU3_ProcessWaitClose([MarshalAs(UnmanagedType.LPWStr)]string Process, int Timeout);
466 
467  // AU3_API long WINAPI AU3_RegDeleteKey(LPCWSTR szKeyname);
468  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
469  public static extern int AU3_RegDeleteKey([MarshalAs(UnmanagedType.LPWStr)]string fpsKeyname);
470 
471  // AU3_API long WINAPI AU3_RegDeleteVal(LPCWSTR szKeyname, LPCWSTR szValuename);
472  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
473  public static extern int AU3_RegDeleteVal(
474  [MarshalAs(UnmanagedType.LPWStr)]string fpsKeyname,
475  [MarshalAs(UnmanagedType.LPWStr)]string ValueName);
476 
477  // AU3_API void WINAPI AU3_RegEnumKey(LPCWSTR szKeyname, long nInstance, LPWSTR szResult, int nBufSize);
478  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
479  public static extern void AU3_RegEnumKey(
480  [MarshalAs(UnmanagedType.LPWStr)]string fpsKeyname,
481  int Instance,
482  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result,
483  int BusSize);
484 
485  // AU3_API void WINAPI AU3_RegEnumVal(LPCWSTR szKeyname, long nInstance, LPWSTR szResult, int nBufSize);
486  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
487  public static extern void AU3_RegEnumVal(
488  [MarshalAs(UnmanagedType.LPWStr)]string fpsKeyname,
489  int Instance,
490  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result,
491  int BufSize);
492 
493  // AU3_API void WINAPI AU3_RegRead(LPCWSTR szKeyname, LPCWSTR szValuename, LPWSTR szRetText, int nBufSize);
494  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
495  public static extern void AU3_RegRead(
496  [MarshalAs(UnmanagedType.LPWStr)]string fpsKeyname,
497  [MarshalAs(UnmanagedType.LPWStr)]string Valuename,
498  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText,
499  int BufSize);
500 
501  // AU3_API long WINAPI AU3_RegWrite(LPCWSTR szKeyname, LPCWSTR szValuename, LPCWSTR szType, LPCWSTR szValue);
502  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
503  public static extern int AU3_RegWrite(
504  [MarshalAs(UnmanagedType.LPWStr)]string fpsKeyname,
505  [MarshalAs(UnmanagedType.LPWStr)]string Valuename,
506  [MarshalAs(UnmanagedType.LPWStr)]string Type,
507  [MarshalAs(UnmanagedType.LPWStr)]string Value);
508 
509  // AU3_API long WINAPI AU3_Run(LPCWSTR szRun, /*[in,defaultvalue("")]*/LPCWSTR szDir, /*[in,defaultvalue(1)]*/long nShowFlags);
510  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
511  public static extern int AU3_Run(
512  [MarshalAs(UnmanagedType.LPWStr)]string Run,
513  [MarshalAs(UnmanagedType.LPWStr)]string Dir,
514  int ShowFlags);
515 
516  // AU3_API long WINAPI AU3_RunAsSet(LPCWSTR szUser, LPCWSTR szDomain, LPCWSTR szPassword, int nOptions);
517  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
518  public static extern int AU3_RunAsSet(
519  [MarshalAs(UnmanagedType.LPWStr)]string User,
520  [MarshalAs(UnmanagedType.LPWStr)]string Domain,
521  [MarshalAs(UnmanagedType.LPWStr)]string Password,
522  int Options);
523 
524  // AU3_API long WINAPI AU3_RunWait(LPCWSTR szRun, /*[in,defaultvalue("")]*/LPCWSTR szDir, /*[in,defaultvalue(1)]*/long nShowFlags);
525  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
526  public static extern int AU3_RunWait(
527  [MarshalAs(UnmanagedType.LPWStr)]string Run,
528  [MarshalAs(UnmanagedType.LPWStr)]string Dir,
529  int ShowFlags);
530 
531  // AU3_API void WINAPI AU3_Send(LPCWSTR szSendText, /*[in,defaultvalue("")]*/long nMode);
532  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
533  public static extern void AU3_Send([MarshalAs(UnmanagedType.LPWStr)] string SendText, int Mode);
534 
535  // AU3_API void WINAPI AU3_SendA(LPCSTR szSendText, /*[in,defaultvalue("")]*/long nMode);
536  // Not checked jcd
537  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
538  public static extern void AU3_SendA([MarshalAs(UnmanagedType.LPStr)] string SendText, int Mode);
539 
540  // AU3_API long WINAPI AU3_Shutdown(long nFlags);
541  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
542  public static extern int AU3_Shutdown(int Flags);
543 
544  // AU3_API void WINAPI AU3_Sleep(long nMilliseconds);
545  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
546  public static extern void AU3_Sleep(int Milliseconds);
547 
548  // AU3_API void WINAPI AU3_StatusbarGetText(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, /*[in,defaultvalue(1)]*/long nPart, LPWSTR szStatusText, int nBufSize);
549  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
550  public static extern void AU3_StatusbarGetText(
551  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
552  [MarshalAs(UnmanagedType.LPWStr)]string fpsText,
553  int Part,
554  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder StatusText,
555  int BufSize);
556 
557  // AU3_API void WINAPI AU3_ToolTip(LPCWSTR szTip, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY);
558  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
559  public static extern void AU3_ToolTip(
560  [MarshalAs(UnmanagedType.LPWStr)]string Tip,
561  int X,
562  int Y);
563 
564  // AU3_API void WINAPI AU3_WinActivate(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
565  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
566  public static extern void AU3_WinActivate(
567  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
568  [MarshalAs(UnmanagedType.LPWStr)]string fpsText);
569 
570  // AU3_API long WINAPI AU3_WinActive(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
571  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
572  public static extern int AU3_WinActive(
573  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
574  [MarshalAs(UnmanagedType.LPWStr)]string fpsText);
575 
576  // AU3_API long WINAPI AU3_WinClose(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
577  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
578  public static extern int AU3_WinClose(
579  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
580  [MarshalAs(UnmanagedType.LPWStr)] string fpsText);
581 
582  // AU3_API long WINAPI AU3_WinExists(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
583  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
584  public static extern int AU3_WinExists(
585  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
586  [MarshalAs(UnmanagedType.LPWStr)]string fpsText);
587 
588  // AU3_API long WINAPI AU3_WinGetCaretPosX(void);
589  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
590  public static extern int AU3_WinGetCaretPosX();
591 
592  // AU3_API long WINAPI AU3_WinGetCaretPosY(void);
593  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
594  public static extern int AU3_WinGetCaretPosY();
595 
596  // AU3_API void WINAPI AU3_WinGetClassList(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPWSTR szRetText, int nBufSize);
597  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
598  public static extern void AU3_WinGetClassList(
599  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
600  [MarshalAs(UnmanagedType.LPWStr)]string fpsText,
601  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText,
602  int BufSize);
603 
604  // AU3_API long WINAPI AU3_WinGetClientSizeHeight(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
605  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
606  public static extern int AU3_WinGetClientSizeHeight(
607  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
608  [MarshalAs(UnmanagedType.LPWStr)]string fpsText);
609 
610  // AU3_API long WINAPI AU3_WinGetClientSizeWidth(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
611  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
612  public static extern int AU3_WinGetClientSizeWidth(
613  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
614  [MarshalAs(UnmanagedType.LPWStr)]string fpsText);
615 
616  // AU3_API void WINAPI AU3_WinGetHandle(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPWSTR szRetText, int nBufSize);
617  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
618  public static extern void AU3_WinGetHandle(
619  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
620  [MarshalAs(UnmanagedType.LPWStr)]string fpsText,
621  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText,
622  int BufSize);
623 
624  // AU3_API long WINAPI AU3_WinGetPosHeight(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
625  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
626  public static extern int AU3_WinGetPosHeight(
627  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
628  [MarshalAs(UnmanagedType.LPWStr)] string fpsText);
629 
630  // AU3_API long WINAPI AU3_WinGetPosWidth(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
631  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
632  public static extern int AU3_WinGetPosWidth(
633  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
634  [MarshalAs(UnmanagedType.LPWStr)] string fpsText);
635 
636  // AU3_API long WINAPI AU3_WinGetPosX(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
637  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
638  public static extern int AU3_WinGetPosX(
639  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
640  [MarshalAs(UnmanagedType.LPWStr)] string fpsText);
641 
642  // AU3_API long WINAPI AU3_WinGetPosY(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
643  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
644  public static extern int AU3_WinGetPosY(
645  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
646  [MarshalAs(UnmanagedType.LPWStr)] string fpsText);
647 
648  // AU3_API void WINAPI AU3_WinGetProcess(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPWSTR szRetText, int nBufSize);
649  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
650  public static extern void AU3_WinGetProcess(
651  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
652  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
653  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText,
654  int BufSize);
655 
656  // AU3_API long WINAPI AU3_WinGetState(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
657  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
658  public static extern int AU3_WinGetState(
659  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
660  [MarshalAs(UnmanagedType.LPWStr)] string fpsText);
661 
662  // AU3_API void WINAPI AU3_WinGetText(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPWSTR szRetText, int nBufSize);
663  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
664  public static extern void AU3_WinGetText(
665  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
666  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
667  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText,
668  int BufSize);
669 
670  // AU3_API void WINAPI AU3_WinGetTitle(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPWSTR szRetText, int nBufSize);
671  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
672  public static extern void AU3_WinGetTitle(
673  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
674  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
675  [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText,
676  int BufSize);
677 
678  // AU3_API long WINAPI AU3_WinKill(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText);
679  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
680  public static extern int AU3_WinKill(
681  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
682  [MarshalAs(UnmanagedType.LPWStr)] string fpsText);
683 
684  // AU3_API long WINAPI AU3_WinMenuSelectItem(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPCWSTR szItem1, LPCWSTR szItem2, LPCWSTR szItem3, LPCWSTR szItem4, LPCWSTR szItem5, LPCWSTR szItem6, LPCWSTR szItem7, LPCWSTR szItem8);
685  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
686  public static extern int AU3_WinMenuSelectItem(
687  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
688  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
689  [MarshalAs(UnmanagedType.LPWStr)] string Item1,
690  [MarshalAs(UnmanagedType.LPWStr)] string Item2,
691  [MarshalAs(UnmanagedType.LPWStr)] string Item3,
692  [MarshalAs(UnmanagedType.LPWStr)] string Item4,
693  [MarshalAs(UnmanagedType.LPWStr)] string Item5,
694  [MarshalAs(UnmanagedType.LPWStr)] string Item6,
695  [MarshalAs(UnmanagedType.LPWStr)] string Item7,
696  [MarshalAs(UnmanagedType.LPWStr)] string Item8);
697 
698  // AU3_API void WINAPI AU3_WinMinimizeAll();
699  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
700  public static extern void AU3_WinMinimizeAll();
701 
702  // AU3_API void WINAPI AU3_WinMinimizeAllUndo();
703  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
704  public static extern void AU3_WinMinimizeAllUndo();
705 
706  // AU3_API long WINAPI AU3_WinMove(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight);
707  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
708  public static extern int AU3_WinMove(
709  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
710  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
711  int X,
712  int Y,
713  int Width,
714  int Height);
715 
716  // AU3_API long WINAPI AU3_WinSetOnTop(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, long nFlag);
717  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
718  public static extern int AU3_WinSetOnTop(
719  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
720  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
721  int Flags);
722 
723  // AU3_API long WINAPI AU3_WinSetState(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, long nFlags);
724  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
725  public static extern int AU3_WinSetState(
726  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
727  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
728  int Flags);
729 
730  // AU3_API long WINAPI AU3_WinSetTitle(LPCWSTR szTitle,/*[in,defaultvalue("")]*/ LPCWSTR szText, LPCWSTR szNewTitle);
731  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
732  public static extern int AU3_WinSetTitle(
733  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
734  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
735  [MarshalAs(UnmanagedType.LPWStr)] string NewTitle);
736 
737  // AU3_API long WINAPI AU3_WinSetTrans(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, long nTrans);
738  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
739  public static extern int AU3_WinSetTrans(
740  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
741  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
742  int Trans);
743 
744  // AU3_API long WINAPI AU3_WinWait(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
745  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
746  public static extern int AU3_WinWait(
747  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
748  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
749  int Timeout);
750 
751  // AU3_API long WINAPI AU3_WinWaitA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
752  // Not checked jcd
753  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
754  public static extern int AU3_WinWaitA(
755  [MarshalAs(UnmanagedType.LPStr)]string fpsTitle,
756  [MarshalAs(UnmanagedType.LPStr)] string fpsText,
757  int Timeout);
758 
759  // AU3_API long WINAPI AU3_WinWaitActive(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
760  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
761  public static extern int AU3_WinWaitActive(
762  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
763  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
764  int Timeout);
765 
766  // AU3_API long WINAPI AU3_WinWaitActiveA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
767  // Not checked jcd
768  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
769  public static extern int AU3_WinWaitActiveA(
770  [MarshalAs(UnmanagedType.LPStr)]string fpsTitle,
771  [MarshalAs(UnmanagedType.LPStr)] string fpsText,
772  int Timeout);
773 
774  // AU3_API long WINAPI AU3_WinWaitClose(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
775  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
776  public static extern int AU3_WinWaitClose(
777  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
778  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
779  int Timeout);
780 
781  // AU3_API long WINAPI AU3_WinWaitCloseA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
782  // Not checked jcd
783  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
784  public static extern int AU3_WinWaitCloseA(
785  [MarshalAs(UnmanagedType.LPStr)]string fpsTitle,
786  [MarshalAs(UnmanagedType.LPStr)] string fpsText,
787  int Timeout);
788 
789  // AU3_API long WINAPI AU3_WinWaitNotActive(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
790  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
791  public static extern int AU3_WinWaitNotActive(
792  [MarshalAs(UnmanagedType.LPWStr)]string fpsTitle,
793  [MarshalAs(UnmanagedType.LPWStr)] string fpsText,
794  int Timeout);
795 
796  // AU3_API long WINAPI AU3_WinWaitNotActiveA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText, /*[in,defaultvalue(0)]*/long nTimeout);
797  // Not checked jcd
798  [DllImport(@"C:\Program Files(x86)\AutoIt3\AutoItX\AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
799  public static extern int AU3_WinWaitNotActiveA(
800  [MarshalAs(UnmanagedType.LPStr)] string fpsTitle,
801  [MarshalAs(UnmanagedType.LPStr)] string fpsText,
802  int Timeout);
803 
814  public static string ClipGet()
815  {
816  StringBuilder clip = new StringBuilder();
817  clip.Length = 4000;
818 
819  Log.Logger.Instance.LogFunctionStartDebug("AutoItX3.ClipGet");
820 
821  AutoItX3.AU3_ClipGet(clip, clip.Length);
822 
823  Log.Logger.Instance.LogPrint(AutoItX3.AU3_error().ToString());
824 
825  Log.Logger.Instance.LogFunctionEndDebug(clip.ToString());
826 
827  return clip.ToString();
828  }
829 
837  public static void Run(string process, string dir)
838  {
839  AU3_Run(process, dir, SW_SHOWMAXIMIZED);
840  }
841 
855  public static void Run(string process, string dir, int showflag)
856  {
857  AU3_Run(process, dir, showflag);
858  }
859 
860  #endregion Methods
861  }
862 }
static void Run(string process, string dir, int showflag)
Runs an external program.
Definition: AutoItX3.cs:855
static void Run(string process, string dir)
Runs an external program.
Definition: AutoItX3.cs:837
static string ClipGet()
List den aktuellen Wert des Clipboard via Autoit.
Definition: AutoItX3.cs:814
Definition: Core.cs:40