Leaderboard
Popular Content
Showing content with the highest reputation on 09/04/2020 in all areas
-
Yep, picky and streamliner Local $aArray2d[$iElements/$iColumns][$iColumns] For $i = 0 to $iElements-1 $aArray2d[Floor($i/$iColumns)][mod($i,$iColumns)] = $aArray1d[$i+$iStart] Next Return $aArray2d2 points
-
Check-If-Same
coffeeturtle reacted to TheSaint for a topic
Check-If-Same is a little program, with a big heart (window), that I have been working on since the end of August. It's a somewhat simple affair, and one of the many file checkers out there, but I have put my own slant on it. The screenshot probably says it all. It was built to purpose for me, and you can see the MD5 stuff as an added extra. It has been suggested by my good buddy TheDcoder, that I should also add CRC32 checking, which I may do at some point. However, I just wanted a simple folder content comparison, where I was more interested in file names being matched, not the state of the files ... they having had their integrity checked already by TeraCopy. Files only appear on either list, if they are missing in the other folder or they fail the chosen compare test. If desired, missing files can be skipped (File Name option excepted). 'Source Size' and 'Compare Size' can alternatively be 'Source Date' and 'Compare Date', as specified by the Bytes combo field. Anyway, for what its worth, enjoy! Some of you might find it handy. Source is included in the zip. Check-If-Same v1.1.zip 589.41 kB (111 downloads) Check-If-Same v1.2.zip NEW You have two methods of MD5 checking, one is the AutoIt Crypt hash checking, the other is using third party FSUM. In my limited number of tests, I found the crypt method was faster with small files and FSUM much faster with big files, so take your pick. If you are keen to see timing comparisons, then with the individual MD5 button option, the times are stored in the 'Settings.ini' file for the entry you selected (see the [MD5 Test] section).1 point -
I recently bought an IP Camera to monitor my house. There is a web access to view the video stream but not to record it. Here is the IP Camera in question, it should work with every other similar product. So I made a simple example which does the job. Here is the code : #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <Memory.au3> #region Global Vars Global Const $sProgramTitle = "IP Camera stream + record" ;EDIT THE FOLLOWING LINE ONLY: Global Const $iIPAddress = "192.168.1.99", $iPort = 99, $shtauth = "yourauth==" Global Const $STM_SETIMAGE = 0x0172 Global $blRecording = False, $blGUIMinimized = False Global Const $sRecordDir = @ScriptDir & "\ip_camera_stream" Global $bRecvtmp = Binary(""), $bStream = $bRecvtmp Global $iImgLen = 0, $iStreamLen = 0, $iWritten = 0, $iEOH = 0, $iContLenPos = 0, $hImgFile = 0, $pBuffer = 0, $iImgCount = 0 Global Const $iContLengthLen = StringLen("Content-Length: ") Global $sStream = "", $sTrim2ContLen = "" Global $hBMP = 0, $hGraphics = 0, $hHBITMAP2 = 0, $hFamily = 0, $hFont = 0, $tLayout = "", $hFormat = 0, $hBrush = 0 #endregion Global Vars TCPStartup() Global $iSocket = TCPConnect($iIPAddress, $iPort) If @error Then MsgBox(16, $sProgramTitle, "Could not connect !") Exit -1 EndIf TCPSend($iSocket, _ "GET /videostream.cgi HTTP/1.1" & @CRLF & _ "Host: " & $iIPAddress & ":" & $iPort & @CRLF & _ "Connection: keep-alive" & @CRLF & _ "Authorization: Basic " & $shtauth & @CRLF & @CRLF) #region GUI Global $hGUI = 0, $pPic = 0, $hPic = 0, $btnRecord = 0 $hGUI = GUICreate($sProgramTitle, 640, 525) $pPic = GUICtrlCreatePic("", 0, 0, 640, 480, $SS_BITMAP) GUICtrlSetState($pPic, $GUI_DISABLE) $hPic = GUICtrlGetHandle($pPic) $btnRecord = GUICtrlCreateButton("Record", 10, 490, 80, 26) GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUISetState(@SW_SHOW, $hGUI) #endregion GUI _GDIPlus_Startup() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 17) $tLayout = _GDIPlus_RectFCreate(10, 10, 100, 40) $hFormat = _GDIPlus_StringFormatCreate() $hBrush = _GDIPlus_BrushCreateSolid(0xAFFF0000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btnRecord If $blRecording Then GUICtrlSetData($btnRecord, "Record") Else If Not FileExists($sRecordDir) Then DirCreate($sRecordDir) GUICtrlSetData($btnRecord, "Stop recording") EndIf $blRecording = Not $blRecording EndSwitch $bRecvtmp = TCPRecv($iSocket, 4096, 1) ;4kb If @error Then ExitLoop If Not BinaryLen($bRecvtmp) Then ContinueLoop $bStream &= $bRecvtmp If $iImgLen = 0 Then $sStream = BinaryToString($bStream) $iContLenPos = StringInStr($sStream, "Content-Length: ", 2) $iEOH = StringInStr($sStream, @CRLF & @CRLF, 2, 1, $iContLenPos) If $iEOH = 0 Or $iContLenPos = 0 Then ContinueLoop $sTrim2ContLen = StringTrimLeft($sStream, $iContLenPos + $iContLengthLen - 1) $iImgLen = Number(StringLeft($sTrim2ContLen, StringInStr($sTrim2ContLen, @CR, 2) - 1)) $bStream = BinaryMid($bStream, $iEOH + 4) EndIf If $iImgLen = 0 Then ContinueLoop $iStreamLen = BinaryLen($bStream) If $iStreamLen < $iImgLen Then ContinueLoop If Not $blGUIMinimized Then $hBMP = Load_BMP_From_Mem($bStream) If $blRecording Then $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBMP) _GDIPlus_GraphicsDrawStringEx($hGraphics, "[•REC]", $hFont, $tLayout, $hFormat, $hBrush) EndIf $hHBITMAP2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP) _WinAPI_DeleteObject(_SendMessage($hPic, $STM_SETIMAGE, 0, $hHBITMAP2)) _GDIPlus_ImageDispose($hBMP) If $blRecording Then _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_DeleteObject($hHBITMAP2) EndIf If $blRecording Then $pBuffer = DllStructCreate("byte[" & $iImgLen & "]") If $iStreamLen > $iImgLen Then DllStructSetData($pBuffer, 1, BinaryMid($bStream, 1, $iImgLen)) $bStream = BinaryMid($bStream, $iImgLen) Else DllStructSetData($pBuffer, 1, $bStream) $bStream = Binary("") EndIf $hImgFile = _WinAPI_CreateFile($sRecordDir & "\snap_" & StringFormat("%.4d", $iImgCount) & ".jpg", 3, 4, 4) _WinAPI_WriteFile($hImgFile, DllStructGetPtr($pBuffer), $iImgLen, $iWritten) _WinAPI_CloseHandle($hImgFile) $iImgCount += 1 EndIf $iImgLen = 0 WEnd _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_Shutdown() TCPCloseSocket($iSocket) TCPShutdown() Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam) Local Const $SC_MINIMIZE = 0xF020, $SC_RESTORE = 0xF120 Switch BitAND($wParam, 0xFFF0) Case $SC_MINIMIZE, $SC_RESTORE $blGUIMinimized = Not $blGUIMinimized EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SYSCOMMAND Func Load_BMP_From_Mem($bImage) ;_GDIPlus_BitmapCreateFromMemory2 ;Author: UEZ ;Modified: ProgAndy, Yashied, FireFox If Not IsBinary($bImage) Then Return 0 Local $memBitmap = Binary($bImage) Local $iLen = BinaryLen($memBitmap) Local $GMEM_MOVEABLE = 0x0002 Local $aResult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $GMEM_MOVEABLE, "ulong_ptr", $iLen) Local $hData = $aResult[0] $aResult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hData) If @error Then Return 0 Local $tMem = DllStructCreate("byte[" & $iLen & "]", $aResult[0]) DllStructSetData($tMem, 1, $memBitmap) DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hData) If @error Then Return 0 $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $hData, "int", True, "ptr*", 0) $hStream = $aResult[3] If @error Then Return 0 $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) If @error Then Return 0 DllCall('oleaut32.dll', 'long', 'DispCallFunc', 'ptr', $hStream, 'ulong_ptr', 8 * (1 + @AutoItX64), 'uint', 4, 'ushort', 23, 'uint', 0, 'ptr', 0, 'ptr', 0, 'str', '') Return $aResult[2] EndFunc ;==>Load_BMP_From_Mem _ Advanced example : Preview : Attachment : IP Camera.au3 IP Camera.au3 (Previous: 34 downloads) Enjoy, I'm watching U !1 point
-
Excel Rounding Issue
seadoggie01 reacted to Subz for a topic
Have you tried reading the cell as a formula rather than a value?1 point -
How to click link by text in WebDriver UDF
Danp2 reacted to JLogan3o13 for a topic
A note to some of our report-happy forum members; if we begin reporting every thread where someone is showing less than the greatest effort, I do believe we'll bring down the site. Yes, people who supply little to no detailed information, or don't show a lot of effort, can be irritating. This could be because they are new to the language, there is a language barrier, or they're just used to people spoon-feeding them answers on other forums. Regardless, if you see a thread where you believe the OP should provide more information you can: (1) do what @Danp2 has been doing here and try to nudge them in the right direction, or (2) move on to another thread. No need to report and ask the Moderation staff to scold them.1 point -
Script created browser window no longer functioning - after working for years
RandomLunatic reacted to Danp2 for a topic
This seems to be coming up a lot lately. Try adding the following to the beginning of your script -- #include <Process.au3> Local $regValue = "0x2AF8" ; IE11 edge mode: 11001 (0x2AF9) ; IE11: 11000 (0x2AF8) ; IE10: 10001 (0x2711) ; IE10: 10000 (0x02710) ; IE 9: 9999 (0x270F) ; IE 9: 9000 (0x2328) ; IE 8: 8888 (0x22B8) ; IE 8: 8000 (0x1F40) ; IE 7: 7000 (0x1B58) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", _ProcessGetName(@AutoItPID), "REG_DWORD", $regValue) Code comes from here --1 point -
FF.au3 (v0.6.0.1b-15) [End of life]
Earthshine reacted to Danp2 for a topic
So, you are saying it's beyond compare? 😆1 point -
FF.au3 (v0.6.0.1b-15) [End of life]
TheXman reacted to Earthshine for a topic
BeyondCompare makes winmerge look lame. It’s the best comparison tool out there1 point -
ToolTip position issue
Musashi reacted to pixelsearch for a topic
I got a similar (worse) problem with ToolTip, which makes a script completely freeze. Even an Esc HotKey to end the script doesn't respond. The only way to stop the script is to use the Task manager to kill AutoIt3.exe Our discussion above indicated that the problem happened when several Tooltips didn't get the same parameters. But now I find a "complicated" case where the issue appears with only one tooltip in the script, for example, a tooltip placed in a function which will be called several times during the script : Func Show_Tooltip() ToolTip("text here", @DesktopWidth / 2, (@DesktopHeight - $iY_resized) / 2 + 9, "", 0, 2) ; + 9 (good position), 0 = no icon, 2 = center tip at x,y EndFunc 1st time the function is called : no problem. 2nd time the function is called : the script freezes under certain conditions. To solve the issue in all cases (no more freeze) then the function needs to be called like this : Func Show_Tooltip() ToolTip("", 0, 0, "", 0, $TIP_BALLOON) ; Dan_555's patch as ToolTip("") isn't enough ToolTip("text here", @DesktopWidth / 2, (@DesktopHeight - $iY_resized) / 2 + 9, "", 0, 2) ; + 9 (good position), 0 = no icon, 2 = center tip at x,y EndFunc This tip could be helpful in case your script froze and you don't know why, in case you got a tooltip in it. For those of you who are really interested in this issue, here are some infos about the "complicated" case where it happens to me. It involves all of the following : * a parent window $hGUI_Background created with $WS_EX_COMPOSITED extended style (..., $WS_POPUP, $WS_EX_COMPOSITED). Please note that this parent window covers exactly all desktop (width = @DesktopWidth, height = @DesktopHeight) * a child window $hGUI_Preview created with $WS_CHILD style, parent $hGUI_Background (..., $WS_CHILD, -1, $hGUI_Background) * a control image $idPic inside the child window, coords 0, 0 and control size = same size as the child window * GUICtrlSetResizing($idPic, $GUI_DOCKAUTO) so the control image "resizes and repositions according to new window size", great ! * Mouse wheel calls Func WM_MOUSEWHEEL() to zoom + or - the child window (i.e the image) => WinMove($hGUI_Preview, ...) * a tooltip displayed at the top of the child window, each time the image is resized (issue would occur wherever the tooltip is displayed) * freeze arrives as soon as the zoomed image width reaches @DesktopWidth Interesting : as soon as I remove the extended style $WS_EX_COMPOSITED, then there is no freeze at all, even without Dan_555's patch ! But as I added $WS_EX_COMPOSITED to remove all flickering while zooming (and it really works fine), then I'll never remove $WS_EX_COMPOSITED any more. Here is something else I discovered 5 min ago : if the parent GUI didn't cover the whole desktop, then things would have gone much better. For example let's create the parent GUI with Width = @DesktopWidth and Height = @DesktopHeight - 100 (tested) Now we can display the tooltip in a part of the screen outside the parent GUI and there's no freezing at all... even without Dan_555's patch ! So it seems that there is an issue during the redraw, when the parent window got a $WS_EX_COMPOSITED extended style and a tooltip is already present "covering" the parent window. Gee... it wasn't easy to debug. Thanks to Dan_555 for having found a solution and to Jpm who sent the fix to Jon1 point -
There is a bug in your for loop, you should take account of $iStart in your calculation of row/column. If you run this, it will crash : #include <Array.au3> Local $a = [0,0,0,1,2,3,4] $a = _Array_Resize($a, 2, 3) _ArrayDisplay($a) Func _Array_Resize(ByRef $aArray1d, $iColumns, $iStart = Default) If IsKeyword($iStart) Then $iStart = 0 Local $iElements = UBound($aArray1d) - $iStart ; If the conversion would leave blank cells If Mod($iElements, $iColumns) <> 0 Then Return SetError(1, 0, False) Local $aArray2d[$iElements/$iColumns][$iColumns] Local $iRow = 0 For $i=$iStart To UBound($aArray1d) - 1 $aArray2d[$iRow][Mod($i, $iColumns)] = $aArray1d[$i] ; If this is the end of a column, increase the row counter If Mod($i, $iColumns) = $iColumns - 1 Then $iRow += 1 Next Return $aArray2d EndFunc1 point
-
DWORD. Got also W7x64 and it's working fine...1 point
-
1 point
-
Database (sqlite) examples with GUI?
BlackLumiere reacted to ISI360 for a topic
First, check the folders in the ISN settings. Go to File -> Settings -> Program Paths. Here you will find "path for finisehd projects". This is the default folder ISN will move compileds projects to. And you can also adjust this behavior as follows: Check Project -> Project settings -> Compile settings. Here you can choose 2 modes. First is to move the compiled porject in the "finished projects" folder (default) or second to simply create an subfolder in the project which contains the compiled stuff. And for much more personalisation you could also make a makro to a macroslot. So..what the hell are macrosolots? These are simply 1-7 Slots you can assin custom actions to. They will be displayed in the toolbar and the "tools" menu. You can create these under Project -> Marcros. For example you could create a macro that compiles you file 1, 2, 3.. to custom directories and so on. Assin this to a macroslot an you can simply "trigger " the macro by a click. Hell you could also assign a hotkey in the settings to an macroslot I think, some of that will help you1 point -
For people new to SQLite, I'd recommend following the step by step approach: o) First install a nice 3rd-party SQLite DB manager named SQLite Expert o) Used this to design your DB o) Use the SQL tab to run the various SQL queries and statements you expect to be using o) Fine-tune the design as necessary o) Only then start coding your fancy GUI app.1 point