Leaderboard
Popular Content
Showing content with the highest reputation on 04/10/2018 in all areas
-
Try this: Local $aFolders = [ _ "aaaaa1234", _ ; OK "aa4444", _ ; OK "asd6543", _ ; OK "aaaaaaaaaaaaaaaaaaaaaaaa3333", _ ; OK "a45679", _ ; no only 1 letter ahead) "aaaaa12", _ ; no (no 4 digits trailing) "a2", _ ; no (too short) "2", _ ; no (too short) "a", _ ; no (too short) "没有这样的文件1234", _ ; OK ("letters" ahead) "zzzzzzz45645", _ ; no (digits in between [more than 4 trailing) "fgdshnio333fno4567", _ ; no (digits in between) "3fdsnofds*******4567", _ ; no (starts with digit) "Русский/////////۳۵٢٨" _ ; OK (letters ahead, 4 decimal digits trailing (Hindi digits) ] For $s In $aFolders MsgBox(0, "", $s & @LF & (StringRegExp($s, "(*UCP)^\p{L}{2}\D*\d{4}$") ? " matches" : " fails") & " the criterion.") Next As you can see, Unicode letters and decimal digits are correctly recognized and considered, not only A-Z and 0-9. If you're sure to never have to deal with non-ASCII letters (and I mean a-z A-Z, excluding letters with diacritics), replace (*UCP)^\p{L} by [[:alpha:]] in the pattern.1 point
-
What's the problem? Not needed how? If input box is going to be used then add that directive. The only "issue" is the use of imperative sentence, because if the InputBox() function is detected inside the script Aut2Exe does everything by itself. InputBox("AA", "Bb") However, obviously this wouldn't work without the #pragma: Execute('InputBox("AA", "Bb")') ...the last time I checked.1 point
-
@31290 Remove the quotes around '$oLink.href' and your InetGet should work.1 point
-
ProcessExists stops working?
Earthshine reacted to JohnOne for a topic
Only way you're likely to get real help with this one is to post your whole code proper I'm afraid.1 point -
If you are injecting some text in notepad and then save it in a specific folder...why don't you use FileWrite? Hi!1 point
-
I'm not sure you are realy thought about me ... btw. after a quick review, I think your aproach is good as far this is working, as so far I can only sugest to you to try this clonNode method: https://msdn.microsoft.com/en-us/library/ms762269(v=vs.85).aspx1 point
-
To separate the properties you need to use ";" but not "," $returnValue = ControlSetText("FILE NOTES", "", "[CLASS:Edit;INSTANCE:1]", $acno) ; paste acno Or simply $returnValue = ControlSetText("FILE NOTES", "", "Edit1", $acno) ; paste acno1 point
-
You should be able to do this with the standard IE UDF commands. Here's an example -- #include <ie.au3> Example() Func Example() Local $oIE = _IECreate("http://downloads.dell.com/published/pages/latitude-12-5280-laptop.html", 1) Local $oDiv = _IEGetObjById($oIE, "Drivers-Category.BI") Local $oTable = _IETagNameGetCollection($oDiv, "Table", 0) Local $oRow = _IETagNameGetCollection($oTable, "TR", 1) Local $oCell = _IETagNameGetCollection($oRow, "TD", 5) Local $oLinks = _IETagNameGetCollection($oCell, "A") ConsoleWrite("Found " & $oLinks.length & " links!" & @CRLF) For $oLink In $oLinks ConsoleWrite($oLink.href & @CRLF) Next EndFunc ;==>Example1 point
-
Just test if the link ends with .exe or .txt1 point
-
No, just this three lines. What AutoIt Version you are using ? Yes Now I see you are not using SciTE4AutoIt3 as you still use SciTE-Lite So as so far this three line snipet will not show you any different. Your problem is that you are using Au3 x86 with 64bit Driver. You must to decied if you want to use x86 or x64 bit version, because you can not mix them together.1 point
-
BatMan22, Look at TraySetOnEvent ($TRAY_EVENT_PRIMARYDOWN) in the Help file. kylomas1 point
-
Check the COM error in your COM error handler and decide what to do. In general: ignoring errors and restarting a script most of the time only leads to an endless loop1 point
-
help with accessing folder and path
prasad123 reacted to JLogan3o13 for a topic
@prasad123 This works for me, and uses a whole lot let quotes: #include <ScreenCapture.au3> $sPath = @MyDocumentsDir & "\Automation Test " & @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & "." & @MIN & "." & @SEC If Not(FileExists($sPath)) Then DirCreate($sPath) EndIf _ScreenCapture_Capture($sPath & "\myscreen.jpg")1 point -
Restart UDF
boomingranny reacted to JohnOne for a topic
Yes, but it is not strictly correct, I mean "'-> Restarting..!'" might be more apt at that point. I'm not nitpicking, if the script fails to restart etc...1 point -
Here an example how to send an image without saving it to disk first! It will take a screenshot, convert it to a jpg image and send to the server everything done in the memory! Client Send - Receive Picture.au3 #include <memory.au3> #include <screencapture.au3> _GDIPlus_Startup() TCPStartup() Local $ConnectedSocket, $szData Local $szIPADDRESS = @IPAddress1 Local $nPORT = 33891 $ConnectedSocket = -1 $ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT) If @error Then Exit MsgBox(4112, "Error", "TCPConnect failed with WSA error: " & @error) $iMsgBox = MsgBox(4, "Send image", "Send image to server?") If $iMsgBox = 6 Then $hHBITMAP = _ScreenCapture_Capture("", 0, 0, 100, 100) $bImage = HBITMAP2BinaryString($hHBITMAP) ConsoleWrite(TCPSend($ConnectedSocket, Binary($bImage)) & @LF) _WinAPI_DeleteObject($hHBITMAP) EndIf _GDIPlus_Shutdown() Exit Func HBITMAP2BinaryString($HBITMAP) ;function by Andreik Local $BITMAP = _GDIPlus_BitmapCreateFromHBITMAP($HBITMAP) Local $JPG_ENCODER = _GDIPlus_EncodersGetCLSID("jpg") Local $TAG_ENCODER = _WinAPI_GUIDFromString($JPG_ENCODER) Local $PTR_ENCODER = DllStructGetPtr($TAG_ENCODER) Local $STREAM = DllCall("ole32.dll", "uint", "CreateStreamOnHGlobal", "ptr", 0, "bool", 1, "ptr*", 0) DllCall($ghGDIPDll, "uint", "GdipSaveImageToStream", "ptr", $BITMAP, "ptr", $STREAM[3], "ptr", $PTR_ENCODER, "ptr", 0) _GDIPlus_BitmapDispose($BITMAP) Local $MEMORY = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $STREAM[3], "ptr*", 0) Local $MEM_SIZE = _MemGlobalSize($MEMORY[2]) Local $MEM_PTR = _MemGlobalLock($MEMORY[2]) Local $DATA_STRUCT = DllStructCreate("byte[" & $MEM_SIZE & "]", $MEM_PTR) Local $DATA = DllStructGetData($DATA_STRUCT, 1) Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data;ptr") Local $aCall = DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $STREAM[3], "dword", 8 + 8 * @AutoItX64, "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) _MemGlobalFree($MEMORY[2]) Return $DATA EndFunc ;==>HBITMAP2BinaryString Server Send - Receive Picture.au3 #include <guiconstantsex.au3> #include <gdiplus.au3> #include <memory.au3> #include <staticconstants.au3> Local $szIPADDRESS = @IPAddress1 Local $nPORT = 33891 Local $MainSocket, $edit, $ConnectedSocket, $szIP_Accepted Local $msg, $recv TCPStartup() $MainSocket = TCPListen($szIPADDRESS, $nPORT) If $MainSocket = -1 Then Exit GUICreate("My Server (IP: " & $szIPADDRESS & ")", 300, 200, 100, 100, Default, 0x00000008) $edit = GUICtrlCreateEdit("", 10, 10, 280, 180) GUISetState() $ConnectedSocket = -1 Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 $szIP_Accepted = SocketToIP($ConnectedSocket) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop $recv = TCPRecv($ConnectedSocket, 8192, 1) If @error Then ExitLoop If $recv <> "" Then GUICtrlSetData($edit, $recv) WEnd If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket) TCPShutdown() Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() $hBitmap = Load_BMP_From_Mem(Binary(GUICtrlRead($edit)), True) $hGUI = GUICreate("Test", 320, 200) $idPic = GUICtrlCreatePic("", 0, 0, 320, 200, $SS_CENTERIMAGE) GUISetState() _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) Do Until GUIGetMsg() = -3 _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() Exit Func SocketToIP($SHOCKET) Local $sockaddr, $aRet $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc ;==>SocketToIP ;====================================================================================== ; Function Name: Load_BMP_From_Mem ; Description: Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap ; ; Parameters: $bImage: the binary string which contains any valid image which is supported by GDI+ ; Optional: $hHBITMAP: if false a bitmap will be created, if true a hbitmap will be created ; ; Remark: hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format ; Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown() ; ; Requirement(s): GDIPlus.au3, Memory.au3 and _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Return Value(s): Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format), ; Error: 0 ; Error codes: 1: $bImage is not a binary string ; 2: unable to create stream on HGlobal ; 3: unable to create bitmap from stream ; ; Author(s): UEZ ; Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines and ; Yashied for _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Version: v0.97 Build 2012-04-10 Beta ;======================================================================================= Func Load_BMP_From_Mem($bImage, $hHBITMAP = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBITMAP Then Local Const $hHBmp = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>Load_BMP_From_Mem Func _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) Local $tBIHDR, $Ret, $tData, $pBits, $hResult = 0 $Ret = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($Ret[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $Ret[2], $Ret[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate('dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword') DllStructSetData($tBIHDR, 1, DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 2, $Ret[2]) DllStructSetData($tBIHDR, 3, $Ret[3]) DllStructSetData($tBIHDR, 4, 1) DllStructSetData($tBIHDR, 5, 32) DllStructSetData($tBIHDR, 6, 0) $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $Ret[2] * $Ret[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) Return $hResult EndFunc ;==>_GDIPlus_BitmapCreateDIBFromBitmap Start first Server Send - Receive Picture.au3 and then Client Send - Receive Picture.au3. Because I'm not familiar with the tcp/ip stuff I took the tcp/ip stuff from the help file! Br, UEZ1 point