Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/14/2023 in all areas

  1. Latest update just released. See below for change log.
    2 points
  2. @Andreik very good work. Here another version
    1 point
  3. How about something like this? It's not especially fast but it seems to work. Set $sUser to be in sAMAccountName format. I didn't test any others like UPN, CN, DN, or RDN. $sUser = "sAMAccountName" $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\ROOT\cimv2" ) If @error Then MsgBox ( 4096 , "error" , "Error getting wmi : " & Hex(@error, 8)) Else $oWMIItems = $oWMI.ExecQuery("select * from Win32_UserAccount WHERE Name = '" & $sUser & "'") If IsObj($oWMIItems) Then For $oItem In $oWMIItems Local $sPasswordChangeable = $oItem.PasswordChangeable Local $sName = $oItem.Name Next EndIf EndIf MsgBox ( 4096 , @ScriptName , "USERNAME: " & $sName & @CRLF & "PW Changeable: " & $sPasswordChangeable )
    1 point
  4. normal the #AutoIt3Wrapper_UseX64=y directives is placed at the top of the script and determines whether the script will run in 64 or 32 bit, and not inside the function, which you can call multiple times within the same script
    1 point
  5. compile this code and F1 for SCAN #AutoIt3Wrapper_UseX64=y HotKeySet("{F1}", "scan") While 1 Sleep(100) WEnd Func scan() ConsoleWrite(@SystemDir & @CRLF) Run("C:\Windows\system32\WFS.exe") $hWnd = WinWait("Windows Fax and Scan", "", 3) ConsoleWrite("$hWnd=" & $hWnd & @CRLF) If $hWnd Then WinActivate($hWnd) ;~ ; With Menu WinMenuSelectItem($hWnd, "", "&File", "&New", "&Scan") ; Wait the New Scan win $hScanDlg = WinWait("New Scan", "", 3) ControlClick($hScanDlg, "", "Button4") EndIf EndFunc
    1 point
  6. Glad you got a solution. I will delete the attachment above because my attachment quota is 100% and I need some free space. In case you need it again just PM me.
    1 point
  7. What's the exact error message? I looked at the script and the error messages are very detailed so we can pin-point the error
    1 point
  8. Andreik

    GDI+ Transparency Mask

    As a request in this thread I wrote a small function to add a transparency mask to a bitmap. I post it here with an example, maybe someone else will need it. The function works with both 32/64 bit versions of AutoIt. #AutoIt3Wrapper_UseX64=y #include <GDIPlus.au3> #include <Memory.au3> $hMain = GUICreate('Transparency mask blending', 720, 400) $cPic = GUICtrlCreatePic('', 0, 0, 720, 400) GUISetState(@SW_SHOW, $hMain) _GDIPlus_Startup() $hDraw = _GDIPlus_BitmapCreateFromScan0(720, 400) $hBackground = _GDIPlus_ImageLoadFromFile('background.png') $hTree = _GDIPlus_ImageLoadFromFile('tree.png') $hMask = _GDIPlus_ImageLoadFromFile('mask.png') $hGraphics = _GDIPlus_ImageGetGraphicsContext($hDraw) $aDim = _GDIPlus_ImageGetDimension($hTree) $DrawWithMask = False AdlibRegister('Draw', 3000) Draw() Do Until GUIGetMsg() = -3 ; GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($hDraw) _GDIPlus_ImageDispose($hBackground) _GDIPlus_ImageDispose($hTree) _GDIPlus_ImageDispose($hMask) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Func Draw() _GDIPlus_GraphicsClear($hGraphics) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBackground, 0, 0, 720, 400, 0, 0, 720, 400) If $DrawWithMask Then Local $hCloneTree = _GDIPlus_ImageClone($hTree) SetBitmapMask($hCloneTree, $hMask) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hCloneTree, 0, 0, $aDim[0], $aDim[1], 550, 200, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hCloneTree) Else _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hTree, 0, 0, $aDim[0], $aDim[1], 550, 200, $aDim[0], $aDim[1]) EndIf BitmapToCtrl($hDraw, $cPic) $DrawWithMask = Not $DrawWithMask EndFunc Func SetBitmapMask($hBitmap, $hMask) Local $aDim1 = _GDIPlus_ImageGetDimension($hBitmap) Local $aDim2 = _GDIPlus_ImageGetDimension($hMask) If $aDim1[0] <> $aDim2[0] Or $aDim1[1] <> $aDim1[1] Then Return SetError(1, 0, Null) Local $tBitmap = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aDim1[0], $aDim1[1], BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) Local $tMask = _GDIPlus_BitmapLockBits($hMask, 0, 0, $aDim2[0], $aDim2[1], BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) If @AutoItX64 Then Local $sCode = '0x56534C89C6BBFFFFFF00AD25000000FF211A09024883C204E2F05B5EC3' Else Local $sCode = '0x8B4C24048B7C24088B74240CBBFFFFFF00AD25000000FF211F090783C704E2F1C20C00' EndIf Local $dCode = Binary($sCode) Local $iCode = BinaryLen($dCode) Local $pCode = _MemVirtualAlloc(0, $iCode, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) Local $tCode = DllStructCreate('byte Code[' & $iCode & ']', $pCode) $tCode.Code = $dCode Local $aCall = DllCallAddress('int', DllStructGetPtr($tCode), 'int', $aDim1[0] * $aDim1[1], 'ptr', $tBitmap.Scan0, 'ptr', $tMask.Scan0) _MemVirtualFree($pCode, $iCode, $MEM_DECOMMIT) _GDIPlus_BitmapUnlockBits($hBitmap, $tBitmap) _GDIPlus_BitmapUnlockBits($hMask, $tMask) Return $aDim1 EndFunc Func BitmapToCtrl($hBitmap, $cCtrl) Local Static $STM_SETIMAGE = 0x0172 $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($cCtrl, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBITMAP)) _WinAPI_DeleteObject($hHBITMAP) EndFunc Resources used in this example can be downloaded at the link below (sorry for external link, my attachement quota is 100%). Credits for graphics resources goes to https://itch.io. Transparency Mask.zip
    1 point
  9. A quick query of "json2xml" or "JSON to XML" in your Internet search engine of choice would show that there are tools out there that convert JSON to XML (or at least try to). So the short answer is yes. However, in all the years that I've worked with XML and JSON, I've never tried to convert JSON to XML. So I'm not sure how well any of those conversion tools work - especially when it comes to XML datasets that make extensive use of things like CDATA and namespaces. If I wanted to create or modify an XML dataset, I would use tools & languages designed for that purpose - like working with the XML DOM using XPATH or transforming it using XSLT. I always try use the best tools for the job because it makes the job so much easier. I pretty much answered the same question in your previous topic, near the bottom of this post:
    1 point
  10. This seems to work for IRC. If I do not use any of the old UDFs or scripts, and just write one up from scratch, it works. Global $server = "irc.esper.net" Global $port = "6667" Global $nick = "TestWookie" Global $channel = "#TestWookie" Opt("TCPTimeout", 1500) TCPStartUp() $sock = TCPConnect(TCPNameToIP($server), $port) Sleep(100) If $sock = -1 Then ConsoleWrite("No response from server." & @CRLF) Exit EndIf TCPSend($sock, "NICK " & $nick & @CRLF) TCPSend($sock, "USER " & $nick & " 0 0 " & $nick & @CRLF) While 1 $recv = TCPRecv($sock, 9999) If @error = -1 Then ConsoleWrite("ERROR: " & @error & @CRLF) Exit Else ConsoleWrite($recv & @CRLF) EndIf If $recv Then $sData = StringSplit($recv, @CRLF) For $i = 1 To $sData[0] Step 1 $sTemp = StringSplit($sData[$i], Chr(32)) If $sTemp[1] = "" Then ContinueLoop EndIf If $sTemp[1] = "PING" Then TCPSend($sock, "PONG " & $sTemp[2] & @CRLF) ContinueLoop EndIf If $sTemp[0] >= 2 Then If $sTemp[2] = "376" Then TCPSend($sock, "JOIN " & $channel & @CRLF) ContinueLoop EndIf EndIf Next EndIf WEnd Exit
    1 point
  11. @TheDcoder I tried your bot script, my script, and TrayIRC and none of them work properly in the newest version. In your bot script it connects but then says AUTH failed and disconnects. My script won't even connect, just returns error 10038. (socket operation on non-socket) TrayIRC says "unable to connect to server" EDIT: If i repeatedly run the script after it exits, sometimes TrayIRC will connect. (1 out of 10 tries) Even with the wrapper directive, no difference. Seems IRC is broken on newer versions. *Switches to Python* 😈
    1 point
  12. Where is your sqlite3.dll located after all? And is your application 32 or 64 bit? Edit: check the attached archive and run the example and let me know if it works
    1 point
  13. both commands do the same thing here he clicks on the toolbar in the new scan ; With ControlCommand ControlCommand($hWnd, "", "ToolbarWindow322", "SendCommandID", 177) ;from Au3Info ToolBar tab and here it calls the menu file>new>scan ;~ ; With Menu WinMenuSelectItem($hWnd, "", "&File", "&New", "&Scan") see which one works best for you, and delete the other one
    1 point
  14. GokAy

    Counter skipping 0

    A different approach (banged my head more than once on various hard places while trying to change Excel formula to AutoIT ) Someone has to verify but seems more accurate than Nine's code. Avg. CPU loads looks similar for both (2.5-4%). Console Output: 120011.8351 - 120000 #include <GUIConstants.au3> GUICreate ("Test") Local $Countdown = GUICtrlCreateLabel ("", 50, 50, 300, 30) GUISetState() Local $CDHrs = 0, $Mn = 2, $Sc = 0 GUICtrlSetData($Countdown, 'Hrs:' & $CDHrs & ' ' & 'Min:' & $Mn & ' ' & 'Sec:' & $Sc) Local $iCountDownTime = ($CDHrs*60*60+$Mn*60+$Sc)*1000 Local $hTimer = TimerInit() Local $bTimerRunning = True Local $iCounter = 0 While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If $bTimerRunning Then Local $iSc = floor(mod(60+$Sc-mod(int(TimerDiff($hTimer)/1000),60),60)) Local $iMn = Int(mod((60+$Mn-Floor(TimerDiff($hTimer)/1000-$Sc)/60),60)) Local $iCDHrs = Int(mod(($CDHrs-Floor(TimerDiff($hTimer)/1000-$Sc-60*$Mn)/(60*60)),60)) if $iCounter <> Int(TimerDiff($hTimer)/1000) Then GUICtrlSetData($Countdown, 'Hrs:' & $iCDHrs & ' ' & 'Min:' & $iMn & ' ' & 'Sec:' & $iSc) $iCounter = Int(TimerDiff($hTimer)/1000) EndIf If $iSc=0 and $iMn=0 and $iCDHrs= 0 Then ConsoleWrite(TimerDiff($hTimer) & " - " & $iCountDownTime & @CRLF) $bTimerRunning=False EndIf EndIf WEnd Modified Nine's Code to include a second timer (I hope it is accurate?). Console Output: 122316.3811 #include <GUIConstants.au3> GUICreate ("Test") Local $Countdown = GUICtrlCreateLabel ("", 50, 50, 300, 30) GUISetState() Local $CDHrs = 0, $Mn = 2, $Sc = 0 GUICtrlSetData($Countdown, 'Hrs:' & $CDHrs & ' ' & 'Min:' & $Mn & ' ' & 'Sec:' & $Sc) Local $hTimer = TimerInit() Local $hTimer2 = TimerInit() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If TimerDiff($hTimer) < 1000 Then ContinueLoop $hTimer = TimerInit() $Sc -= 1 If $Sc < 0 Then $Mn -= 1 If $Mn < 0 Then $CDHrs -= 1 If $CDHrs < 0 Then ConsoleWrite(TimerDiff($hTimer2) & @CRLF) ExitLoop EndIf $Mn = 59 EndIf $Sc = 59 EndIf GUICtrlSetData($Countdown, 'Hrs:' & $CDHrs & ' ' & 'Min:' & $Mn & ' ' & 'Sec:' & $Sc) WEnd
    1 point
×
×
  • Create New...