au3 0.0.1-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ /*
2
+ *This file is part of au3.
3
+ *Copyright � 2009 Marvin G�lker
4
+ *
5
+ *au3 is published under the same terms as Ruby.
6
+ *See http://www.ruby-lang.org/en/LICENSE.txt
7
+ */
8
+
9
+ /*
10
+ *Raises a Ruby ArgumentError.
11
+ *Parameters:
12
+ * [in] got: The number of real got parameters.
13
+ * [in] min: The minumum number of arguments.
14
+ * [in] max: The maximum number of arguments.
15
+ */
16
+ void check_for_arg_error(int got, int min, int max)
17
+ {
18
+ char err[80];
19
+ if (got >= min && got <= max)
20
+ return; //No error
21
+
22
+ if ((min + 1) == max)
23
+ sprintf(err, "Wrong number of arguments, got %i, expected %i! or %i", got, min, max); //special
24
+ else if (got < min)
25
+ sprintf(err, "To few arguments specified (%i), expected at least %i and at most %i!", got, min, max);
26
+ else if (got > max)
27
+ sprintf(err, "To many arguments specified (%i), expected at least %i and at most %i!", got, min, max);
28
+ else
29
+ sprintf(err, "Wrong number of arguments, got %i, expected at least %i and at most %i!", got, min, max);
30
+ rb_raise(rb_eArgError, err);
31
+ }
32
+
33
+ /*
34
+ *Converts a Ruby (VALUE) string to an wchar_t string.
35
+ *Parameters:
36
+ * [in] rstr: The Ruby string to convert.
37
+ *Returnvalue:
38
+ *The converted LPCWSTR.
39
+ */
40
+ LPCWSTR rstr_to_wstr(VALUE rstr)
41
+ {
42
+ return to_wchar_t(StringValuePtr(rstr));
43
+ }
44
+
45
+ /*
46
+ *Converts a unicode string (LPCWSTR, wchar_t[]) to a Ruby string.
47
+ *Parameters:
48
+ * [in] wstr: The string to convert.
49
+ */
50
+ VALUE wstr_to_rstr(LPCWSTR wstr)
51
+ {
52
+ return rb_str_new2(to_char(wstr));
53
+ }
@@ -0,0 +1,40 @@
1
+ /*
2
+ *This file is part of au3.
3
+ *Copyright � 2009 Marvin G�lker
4
+ *
5
+ *au3 is published under the same terms as Ruby.
6
+ *See http://www.ruby-lang.org/en/LICENSE.txt
7
+ */
8
+
9
+ /*
10
+ *Converts a char * to a wchar_t * (LPCWSTR).
11
+ *- [in] to_convert: The string to convert.
12
+ *Returnvalue:
13
+ *The converted string.
14
+ *Notes:
15
+ *As a function call parameter you can simply do a conversion like "to_wchar_t("ABC").
16
+ *This way of using to_wchar_t isn't suitable for a variable initialization. You must use
17
+ * LPCWSTR instead of wchar_t *.
18
+ *LPCWSTR str = to_wchar_t("ABC")
19
+ */
20
+ LPCWSTR to_wchar_t(char *to_convert)
21
+ {
22
+ int length_of_string = mbstowcs(NULL, to_convert, 0) + 1;
23
+ wchar_t *result = (wchar_t *) malloc(length_of_string * sizeof(wchar_t));
24
+ mbstowcs(result, to_convert, length_of_string);
25
+ return result;
26
+ }
27
+
28
+ /*
29
+ *Converts a wchar_t * (LPCWSTR) to a normal C string (char *).
30
+ *- [in]to_convert: The string to convert.
31
+ *Returnvalue:
32
+ *The converted string.
33
+ */
34
+ char * to_char(LPCWSTR to_convert)
35
+ {
36
+ int length_of_string = wcstombs(NULL, to_convert, 0) + 1;
37
+ char * result = (char *) malloc(length_of_string * sizeof(char));
38
+ wcstombs(result, to_convert, length_of_string);
39
+ return result;
40
+ }
@@ -0,0 +1,497 @@
1
+ /*
2
+ *This file is part of au3.
3
+ *Copyright � 2009 Marvin G�lker
4
+ *
5
+ *au3 is published under the same terms as Ruby.
6
+ *See http://www.ruby-lang.org/en/LICENSE.txt
7
+ *
8
+ *=window.c
9
+ *This file contains the methods of class Window.
10
+ */
11
+
12
+ VALUE method_active(VALUE self);
13
+
14
+ /*
15
+ *Raises an Au3Error that says that the specified window couldn't be found.
16
+ */
17
+ void raise_unfound(VALUE title, VALUE text)
18
+ {
19
+ rb_raise(Au3Error, "Unable to find a window with title '%s' and text '%s'!", StringValuePtr(title), StringValuePtr(text));
20
+ }
21
+
22
+ //--
23
+ //INSTANCE METHODS
24
+ //++
25
+
26
+ VALUE method_init_window(int argc, VALUE argv[], VALUE self)
27
+ {
28
+ VALUE text = rb_str_new2("");
29
+ check_for_arg_error(argc, 1, 2);
30
+
31
+ if (argc == 2)
32
+ text = argv[1];
33
+
34
+ rb_ivar_set(self, rb_intern("@title"), argv[0]);
35
+ rb_ivar_set(self, rb_intern("@text"), text);
36
+
37
+ if ( TYPE(rb_funcall(Window, rb_intern("exists?"), 2, argv[0], text)) == T_FALSE)
38
+ raise_unfound(argv[0], text);
39
+
40
+ return self;
41
+ }
42
+ //------------------------------------------------------------------------------------------------------------------------------------------
43
+ VALUE method_inspect_window(VALUE self)
44
+ {
45
+ char str[10000];
46
+ VALUE title = rb_funcall(self, rb_intern("title"), 0);
47
+ VALUE handle = rb_funcall(self, rb_intern("handle"), 0);
48
+ sprintf( str, "<Window: %s (%s)>", StringValuePtr(title), StringValuePtr(handle) );
49
+ return rb_str_new2(str);
50
+ }
51
+ //------------------------------------------------------------------------------------------------------------------------------------------
52
+ VALUE method_to_s_window(VALUE self)
53
+ {
54
+ return rb_ivar_get(self, rb_intern("@title"));
55
+ }
56
+ //------------------------------------------------------------------------------------------------------------------------------------------
57
+ VALUE method_to_i_window(VALUE self)
58
+ {
59
+ VALUE handle = rb_funcall(self, rb_intern("handle"), 0);
60
+ return rb_funcall(handle, rb_intern("to_i"), 1, INT2FIX(16));
61
+ }
62
+ //------------------------------------------------------------------------------------------------------------------------------------------
63
+ VALUE method_activate(VALUE self)
64
+ {
65
+ AU3_WinActivate( rstr_to_wstr(rb_ivar_get(self, rb_intern("@title"))), rstr_to_wstr(rb_ivar_get(self, rb_intern("@text"))) );
66
+ return method_active(self);
67
+ }
68
+ //------------------------------------------------------------------------------------------------------------------------------------------
69
+ VALUE method_active(VALUE self)
70
+ {
71
+ return ( ( AU3_WinActive(rstr_to_wstr(rb_ivar_get(self, rb_intern("@title"))), rstr_to_wstr(rb_ivar_get(self, rb_intern("@text")))) ) ? Qtrue : Qfalse );
72
+ }
73
+ //------------------------------------------------------------------------------------------------------------------------------------------
74
+ VALUE method_close(VALUE self)
75
+ {
76
+ AU3_WinClose( rstr_to_wstr(rb_ivar_get(self, rb_intern("@title"))), rstr_to_wstr(rb_ivar_get(self, rb_intern("@text"))) );
77
+ return Qnil;
78
+ }
79
+ //------------------------------------------------------------------------------------------------------------------------------------------
80
+ VALUE method_exists(VALUE self)
81
+ {
82
+ return rb_funcall( Window, rb_intern("exists?"), rb_ivar_get(self, rb_intern("@title")), rb_ivar_get(self, rb_intern("@text")) );
83
+ }
84
+ //------------------------------------------------------------------------------------------------------------------------------------------
85
+ VALUE method_class_list(VALUE self)
86
+ {
87
+ wchar_t buffer[10000];
88
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
89
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
90
+
91
+ AU3_WinGetClassList(rstr_to_wstr(title), rstr_to_wstr(text), buffer, 10000);
92
+
93
+ if (AU3_error() == 1)
94
+ raise_unfound(title, text);
95
+
96
+ return rb_funcall(wstr_to_rstr(buffer), rb_intern("split"), 1, rb_str_new2("\n"));
97
+ }
98
+ //------------------------------------------------------------------------------------------------------------------------------------------
99
+ VALUE method_client_size(VALUE self)
100
+ {
101
+ long width;
102
+ long height;
103
+
104
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
105
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
106
+
107
+ width = AU3_WinGetClientSizeWidth(rstr_to_wstr(title), rstr_to_wstr(text));
108
+ height = AU3_WinGetClientSizeHeight(rstr_to_wstr(title), rstr_to_wstr(text));
109
+
110
+ if (AU3_error() == 1)
111
+ raise_unfound(title, text);
112
+
113
+ return rb_ary_new3(2, LONG2NUM(width), LONG2NUM(height));
114
+ }
115
+ //------------------------------------------------------------------------------------------------------------------------------------------
116
+ VALUE method_handle(VALUE self)
117
+ {
118
+ wchar_t buffer[10000];
119
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
120
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
121
+
122
+ AU3_WinGetHandle(rstr_to_wstr(title), rstr_to_wstr(text), buffer, 10000);
123
+
124
+ if (AU3_error() == 1)
125
+ raise_unfound(title, text);
126
+
127
+ return wstr_to_rstr(buffer);
128
+ }
129
+ //------------------------------------------------------------------------------------------------------------------------------------------
130
+ VALUE method_rect(VALUE self)
131
+ {
132
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
133
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
134
+ VALUE ary = rb_ary_new();
135
+
136
+ rb_ary_push( ary, LONG2NUM(AU3_WinGetPosX(rstr_to_wstr(title), rstr_to_wstr(text))) );
137
+ rb_ary_push( ary, LONG2NUM(AU3_WinGetPosY(rstr_to_wstr(title), rstr_to_wstr(text))) );
138
+ rb_ary_push( ary, LONG2NUM(AU3_WinGetPosWidth(rstr_to_wstr(title), rstr_to_wstr(text))) );
139
+ rb_ary_push( ary, LONG2NUM(AU3_WinGetPosHeight(rstr_to_wstr(title), rstr_to_wstr(text))) );
140
+
141
+ if (AU3_error() == 1)
142
+ raise_unfound(title, text);
143
+
144
+ return ary;
145
+ }
146
+ //------------------------------------------------------------------------------------------------------------------------------------------
147
+ VALUE method_pid(VALUE self)
148
+ {
149
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
150
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
151
+ VALUE res;
152
+ wchar_t buffer[10000];
153
+
154
+ AU3_WinGetProcess(rstr_to_wstr(title), rstr_to_wstr(text), buffer, 10000);
155
+
156
+ if (wcslen(buffer) == 0)
157
+ rb_raise(Au3Error, "Unknown error occured while retrieving process ID. Does the window exist?");
158
+
159
+ res = wstr_to_rstr(buffer);
160
+ return rb_funcall(res, rb_intern("to_i"), 0);
161
+ }
162
+ //------------------------------------------------------------------------------------------------------------------------------------------
163
+ VALUE method_visible(VALUE self)
164
+ {
165
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
166
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
167
+ long state = AU3_WinGetState(rstr_to_wstr(title), rstr_to_wstr(text));
168
+
169
+ if (AU3_error() == 1)
170
+ raise_unfound(title, text);
171
+
172
+ return ((state & 2) == 2) ? Qtrue : Qfalse;
173
+ }
174
+ //------------------------------------------------------------------------------------------------------------------------------------------
175
+ VALUE method_enabled(VALUE self)
176
+ {
177
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
178
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
179
+ long state = AU3_WinGetState(rstr_to_wstr(title), rstr_to_wstr(text));
180
+
181
+ if (AU3_error() == 1)
182
+ raise_unfound(title, text);
183
+
184
+ return ((state & 4) == 4) ? Qtrue : Qfalse;
185
+ }
186
+ //------------------------------------------------------------------------------------------------------------------------------------------
187
+ VALUE method_minimized(VALUE self)
188
+ {
189
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
190
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
191
+ long state = AU3_WinGetState(rstr_to_wstr(title), rstr_to_wstr(text));
192
+
193
+ if (AU3_error() == 1)
194
+ raise_unfound(title, text);
195
+
196
+ return ((state & 16) == 16) ? Qtrue : Qfalse;
197
+ }
198
+ //------------------------------------------------------------------------------------------------------------------------------------------
199
+ VALUE method_maximized(VALUE self)
200
+ {
201
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
202
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
203
+ long state = AU3_WinGetState(rstr_to_wstr(title), rstr_to_wstr(text));
204
+
205
+ if (AU3_error() == 1)
206
+ raise_unfound(title, text);
207
+
208
+ return ((state & 32) == 32) ? Qtrue : Qfalse;
209
+ }
210
+ //------------------------------------------------------------------------------------------------------------------------------------------
211
+ VALUE method_state(VALUE self)
212
+ {
213
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
214
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
215
+ long state = AU3_WinGetState(rstr_to_wstr(title), rstr_to_wstr(text));
216
+
217
+ if (AU3_error() == 1)
218
+ raise_unfound(title, text);
219
+
220
+ return LONG2NUM(state);
221
+ }
222
+ //------------------------------------------------------------------------------------------------------------------------------------------
223
+ VALUE method_text(VALUE self)
224
+ {
225
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
226
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
227
+ wchar_t buffer[65537]; //64 KB (I hope...)
228
+
229
+ AU3_WinGetText(rstr_to_wstr(title), rstr_to_wstr(text), buffer, 65537);
230
+
231
+ if (AU3_error() == 1)
232
+ raise_unfound(title, text);
233
+
234
+ return wstr_to_rstr(buffer);
235
+ }
236
+ //------------------------------------------------------------------------------------------------------------------------------------------
237
+ VALUE method_title(VALUE self)
238
+ {
239
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
240
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
241
+ wchar_t buffer[10000];
242
+
243
+ AU3_WinGetTitle(rstr_to_wstr(title), rstr_to_wstr(text), buffer, 10000);
244
+
245
+ if (AU3_error() == 1)
246
+ raise_unfound(title, text);
247
+
248
+ return wstr_to_rstr(buffer);
249
+ }
250
+ //------------------------------------------------------------------------------------------------------------------------------------------
251
+ VALUE method_kill(VALUE self)
252
+ {
253
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
254
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
255
+
256
+ AU3_WinKill(rstr_to_wstr(title), rstr_to_wstr(text));
257
+
258
+ return Qnil;
259
+ }
260
+ //------------------------------------------------------------------------------------------------------------------------------------------
261
+ //TODO: This function simply doesn't work. No item is found, but why?
262
+ VALUE method_select_menu_item(VALUE self, VALUE args)
263
+ {
264
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
265
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
266
+ int i = 8 - NUM2INT(rb_funcall(args, rb_intern("size"), 0));
267
+
268
+ //Fill the remaining places until 8 with empty strings
269
+ while (i > 0)
270
+ {
271
+ rb_ary_push(args, rb_str_new2(""));
272
+ i--;
273
+ }
274
+
275
+ i = AU3_WinMenuSelectItem(rstr_to_wstr(title), rstr_to_wstr(text),
276
+ rstr_to_wstr(rb_ary_entry(args, 0)), rstr_to_wstr(rb_ary_entry(args, 1)),
277
+ rstr_to_wstr(rb_ary_entry(args, 2)), rstr_to_wstr(rb_ary_entry(args, 3)),
278
+ rstr_to_wstr(rb_ary_entry(args, 4)), rstr_to_wstr(rb_ary_entry(args, 5)),
279
+ rstr_to_wstr(rb_ary_entry(args, 6)), rstr_to_wstr(rb_ary_entry(args, 7)));
280
+
281
+ if (!i)
282
+ rb_raise(Au3Error, "The specified menu item could not be found.");
283
+
284
+ return Qnil;
285
+ }
286
+ //------------------------------------------------------------------------------------------------------------------------------------------
287
+ VALUE method_move(int argc, VALUE argv[], VALUE self)
288
+ {
289
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
290
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
291
+ long width = -1;
292
+ long height = -1;
293
+
294
+ check_for_arg_error(argc, 2, 4);
295
+
296
+ if (argc >= 3)
297
+ width = NUM2LONG(argv[2]);
298
+ if (argc >= 4)
299
+ height = NUM2LONG(argv[3]);
300
+
301
+ AU3_WinMove(rstr_to_wstr(title), rstr_to_wstr(text), NUM2LONG(argv[0]), NUM2LONG(argv[1]), width, height);
302
+ return Qnil;
303
+ }
304
+ //------------------------------------------------------------------------------------------------------------------------------------------
305
+ VALUE method_set_on_top(VALUE self, VALUE val)
306
+ {
307
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
308
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
309
+ int flag;
310
+
311
+ if (RTEST(val))
312
+ flag = 1;
313
+ else
314
+ flag = 0;
315
+
316
+ AU3_WinSetOnTop(rstr_to_wstr(title), rstr_to_wstr(text), flag);
317
+
318
+ return val;
319
+ }
320
+ //------------------------------------------------------------------------------------------------------------------------------------------
321
+ VALUE method_set_state(VALUE self, VALUE val)
322
+ {
323
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
324
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
325
+
326
+ AU3_WinSetState(rstr_to_wstr(title), rstr_to_wstr(text), NUM2LONG(val));
327
+
328
+ return val;
329
+ }
330
+ //------------------------------------------------------------------------------------------------------------------------------------------
331
+ VALUE method_set_title(VALUE self, VALUE new_title)
332
+ {
333
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
334
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
335
+
336
+ AU3_WinSetTitle(rstr_to_wstr(title), rstr_to_wstr(text), rstr_to_wstr(new_title));
337
+
338
+ return new_title;
339
+ }
340
+ //------------------------------------------------------------------------------------------------------------------------------------------
341
+ VALUE method_set_trans(VALUE self, VALUE trans)
342
+ {
343
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
344
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
345
+
346
+ AU3_WinSetTrans(rstr_to_wstr(title), rstr_to_wstr(text), NUM2LONG(trans));
347
+
348
+ if (AU3_error() == 1)
349
+ rb_raise(rb_eNotImpError, "The method trans= is only implemented in Win2000 and newer!");
350
+
351
+ return trans;
352
+ }
353
+ //------------------------------------------------------------------------------------------------------------------------------------------
354
+ VALUE method_wait(int argc, VALUE argv[], VALUE self)
355
+ {
356
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
357
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
358
+ VALUE timeout = INT2FIX(0);
359
+ check_for_arg_error(argc, 0, 1);
360
+ if (argc >= 1)
361
+ timeout = argv[0];
362
+ return rb_funcall(Window, rb_intern("wait"), title, text, timeout);
363
+ }
364
+ //------------------------------------------------------------------------------------------------------------------------------------------
365
+ VALUE method_wait_active(int argc, VALUE argv[], VALUE self)
366
+ {
367
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
368
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
369
+ long timeout = 0;
370
+
371
+ check_for_arg_error(argc, 0, 1);
372
+
373
+ if (argc >= 1)
374
+ timeout = NUM2LONG(argv[1]);
375
+
376
+ return AU3_WinWaitActive(rstr_to_wstr(title), rstr_to_wstr(text), timeout) ? Qtrue : Qfalse;
377
+ }
378
+ //------------------------------------------------------------------------------------------------------------------------------------------
379
+ VALUE method_wait_close(int argc, VALUE argv[], VALUE self)
380
+ {
381
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
382
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
383
+ long timeout = 0;
384
+
385
+ check_for_arg_error(argc, 0, 1);
386
+
387
+ if (argc >= 1)
388
+ timeout = NUM2LONG(argv[1]);
389
+
390
+ return AU3_WinWaitClose(rstr_to_wstr(title), rstr_to_wstr(text), timeout) ? Qtrue : Qfalse;
391
+ }
392
+ //------------------------------------------------------------------------------------------------------------------------------------------
393
+ VALUE method_wait_not_active(int argc, VALUE argv[], VALUE self)
394
+ {
395
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
396
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
397
+ long timeout = 0;
398
+
399
+ check_for_arg_error(argc, 0, 1);
400
+
401
+ if (argc >= 1)
402
+ timeout = NUM2LONG(argv[1]);
403
+
404
+ return AU3_WinWaitNotActive(rstr_to_wstr(title), rstr_to_wstr(text), timeout) ? Qtrue : Qfalse;
405
+ }
406
+ //------------------------------------------------------------------------------------------------------------------------------------------
407
+ VALUE method_focused_control(VALUE self)
408
+ {
409
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
410
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
411
+ wchar_t buffer[10000];
412
+ char str[1000000];
413
+
414
+ AU3_ControlGetFocus(rstr_to_wstr(title), rstr_to_wstr(text), buffer, 10000);
415
+
416
+ if (AU3_error() == 1)
417
+ raise_unfound(title, text);
418
+
419
+ sprintf(str, "AutoItX3::Control.new('%s', '%s', '%s')", StringValuePtr(title), StringValuePtr(text), to_char(buffer));
420
+ return rb_eval_string(str);
421
+ }
422
+ //------------------------------------------------------------------------------------------------------------------------------------------
423
+ VALUE method_statusbar_text(int argc, VALUE argv[], VALUE self)
424
+ {
425
+ VALUE title = rb_ivar_get(self, rb_intern("@title"));
426
+ VALUE text = rb_ivar_get(self, rb_intern("@text"));
427
+ wchar_t buffer[10000];
428
+ int part = 1;
429
+ check_for_arg_error(argc, 0, 1);
430
+
431
+ if (argc == 1)
432
+ part = NUM2INT(argv[0]);
433
+
434
+ AU3_StatusbarGetText(rstr_to_wstr(title), rstr_to_wstr(text), part, buffer, 10000);
435
+
436
+ if (AU3_error() == 1)
437
+ rb_raise(Au3Error, "Couldn't read the statusbar's text at position %i! Are you sure the statusbar exists?", part);
438
+
439
+ return wstr_to_rstr(buffer);
440
+ }
441
+
442
+ //--
443
+ //===================================================================
444
+ //CLASS METHODS
445
+ //===================================================================
446
+ //++
447
+
448
+ VALUE method_exists_cl(int argc, VALUE argv[], VALUE self)
449
+ {
450
+ VALUE text = rb_str_new2("");
451
+ check_for_arg_error(argc, 1, 2);
452
+
453
+ if (argc == 2)
454
+ text = argv[1];
455
+
456
+ return ( ( AU3_WinExists(rstr_to_wstr(argv[0]), rstr_to_wstr(text)) ) ? Qtrue : Qfalse );
457
+ }
458
+ //------------------------------------------------------------------------------------------------------------------------------------------
459
+ VALUE method_caret_pos_cl(VALUE self)
460
+ {
461
+ long xpos;
462
+ long ypos;
463
+
464
+ xpos = AU3_WinGetCaretPosX();
465
+ ypos = AU3_WinGetCaretPosY();
466
+
467
+ if (AU3_error() == 1)
468
+ rb_raise(Au3Error, "Unknown error occured while retrieving caret position!");
469
+
470
+ return rb_ary_new3(2, LONG2NUM(xpos), LONG2NUM(ypos));
471
+ }
472
+ //------------------------------------------------------------------------------------------------------------------------------------------
473
+ VALUE method_minimize_all_cl(VALUE self)
474
+ {
475
+ AU3_WinMinimizeAll();
476
+ return Qnil;
477
+ }
478
+ //------------------------------------------------------------------------------------------------------------------------------------------
479
+ VALUE method_undo_minimize_all_cl(VALUE self)
480
+ {
481
+ AU3_WinMinimizeAllUndo();
482
+ return Qnil;
483
+ }
484
+ //------------------------------------------------------------------------------------------------------------------------------------------
485
+ VALUE method_wait_cl(int argc, VALUE argv[], VALUE self)
486
+ {
487
+ VALUE text = rb_str_new2("");
488
+ long timeout = 0;
489
+ check_for_arg_error(argc, 1, 3);
490
+
491
+ if (argc >= 2)
492
+ text = argv[1];
493
+ if (argc >= 3)
494
+ timeout = NUM2LONG(argv[2]);
495
+
496
+ return AU3_WinWait(rstr_to_wstr(argv[0]), rstr_to_wstr(text), timeout) ? Qtrue : Qfalse;
497
+ }