Jump to content

Apzo

Active Members
  • Posts

    119
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Apzo's Achievements

Adventurer

Adventurer (3/7)

2

Reputation

  1. My previous post is incomplete. This is how I could use the sqlite lib : You need to unzip the sqlite3.dll file in your working directory from http://www.sqlite.org/2016/sqlite-dll-win32-x86-3110100.zip In your code : Your code may not run from the AutoIT IDE. Right clic on the .au3 file and compile on x86 format. Your application should work :)
  2. Hello Iczer I have a working program dealing with distances. I added: #include "sqlite_funcs.au3" ; *snip* ; Square distance between P(x,y) anq Q(x,y) Func _dist2($pCtx, $iArgs, $pArgs) Local $Result = 0 Local $aArgs = _SQLite_FuncArgs($iArgs, $pArgs), $Arg If UBound($aArgs) <> 4 Then Return Local $px = _SQLite_GetValue($aArgs[0]) Local $py = _SQLite_GetValue($aArgs[1]) Local $qx = _SQLite_GetValue($aArgs[2]) Local $qy = _SQLite_GetValue($aArgs[3]) $result = ($px-$qx)*($px-$qx) + ($py-$qy)*($py-$qy) ConsoleWrite("> Result: " & $result & @CRLF) _SQLite_ResultText($pCtx, $Result) EndFunc Global $dllCb = _SQLite_FuncCallbackRegister("_dist2") _SQLite_CreateFunction(-1, "dist2", -1, 0, 0, DllCallbackGetPtr($dllCb), 0, 0) Then I reworked my SQL to use the new function: and finally got The ConsoleWrite debug line doesn't show anything. Is this UDF working anymore ? Thanks for any help ^^ Apzo.
  3. This one worked for me: http://www.sqlite.org/2016/sqlite-dll-win32-x86-3110100.zip should be the good one. Regards, Apzo.
  4. Hello I tried to make working my old scripts on a new W10 system. Something got wrong with all the sqlite3 scripts: SQLite3.dll cannot be found. The given examples in AU3 help don't work. Gosh ! I tried to download the official dll from sqlite, register it and it doesn't work either. register32.exe leads to an error while regitering the official DLL. The AU3 wiki didn't helped. https://www.autoitscript.com/wiki/User_Defined_Functions#Databases_and_web_connections Any way to make it working again ? Thanks for any reply. Apzo.
  5. EDIT : Owwwww, I didn't read all the manual. _BASS_Init(0, -1, 44100, 0, "") is for default device So if I guess well, 1) _BASS_STARTUP() 2) Get output device list 3) _BASS_Init($choosen_device) Thanks BrewManNH for pointing that !! _____________________________________________________________________________________________ This is what I use : #AutoIt3Wrapper_UseX64=n Opt("MustDeclareVars", 1) #include <Bass.au3> #include <BassConstants.au3> #include <Array.au3> Global $iDevice, $info ;Open Bass.DLL. Required for all function calls. _BASS_STARTUP() ;Initalize bass. Required for most functions. _BASS_Init(0, -1, 44100, 0, "") If @error Then MsgBox(0, "Error", "Could not initialize audio") Exit 1 EndIf _BASS_SetDevice(2) If @error Then MsgBox(0, "Sound Mapper", "Error, could not initialise sound system.", 10) Exit 1 EndIf Then I do some sound stuff that works when using the default out device with _BASS_SetDevice(1) _BASS_SetDevice(2) gives me error code 8. You can test using Virtual Audio Cable, looks very interesting when working with BASS. On the paper
  6. So I tried... I first made a func to get available devices. I use Virtual Audio Cable to fake a sound device. Works like a charm using Audacity, I can read sounds from "Line 1" when VLC sends sound to it. Here is the func : Func _DeviceListToArray($source="in") ; or "out" Local $iCnt = 0, $aInfo, $sCurrent, $aRet[1][4], $iNbDev = 0 ;aRet[][0] : Device ID ;aRet[][1] : Name ;aRet[][2] : Driver ;aRet[][3] : Status ;1st line : basic infos. $aRet[0][0] contains the number of found devices $aRet[0][0] = 0 ; Here : number of drivers found $aRet[0][1] = "Name" $aRet[0][2] = "Driver" $aRet[0][3] = "Status" While 1 ConsoleWrite(@LF & "Source " & $source & @LF) ConsoleWrite("Device " & $iCnt & @LF) if $source == "in" Then $aInfo = _BASS_RecordGetDeviceInfo($iCnt) ; Get input device infos ElseIf $source == "out" Then $aInfo = _BASS_GetDeviceInfo($iCnt) ; Get output device infos Else SetError(1) ; Don't want anything else Return EndIf If @error Or Not IsArray($aInfo) Then ExitLoop ConsoleWrite("NB Device " & $iNbDev & @LF) $iNbDev += 1 ; Found a device $aRet[0][0] = $iNbDev ; Add it to the device number ReDim $aRet[$iNbDev+1][4] ; A a device slot $sCurrent = "#" & $iCnt & " - " If Not BitAND($aInfo[2], $BASS_DEVICE_ENABLED) Then $sCurrent = "DISABLED " $sCurrent &= $aInfo[0] If $aInfo[2] > 1 Then $sCurrent &= " (Current) " $aRet[$iNbDev][0] = $iCnt ; Device number $aRet[$iNbDev][1] = $sCurrent ; Device Name $aRet[$iNbDev][2] = $aInfo[1] ; Driver $aRet[$iNbDev][3] = $aInfo[2] ; Status $iCnt += 1 WEnd Return $aRet EndFunc I just have to _Array-display for _DeviceListToArray("in") or _DeviceListToArray("out"). Here is what I get or "out" : [0]|3|Name|Driver|Status [1]|0|#0 - No sound||1 [2]|1|#1 - Speakers (Realtek High Definition Audio) (Current) |{0.0.0.00000000}.{410f2e54-1fbf-44f0-892c-80aaf24a77a7}|7 [3]|2|#2 - Line 1 (Virtual Audio Cable)|{0.0.0.00000000}.{ba6c96db-6355-4da9-90f1-b0eb8b38a241}|1 I'd like to output to device #2, but I have an error code 8 : "$BASS_Init has not been successfully called". It works with #1, using _BASS_SetDevice(1) When I set "Line 1" to the default output device, it becomes the #1 entry and it works. So my question : how can I force BASS to play on "Line 1" having a default output to my real soundcard ?? Regards. Apzo.
  7. Looks realy promising to me ! I'd like to play a sound on a given channel, not the default sound device. I've seen some tries in this topic to play on a specific speaker (left, right, ...) but what about virtual channels ? Can they be listed and used ? Apzo.
  8. and what about windows 8 ? Is it mainly a processor issue (x86 / amd64) ?
  9. Hello folks I wonder if AutoIt can be ran on a windows phone. I'm about to change my phone, and if I can run my apps on a phone, it would be the paradise ! Is AutoIt compliant with any phone/tablet on the market ? Apzo.
  10. Hello I love SQLite Data Browser, but it can't export the result of a query. This little script may be useful for that. It's a simple GUI. - Connect to an existing SQLite DB - Type your query - Get the result in an array - Export it to .csv file (optional) - Queep your favourite SQL queries, and call them back later TO DO : - Favourite deletion - Disconnect button - Automatic SQL history - Other output formats than ";" separated (@TAB, |, ...) Have fun ! Apzo #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Apzo Script Function: - Display and export to .csv file an SQLite query - Queep your usual requests TODO : - Disconnect button, to swith databases - Automatic history #ce ---------------------------------------------------------------------------- #region Includes & opts #include <File.au3> #include <Array.au3> #include <SQLite.au3> #include <SQLite.dll.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) #endregion #region Vars Global $aResult, $iRows, $iColumns, $iRval ; Usual SQLite stuff Global $GUI ; GUI handle Global $X = 500 ; GUI X size Global $Y = 300 ; GUI Y size Global $ReqInput ; Input box for the query Global $GoButton ; Go button Global $AddButton ; Add to favorites button Global $IniFile = "DbExport.ini" ; Ini file Global $ConnectButton ; Connect button Global $ReqList ; Known query list Global $ToReqButton ; List to query input button Global $Title = "SQLite Export" ; Window title #endregion ; ------------------ GUI PART ----------------------------------------------------- #region GUI $GUI = GUICreate($Title, $X, $Y, -1, -1) $ReqInput = GUICtrlCreateEdit("", 5, 40, $X-10, $Y-90) $ConnectButton = GUICtrlCreateButton("Connect to database", $X-150, $Y-40, 140, 30) $GoButton = GUICtrlCreateButton("Go", 5, $Y-40, 50, 30) $AddButton = GUICtrlCreateButton("> Favourites", 70, $Y-40, 80, 30) $ReqList = GUICtrlCreateCombo("", 5, 8, 300, 30) $ToReqButton = GUICtrlCreateButton("Use this query", 315, 5, 180, 30) GUICtrlSetOnEvent($ConnectButton, "_Connect") GUICtrlSetOnEvent($GoButton, "_OuputReq") GUICtrlSetOnEvent($AddButton, "_FavAdd") GUICtrlSetOnEvent($ToReqButton, "_UseReq") GUICtrlSetState($GoButton, $GUI_DISABLE) GUICtrlSetState($AddButton, $GUI_DISABLE) GUICtrlSetState($ReqList, $GUI_DISABLE) GUICtrlSetState($ToReqButton, $GUI_DISABLE) _ListReq() ; filling the combo with known queries GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_Bye") WinSetTitle($Title, "", $Title & " - Disconnected") #endregion ; Start the SQLite engine _SQLite_Startup () If @error Then MsgBox(16, "SQLite Error", "Can't start SQLite, bye.", 10) Exit - 1 EndIf While 1 ; Main loop, nothing more to do... Sleep(1000) WEnd ; Reset and fill the query combo Func _ListReq() GUICtrlSetData($ReqList, "") Local $lr = IniReadSection($IniFile, "SQL") If @Error Then Return Local $c = "" For $i = 1 To $lr[0][0] $c &= "|" & $lr[$i][0] Next GUICtrlSetData($ReqList, $c) EndFunc ; Put a known query into the input area Func _UseReq() Local $lc = GuiCtrlRead($ReqList) If $lc == "" Then Return Local $req = IniRead($IniFile, "SQL", $lc, "??") GuiCtrlSetData($ReqInput, StringReplace($req, "££", @CRLF)) EndFunc ; Put the current query into favourites Func _FavAdd() Local $req = GuiCtrlRead($ReqInput) If StringStripWS($req, 8) == "" Then Return Local $l = InputBox("Favourites", "Wich name for this query ?", "", " M") If $l == "" Then Return IniWrite($IniFile, "SQL", $l, StringReplace($req, @CRLF, "££")) _ListReq() ; Update the favourites GUICtrlSetData($ReqList, $l) EndFunc ; Choose the DB to connect Func _Connect() Local $db = FileOpenDialog("DB file selection", @WORKINGDIR, "db file (*.db)", 1) If @Error Then Return _SQLite_Open($db) If @error Then MsgBox(16, "SQLite Error", "Can't open database, bye.", 10) Exit - 1 EndIf ; Enable the controls GUICtrlSetState($ConnectButton, $GUI_DISABLE) GUICtrlSetState($GoButton, $GUI_ENABLE) GUICtrlSetState($AddButton, $GUI_ENABLE) GUICtrlSetState($ReqList, $GUI_ENABLE) GUICtrlSetState($ToReqButton, $GUI_ENABLE) ; and change the title WinSetTitle($Title, "", $Title & " - Connected") EndFunc ; Compute the query and export it if needed Func _OuputReq() Local $req = GuiCtrlRead($ReqInput) If StringStripWS($req, 8) == "" Then Return GUICtrlSetState($GoButton, $GUI_DISABLE) ; one query at a time, please $iRval = _SQLite_GetTable2d (-1, $req, $aResult, $iRows, $iColumns) If $iRval = $SQLITE_OK Then _ArrayDisplay($aResult) Else MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ()) Exit -1 EndIf GUICtrlSetState($GoButton, $GUI_ENABLE) If MsgBox(36, "Export", "Export to .csv file ?") == 6 Then Local $fname = FileSaveDialog("Save as :", @WORKINGDIR, "csv file (*.csv)|Text file (*.txt)") If @Error Then MsgBox(16, "Error", "Invalid file, bye.", 10) Exit - 1 EndIf Local $fout = FileOpen($fname, 2) For $i = 0 To UBound($aResult) - 1 For $j = 0 To UBound($aResult, 2) - 1 FileWrite($fout, $aResult[$i][$j]&";") ; _2Darray_to_file() needed :s Next FileWrite($fout, @LF) Next FileClose($fout) EndIf EndFunc ; This is the end, my friend... Func _Bye() Exit EndFunc _SQLite_Close () _SQLite_Shutdown ()
  11. Another way to sync dirs is to use a GNU port for windows of the well-known unix command 'cp'. Check the -u option : cp --help ... -u, --update copy only when the SOURCE file is newer than the destination file or when the destination file is missing I use it twice : source -> destination then destination -> source. Apzo.
  12. Hello I just want to replace a simple button by an image. Easy with GuiCtrlCreateButton and GUICtrlSetImage , but how to get rid of the button borders ? More, I have to click on the button part : doing so on the image part -inside the button- does nothing. Then I tried with GUICtrlCreateIcon. It shows my icon (no borders, great !) but impossible to register a message with it. So is it possible to have a nice button (bmp or ico) ? Thanks in advance Apzo.
  13. Hello DELmE It's a good idea to use UDP, but you should use its broadcast abilities too When you network is 192.168.1.X, the best way to broadcast an UDP packet is to send it to 192.168.1.255 You can use this : Global $Broadcast = StringLeft(@IPAddress1, StringInStr(@IPAddress1, ".", 0, 3)) & ".255" Then Func SendMsg($txtMsg) $ssock = UDPOpen($Broadcast,$port) If @error = 0 Then UDPSend($ssock,$txtMsg) EndIf UDPCloseSocket($ssock) EndFunc ;==> SendMsg Apzo.
  14. Hmmm, heaven is just next door How do I get the $olFolderInbox value ? (3 accounts, dozens of subfolders, the folder I'd like to list is in the 3rd account. That is : 3rd Inbox). Apzo.
  15. Excellent work ! But I still don't understand how to list mails from a subfolder, itself into a 3rd or 4th account. I've seen some code, but hard to get it working.. Do you plan to update the UDF soon ? (BTW, could you replace all those "V:\Source Code\Outlook\Outlook.au3" with "Outlook.au3" please ? Thx ) Apzo.
×
×
  • Create New...