daddydave
Members-
Posts
16 -
Joined
-
Last visited
daddydave's Achievements
Seeker (1/7)
0
Reputation
-
For my application-in-progress (and I would think many applications would benefit from this), I ended up changing _OutlookOpen() so that it tries to get an existing instance of Outlook (ObjGet) and return that one and creating a new one (ObjCreate) only if that fails. I only halfway know what I'm doing though, so I am afraid to post the working code until I've used it a while. But it's trivial, and anyone should be able to figure it out from the ObjGet documentation.
-
CLI.au3 easy using of command line parameter
daddydave replied to Xenobiologist's topic in AutoIt Technical Discussion
(I know this is an old thread, but for the benefit of those searching the forums..) eltorro, I finally followed your signature to "some of your scripts on Google code" and was delighted to see you have a newer version called OptParse which allows non-option arguments as well. -
You have done some amazing work here, Wooltown. Thanks for your efforts. I just noticed something that I am not sure is a bug or just me not understanding something. The _OutlookCreateTask seems to return failure codes even if the task is created. #include <Outlook.au3> Local $OOutlook = _OutlookOpen() Local $Test = _OutlookCreateTask($OOutlook, "this is an _OutlookCreateTask() test") MsgBox(16, "test", "@ERROR = " & @ERROR & " and $Test = " & $Test) ; Task gets created in Outlook but ; @ERROR = 9 and $Test = 0 both indicating failure
-
There's probably better ways to do this, but I couldn't find anything in the forums for "Byte Order Marker" or BOM, so here you go: ; Function Name: _BOMCheck() ; ; Description: Determines whether a given file is ANSI, ; UTF-16 Little Endian, UTF-16 Big Endian, or UTF-8 ; ; Syntax: _BOMCheck ( $filename ) ; ; Parameter(s): $filename = The file to check ; ; Requirement(s): Must be Unicode build of AutoIt v3.2.4.0 or later. ; ; Return Value(s): ANSI or Unsupported: Returns 0 ; UTF-16 Little Endian: Returns 32 ; UTF-16 Big Endian: Returns 64 ; UTF-8: Returns 128 ; Problem opening file: Returns -1 ; The general idea with the return value is that it can ; be used in the calculation of the FileOpen mode ; Author: David Eason ; Sample usage: ;While 1 ; Local $file = FileOpenDialog("Choose a file to determine Ansi or Unicode", @DesktopDir & "\", "Text files (*.txt;*.inf)", 3) ; If @error = 1 Then ExitLoop ; MsgBox(0, "", _BOMCheck($file)) ;WEnd Func _BOMCheck(Const ByRef $filename) ; Supported Byte Order Markers for non-ANSI Local $BOMS[3] $BOMS[0] = Binary("0xFFFE") ;UTF-16 Little Endian $BOMS[1] = Binary("0xFEFF") ;UTF-16 Big Endian $BOMS[2] = Binary("0xEFBBBF") ;UTF-8 ; Corresponding mode bit for FileOpen Local $FileModes[3] $FileModes[0] = 32 $FileModes[1] = 64 $FileModes[2] = 128 Local $FH = FileOpen($filename, 4) If $FH = -1 Then Return -1 EndIf Local $FirstBytes = FileRead($FH, 3) If @error = -1 Then FileClose($FH) Return -1 EndIf Local $I For $I = 0 To 2 If BinaryMid($FirstBytes, 1, BinaryLen($BOMS[$I])) = BinaryMid($BOMS[$I], 1, BinaryLen($BOMS[$I])) Then FileClose($FH) Return $FileModes[$I] EndIf Next ; If still here, then it is presumed ANSI FileClose($FH) Return 0 EndFunc ;==>_BOMCheck
-
How do I get messages from multiple non-AutoIt windows?
daddydave replied to daddydave's topic in AutoIt GUI Help and Support
It turns out I don't need to monitor messages per se. I found a nice example very similar to what I want to do: http://www.autoitscript.com/forum/index.ph...mp;#entry161762 _GuiTarget from the AnyGUI link you gave uses some of the API functions used by the example above, but it took me a while to find it. So thanks again! -
And a question. Is there any way to capture an event such as $GUI_EVENT_MOUSEMOVE from one of these targeted windows?
-
For AutoIt3 version v3.2.12.0, since GUIConstants.au3 is now obsolete (and guilist.au3 became obsolete at some point--can't find it in the AutoIt changelog though), it looks like AnyGUI's includes should now be #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiListBox.au3> Just found this, but already it is giving me too many ideas. Thanks, quaizywabbit! :)
-
How do I get messages from multiple non-AutoIt windows?
daddydave replied to daddydave's topic in AutoIt GUI Help and Support
Thanks for the fast reply, Zedna, that example looks like good stuff! -
I want to get messages from any visible window: regardless of whether it is created by my program. Here is what I am trying, none of my debug output is showing. What do you suggest? #include <GUIConstants.au3> #include <Debug.au3> Opt("MustDeclareVars", 1) Global $var[100] Global $hWnd, $msg, $i $var = WinList() _DebugSetup ("What's going on?") While 1 For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then $hWnd = $var[$i][1] GUISwitch($hWnd) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE _DebugOut("Closed") Case $msg = $GUI_EVENT_MINIMIZE _DebugOut("Minimized") Case $msg = $GUI_EVENT_MAXIMIZE _DebugOut("Maximized") EndSelect EndIf Next WEnd Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible
-
Drawing Rectangle, only seeing two sides
daddydave replied to daddydave's topic in AutoIt GUI Help and Support
Thank you so much, smashly! -
I'm sure this is probably more of a WinAPI question than an AutoIt3 question, but I'm hoping it's something simple . I am trying to draw a rectangle using _GDIPlus_GraphicsDrawRect, but I only see the right and bottom sides of the rectangle. What am I doing wrong? All the examples with _GDIPlus_GraphicsDrawRect that I have seen involve creating a new image. Is that what I must do? #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $hGUI, $hWnd, $hGraphic, $hDC, $hPen, $iHeight, $iWidth, ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) $hWnd = WinGetHandle("GDI+") ;; Get dimensions $iWidth = _WinAPI_GetClientWidth($hWnd) $iHeight = _WinAPI_GetClientHeight($hWnd) MsgBox("", "", String($iWidth)) MsgBox("", "", String($iHeight)) $hDC = _WinAPI_GetWindowDC($hWnd) GUISetState() _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) ;; Outline window in red $hPen = _GDIPlus_PenCreate(0xC4FF0000, 2) $hBrush = _GDIPlus_BrushCreateSolid(0xffFF0000) _GDIPlus_GraphicsDrawRect($hGraphic, 0, 0, $iWidth, $iHeight, $hPen) ; Clean up resources _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_ReleaseDC($hWnd, $hDC) _GDIPlus_Shutdown() EndFunc ;==>_Main
-
Thank you
-
Confusing binary string doc
daddydave replied to daddydave's topic in AutoIt General Help and Support
Well, I hoped to delete my post, but I guess that is not allowed, but now I think I understand what BinaryString is. It seems to be basically "what String should have been" so BinaryString(10) is exactly analogous to String(10). It IS a conversion function, period, full stop. (number to string) Please ignore my code snippet above, it is stupid. I got the wrong impression from the examples. EDIT: I see editing is allowed, but only for a time. This is slightly better: $InputFile = FileOpen(".\binary-read.txt", 0) If $InputFile = -1 Then MsgBox(0, "Error", "Unable to open file for reading.") Exit EndIf $blocksize = 512; $block = FileRead($InputFile, $blocksize) $OutputFile = FileOpen(".\binary-write.txt", 2) If $OutputFile = -1 Then MsgBox(0, "Error", "Unable to open file for writing.") Exit EndIf FileWrite($OutputFile, $block) FileClose($OutputFile) It doesn't even use BinaryString, nor does it use raw mode, yet it doesn't seem to have any problem with nulls in the input or output file -
Duh! So I should just ignore the fact that the beta still featured prominently in downloads?
-
Does *BETA* AutoIt v3.2.1.14 have features that FINAL AutoIt v3.2.2.0 doesn't? Given the version numbering, I wouldn't think so, but I notice the beta is still featured prominently in downloads.