
AndyS01
Active Members-
Posts
238 -
Joined
-
Last visited
Everything posted by AndyS01
-
_SQLite_Open exits immediately
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Thanks, Jchd, I'll use that one. Thanks for the help everyone.🙂 -
_SQLite_Open exits immediately
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Well, on my hard drive, there are 23 dll files whose names match '*sqlite*.dll", Of those, there are 14 unique file sizes. As I intend to embed the dll file into my compiled .au3 script, I need to make sure that I have one that is the most recent from an official web site. I will test each of the files on my hard drive, but I'm not sure about using files like "C:\Users\Andy\AppData\sqlite3_x64_302700200.dll". -
_SQLite_Open exits immediately
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
I just tried "C:\Users\Andy\AppData\Local\AutoIt v3\SQLite\sqlite3_302700200.dll" and your example produced the following: +++:15: HERE +++:25: HERE +++:29: HERE SQLite Compile Options DLL = C:\Users\Andy\AppData\Local\AutoIt v3\SQLite\sqlite3_302700200.dll VER = 3.27.2 COMPILER=msvc-1916 ENABLE_COLUMN_METADATA ENABLE_FTS3_PARENTHESIS ENABLE_FTS4 ENABLE_RTREE THREADSAFE=1 So I guess that I need to find a 'real' sqlite3.dll file. Can you suggest a good place to find one? -
_SQLite_Open exits immediately
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
I added a couple of ConsoleWrites to see the progress. There were many sqlite3.dll and winsqlite3.dll files on my hard drive. When I pointed to a sqlite3.dll in the AutoIT data directory, I got an "_SQLite_Startup failed - @error = 1" error. When I pointed to a winsqlite3.dll file, the test script never returns from the _SQLite_Open() (by debugging, I see that the _SQLite_Open() code never returns from the sqlite3_open_v2 dll call). When I examined the DLL entry points for each file, I see the sqlite3_open_v2 entry point. #include <Constants.au3> #include <SQLite.au3> sqlite_forcelocal_example() Func sqlite_forcelocal_example() Local $asData[0] Local $hQuery = 0 Local $sMsg = "", _ $sVer = "", _ $sSqliteDll = "" ConsoleWrite("+++:" & @ScriptLineNumber & ": HERE" & @crlf) ;Start up sqlite environment local $dllfn ;~ $dllfn = "C:\Windows\SysWOW64\winsqlite3.dll" $dllfn = "C:\Users\Andy\AppData\Local\AutoIt v3\SQLite\sqlite3_x64_302700200.dll" $sSqliteDll = _SQLite_Startup($dllfn, Default, 1) If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "_SQLite_Startup failed - @error = " & @error) ConsoleWrite("+++:" & @ScriptLineNumber & ": HERE" & @crlf) ;Open a memory db _SQLite_Open() If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "_SQLite_Open failed - @error = " & @error) ConsoleWrite("+++:" & @ScriptLineNumber & ": HERE" & @crlf) ;Query for sqlite version If _SQLite_QuerySingleRow(-1, "Select sqlite_version();", $asData) = $sqlite_ok Then $sVer = $asData[0] ;Query for sqlite compile options If _SQLite_Query(-1, "pragma compile_options;", $hQuery) = $sqlite_ok Then ;Build output message $sMsg = "DLL = " & $sSqliteDll & @CRLF $sMsg &= "VER = " & $sVer & @CRLF & @CRLF While _SQLite_FetchData($hQuery, $asData) = $sqlite_ok $sMsg &= $asData[0] & @CRLF WEnd EndIf ;Display message ConsoleWrite("SQLite Compile Options" & @CRLF) ConsoleWrite($sMsg & @CRLF) ;Close db & shut down sqlite _SQLite_Close() _SQLite_Shutdown() EndFunc -
_SQLite_Open exits immediately
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Yup, I'm running the non 64 bit version: -
_SQLite_Open exits immediately
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
This is just test code to show that the ConsoleWrite never gets called. The script exits first. -
_SQLite_Open exits immediately
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
How do I know if I'm using the 64 bit stub/interpreter? -
When I try to open a SQLite database, the script exits within the _SQLite_Open() function. I have debugged the code in SQLite3.au3 and the culprit is the DLL call to xx. Specifically to this code: Local $avRval = DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_open_v2", "struct*", $tFilename, _ ; UTF-8 Database filename "ptr*", 0, _ ; OUT: SQLite db handle "int", $iAccessMode, _ ; database access mode "ptr", 0) Using ConsoleWrite() calls, I have determined that the script makes it to the DLLCall, but exits without returning from it. I have examined the DLL file and I see the sqlite3_open_v2 entry. Here is my test code: #include <SQLite.au3> _Main() Func _Main() _SQLite_Startup("winSQLite3.dll") If @error Then MsgBox(0, "SQLite Error", "SQLite3.dll Can't be Loaded!") Exit -1 EndIf ConsoleWrite("- _SQLite_LibVersion = " & _SQLite_LibVersion() & @CRLF) _SQLite_Open() ; Creates a :memory: database and don't use its handle to refer to it ConsoleWrite("-" & @ScriptLineNumber & ": HERE" & @CRLF) If @error Then MsgBox(0, "SQLite Error", "Can't create a memory Database!") Exit -1 EndIf _SQLite_Close() ConsoleWrite("-" & @ScriptLineNumber & ": HERE" & @CRLF) _SQLite_Shutdown() EndFunc ;==>_Main
-
WinSetTitle reverts to default upon window focus
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
I made those changes and it worked. Thank you. But if I wanted to change the title of this Notepad window, how could I do it? I think that it's really a bug, especially since the WinSetTitle.au3 in the Examples folder fails as well. -
WinSetTitle reverts to default upon window focus
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Temporarily, I force $sTitle to "Untitled - Notepad", but that's not a real fix. Has this been reported to Microsoft? -
WinSetTitle reverts to default upon window focus
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Do you know of a work-around? I have my environment set up so I have a single Notepad window that I leave up for multiple compile&runs so I don't have to kill Notepad between each run. -
I have a function that opens Notepad and sets its window title. However, the title reverts to whatever its default was when the Notepad window gets focus. To reproduce, run my script and do not move the cursor or type anything. Note that the Notepad window has a title of "abc 123". Now, move the mouse over the Notepad window. The title reverts to the default "Untitled - Notepad". Note: This behavior is also produced when running the F1 Help example script WinSetTitle.au3. Just move the mouse during the 2 second delay. My test script: Global $_Hwnd = 0 _OpenNotepad("abc 123") Func _OpenNotepad($sTitle) Local $pNotepad , $ret = 0 If $_Hwnd = 0 And WinExists($sTitle) Then $_Hwnd = WinGetHandle($sTitle) If IsHWnd($_Hwnd) Then ; Another session already started, so use it If WinExists($_Hwnd) Then $ret = 2 ; The session is still active EndIf EndIf If ($ret = 0) Then Local $exe, $class ; Start Notepad and save its window handle $exe = "Notepad" $class = "[CLASS:Notepad]" $pNotepad = Run($exe) WinWait($class) $_Hwnd = WinGetHandle($class) If $pNotepad = WinGetProcess($_Hwnd) Then Local $rrr1, $rrr2 $rrr1 = WinActivate($_Hwnd) $rrr2 = WinSetTitle($_Hwnd, "", String($sTitle)) ConsoleWrite("+++: $rrr1 = " & $rrr1 & ", $rrr2 = " & $rrr2 & @CRLF) Else $ret = 3 EndIf EndIf Return SetError($ret, 0, 0) EndFunc ;=>_OpenNotepad
-
Regular expression absorbes @CRLFs
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
True enough. The original question was why the CRLF was being absorbed, joining two lines, The eventual fix was the (?m) part of the RE. -
Regular expression absorbes @CRLFs
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
The example in jchd's reply worked for all examples that I tried. Thanks -
Regular expression absorbes @CRLFs
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
In real live production, the 'vs' might not be there. -
Regular expression absorbes @CRLFs
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
The 's' in Midgets' is optional. As I said before, I want to replace "Midget", "Midgets", "Midget 1", "Midgets 1" with the "+++" string. Also, the '1' could be [0-9]. -
Regular expression absorbes @CRLFs
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Oh-Oh I see what you mean iamtheky. This didn't work: test() Exit (1) Func test() Local $sfor, $pat, $sTextBefore = "", $sTextFixed $sTextBefore &= "Line 1 MF Midget vs NE Midgets" & @CR $sTextBefore &= "Line 2 Midgets 1 vs VYY Stars" & @CR $sfor = "Midget" $pat = "(?i)(?m)Midgets*[[:blank:]]+[0-9]*[[:blank:]]*" $sTextFixed = StringRegExpReplace($sTextBefore, $pat, "+++") ConsoleWrite("+++: $pat ====>" & $pat & "<==" & @CRLF) ConsoleWrite("+++: $sTextBefore ==>" & @CRLF & $sTextBefore & @CRLF) ConsoleWrite("+++: $sTextFixed ===>" & @CRLF & $sTextFixed & @CRLF) EndFunc The output was: -
Regular expression absorbes @CRLFs
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Perfect, just what I needed. Thank you. -
Regular expression absorbes @CRLFs
AndyS01 replied to AndyS01's topic in AutoIt General Help and Support
Almost. Adding '?' after a match prevents regexp from being greedy? The concept of greedy, lazy and possessive is quite confusing. I looked at some on line tutorials and got my head swimming. My example didn't supply a plural for Midget. I meed to match 'Midget', 'Midgets', 'Midget 1', 'Midgets 1':  $sTextBefore &= "Line 1 MF Midgets vs NE Midgets" & @CR $sTextBefore &= "Line 2 Midgets 1 vs VYY Stars" & @CR When I do that, I only match 'Midget', not 'Midgets', like so: test() Exit (1) Func test() Local $sfor, $pat, $sTextBefore = "", $sTextFixed $sTextBefore &= "Line 1 MF Midgets vs NE Midgets" & @CR $sTextBefore &= "Line 2 Midgets 1 vs VYY Stars" & @CR $sfor = "Midget" $pat = "(?i)Midget\s{0,}?[s]{0,1}?\s{0,}?[0-9]?+" $sTextFixed = StringRegExpReplace($sTextBefore, $pat, "+++") ConsoleWrite("+++: $pat ====>" & $pat & "<==" & @CRLF) ConsoleWrite("+++: $sTextBefore ==>" & @CRLF & $sTextBefore & @CRLF) ConsoleWrite("+++: $sTextFixed ===>" & @CRLF & $sTextFixed & @CRLF) EndFunc The output is this (notice the 's' characters remaining in the output): -
I have a regular expression that I use in a StringRegExpReplace() function that replaces CRLFs if the matching text is the last text on a line. Here is my example script: test() Exit (1) Func test() Local $sfor, $pat, $sTextBefore = "", $sTextFixed $sTextBefore &= "Line 1 MF Midget vs NE Midget" & @CR $sTextBefore &= "Line 2 Midget 1 vs VYY Stars" & @CR $sfor = "Midget" $pat = "(?i)Midget\s{0,}[s]{0,1}\s{0,}[0-9]?+" $sTextFixed = StringRegExpReplace($sTextBefore, $pat, "+++") ConsoleWrite("+++: $pat ====>" & $pat & "<==" & @CRLF) ConsoleWrite("+++: $sTextBefore ==>" & @CRLF & $sTextBefore & @CRLF) ConsoleWrite("+++: $sTextFixed ===>" & @CRLF & $sTextFixed & @CRLF) EndFunc The output looks like this (I can't figure out how to remove the strikeout in this example):
-
I have a csv file as (follows): I get a failure when I import this csv file. This is the error: test5.csv line 2: expected 4 columns of data but found 3 Here are my SQL commands: mode csv CREATE TABLE if not exists TestTable (C1,C2,C3,C4); INSERT INTO TestTable VALUES ('a1','a2','a3','a4'); INSERT INTO TestTable (C2) VALUES ('random text'); .import test5.csv TestTable select * from TestTable; This csv file is a test file, the actual csv file contains a couple of thousand lines. Here is the error: How can I import this csv file?
-
Thank you, I corrected it to sqlite3.dll
-
I'm trying to get a script that uses SQLite to work, but it complains that it cannot load the dll file. I downloaded the zip file containing the sqlite3.dll, but I don't know where to place it. I found that the script works if I put in in C:\Windows\System32, but that's a protected directory. I tried putting it in C:\Users\Andy\AppData\Local\AutoIt v3\SQLite but that didn't work. Is there a non-protected directory that I could put the dll in? here is my test script: #include <SQLite.au3> #include <SQLite.dll.au3> _SQLite_Startup(@ScriptDir & "\" & "sqlite3.dll", false, 1) ;"\Config\sqlite3_x64.dll", False, 1) If @error Then MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded! - " & $__g_hPrintCallback_SQLite & @CRLF & @CRLF & "Exiting application / Zavolej Honzovi") Exit -1 EndIf
-
I would like to do that, but my actual app lets me hover over a control on another window and I want to get the FG/BG colors of that control. I can get the ID and hWnd of the control, and I want to find its colors. The BG color is easy, but I have not found a way to get the FG (or Text color). I'm using my test code to prove the concept.
-
I created an Edit box control and set the control's Foreground (text) and Background colors, and when I click on a button, I want to detect those values. However, I can only detect the control's Background color. How can I detect the control's Foreground color? Here is my test code: #include <Debug.au3> _DebugSetup(@ScriptName & "_debug.txt", False, 2) _DebugOut("=============== " & @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & " ====================") #include <EditConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <WinAPI.au3> #include <WinAPIGdi.au3> Opt("GUICloseOnESC", 1) ; ESC closes GUI? (0 = no, 1 = yes) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt('MustDeclareVars', 1) Opt("GUIEventOptions", 1) ;0=default, 1=just notification, 2=GuiCtrlRead tab index Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase OnAutoItExitRegister("ExitStageLeft") Global $hGUI, $idTest_btn, $idMemo, $hMemo _Main() Func _Main() Local $str $hGUI = GUICreate("test color detection", 400, 300) $idTest_btn = GUICtrlCreateButton("TEST", 10, 10, 29, 20) GUICtrlSetOnEvent($idTest_btn, "handle_Test_btn") $idMemo = GUICtrlCreateEdit("", 10, 40, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL)) $hMemo = GUICtrlGetHandle($idMemo) GUICtrlSetFont($idMemo, 10, 400, 0, "Courier New") GUICtrlSetColor($idMemo, $COLOR_RED) ; Set the FG color to RED GUICtrlSetBkColor($idMemo, $COLOR_YELLOW) ; Set the BG color to YELLOW $str &= @CRLF $str &= " FG $COLOR_RED = 0x" & Hex($COLOR_RED, 8) & @CRLF $str &= " BG $COLOR_YELLOW = 0x" & Hex($COLOR_YELLOW, 8) & @CRLF $str &= " ABCDEF" & @CRLF & "asdfghjk" & @CRLF GUICtrlSetData($idMemo, $str) _DebugOut("+++: " & $str) GUISetOnEvent($GUI_EVENT_CLOSE, 'ExitStageLeft') GUISetState() ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func ExitStageLeft() Exit (9) EndFunc ;==>ExitStageLeft Func handle_Test_btn() _DebugOut("+++ handle_Test_btn() entered") Local $str = "", $iColor, $was $was = Opt("PixelCoordMode") $str &= "PixelCoordMode was = " & $was & ", setting it to 2" & @CRLF Opt("PixelCoordMode", 2) ; 2 = relative coords to the client area of the defined window $iColor = PixelGetColor(0, 0, $hMemo) $str &= "PixelGetColor(0,0): 0x" & Hex($iColor, 8) & @CRLF $iColor = GUICtrlGetColor($hMemo) $str &= "GUICtrlGetColor: 0x" & Hex($iColor, 8) & @CRLF $iColor = GUICtrlGetBkColor($hMemo) $str &= "GUICtrlGetBkColor(): 0x" & Hex($iColor, 8) & @CRLF Opt("PixelCoordMode", $was) _DebugOut("" & $str) EndFunc ;==>handle_Test_btn Func GUICtrlGetColor($hWnd) ; I want this to get the Memo box Foreground (text) color Local $iColor, $aPos, $x, $y $aPos = WinGetPos($hWnd) $x = $aPos[0] ; Absolute (desktop) X-pos of the control $y = $aPos[1] ; Absolute (desktop) Y-pos of the control $iColor = PixelGetColor($x, $y, $hWnd) Return ($iColor) EndFunc ;==>GUICtrlGetColor Func GUICtrlGetBkColor($hWnd) Local $hDC = _WinAPI_GetDC($hWnd) Local $iColor = _WinAPI_GetPixel($hDC, 0, 0) _WinAPI_ReleaseDC($hWnd, $hDC) Return $iColor EndFunc ;==>GUICtrlGetBkColor