Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/05/2021 in all areas

  1. Example code for IPv6 to uint128 code: #include "..\include\BigNum.au3" Local $sIPv6 = "2001: 4860: 4860 :: 8888" ; there shouldn't be spaces and add trailing column $sIPv6 = StringReplace($sIPv6, ' ', '') & ':' ; split string on columns Local $aIPv6 = StringRegExp($sIPv6, "([[:xdigit:]]{0,4}):", 3) ; expand double columns to strings of zeroes ; and store hex values in structure uword elements Local $tIPv6_16 = DllStructCreate("ushort[8]") Local $tIPv6_64 = DllStructCreate("uint64[2]", DllStructGetPtr($tIPv6_16)) For $i = 0 To 7 If $aIPv6[$i] == "" Then $aIPv6[$i] = "0" For $j = 0 To 7 - UBound($aIPv6) _ArrayInsert($aIPv6, $i + 1 + $j, "0") Next EndIf DllStructSetData($tIPv6_16, 1, Number("0x" & $aIPv6[$i]), 8 - $i) Next ; fetch hi and lo uint64 values Local $iHi64 = _UintToString(DllStructGetData($tIPv6_64, 1, 2), 10) Local $iLo64 = _UintToString(DllStructGetData($tIPv6_64, 1, 1), 10) ; shift left hi value by 64 bits ConsoleWrite(_bignum_parse($iHi64 & " * 18446744073709551616 + " & $iLo64) & @LF) Func _UintToString($i, $base) Return DllCall("msvcrt.dll", "wstr:cdecl", "_ui64tow", "uint64", $i, "wstr", "", "int", $base)[0] Return $aRes[0] EndFunc ;==>_UintToString The reverse conversion left as exercise to readers.
    1 point
  2. Danp2

    websocket window7

    FWIW, I recently created a github repo with a slightly modified version of @FireFox's code, which can be found here. I know this doesn't help you, but maybe someone else will benefit. 😉 Have you considered upgrading to Windows 10?
    1 point
  3. Luke94

    FileSaveDialog

    All FileSaveDialog does is returns the full path of the selected file. You can then use the return value to write to. For example: #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> Global $sString = 'This is a string.' ; This is what we're going to write to the selected file Example() Func Example() ; Create a constant variable in Local scope of the message to display in FileSaveDialog. Local Const $sMessage = "Choose a filename." ; Display a save dialog to select a file. Local $sFileSaveDialog = FileSaveDialog($sMessage, "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "Scripts (*.au3)", $FD_PATHMUSTEXIST) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file was saved.") Else ; Retrieve the filename from the filepath e.g. Example.au3. Local $sFileName = StringTrimLeft($sFileSaveDialog, StringInStr($sFileSaveDialog, "\", $STR_NOCASESENSEBASIC, -1)) ; Check if the extension .au3 is appended to the end of the filename. Local $iExtension = StringInStr($sFileName, ".", $STR_NOCASESENSEBASIC) ; If a period (dot) is found then check whether or not the extension is equal to .au3. If $iExtension Then ; If the extension isn't equal to .au3 then append to the end of the filepath. If Not (StringTrimLeft($sFileName, $iExtension - 1) = ".au3") Then $sFileSaveDialog &= ".au3" Else ; If no period (dot) was found then append to the end of the file. $sFileSaveDialog &= ".au3" EndIf Local $hFile = FileOpen($sFileSaveDialog, $FO_OVERWRITE) ; Open the full path (return value) of the FileSaveDialog FileWrite($hFile, $sString) ; Write the string to the file FileClose($hFile) ; Close the file ; Display the saved file. MsgBox($MB_SYSTEMMODAL, "", "You saved the following file:" & @CRLF & $sFileSaveDialog) EndIf EndFunc ;==>Example
    1 point
  4. Try this, seems to work better : #include <GDIPlus.au3> _GDIPlus_Startup() Local $sFile = FileOpenDialog("Select an image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)") If @error Or Not FileExists($sFile) Then Exit Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) Local $tPalette = _GDIPlus_PaletteInitialize(256, $GDIP_PaletteTypeOptimal, 256, False, $hImage) _GDIPlus_BitmapConvertFormat($hImage, $GDIP_PXF08INDEXED, $GDIP_DitherTypeDualSpiral8x8, $GDIP_PaletteTypeFixedHalftone256, $tPalette) _GDIPlus_ImageSaveToFile($hImage, "test8bits.bmp") _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() BMP does not support transparency.
    1 point
  5. Yes, DirGetSize() is probably your best measure to calculate the progress of a silent installation, knowing in advance the actual installed size of the application.
    1 point
  6. water

    Timeout for _WD_Navigate

    Shouldn't you set the timeout BEFORE calling _WD_Navigate?
    1 point
  7. DO NOT PM me asking for help. I have other activities beside answering to your issues. Anyway, my last attempt here : Func _GUICtrlHover($hwmdover, ByRef $LbOver, ByRef $LbOverPlus, ByRef $LbsetOver) Local Static $sOver, $iPrev = -1 Local $aCInfo = GUIGetCursorInfo($hwmdover) If $aCInfo[4] = $sOver Then Return $sOver = $aCInfo[4] If $iPrev >= 0 Then GUICtrlSetBkColor($LbsetOver[$iPrev], 0x000000) For $i = 0 To UBound($LbsetOver) - 1 If $sOver = $LbOver[$i] Then $iPrev = $i Return GUICtrlSetBkColor($LbsetOver[$i], 0xFFFFFF) EndIf Next For $i = 0 To UBound($LbsetOver) - 1 If $sOver = $LbOverPlus[$i] Then If $iPrev >= 0 Then GUICtrlSetBkColor($LbsetOver[$i], 0x000000) ExitLoop EndIf Next $iPrev = -1 EndFunc ;==>_GUICtrlHover FYI, it is against forum rules to PM for help. I suggest you read those to refresh your memory...
    1 point
  8. Don't go getting DLLs of unknown origin. I'd recommend none.
    1 point
  9. A quickly thrown together example: #include <GuiButton.au3> Global $g_hWnd1, $g_hWnd2 Global $g_hCheckBox Run('MSTSC.exe "C:\Users\Public\Desktop\RDP Consoles\administrator@windows-1.rdp"') ; There's two warning windows that appear $g_hWnd1 = WinWait('Remote Desktop Connection', '', 5) ; Wait for the first warning window If IsHWnd($g_hWnd1) = 1 Then ; Check if the first warning window handle was obtained Sleep(2500) ; Wait 2.5 seconds - without a wait, the buttons aren't clicked $g_hCheckBox = ControlGetHandle($g_hWnd1, '', '[CLASS:Button; INSTANCE:1]') ; Get the control handle for the checkbox _GUICtrlButton_SetCheck($g_hCheckBox, True) ; Check the checkbox ControlClick($g_hWnd1, '', '[CLASS:Button; INSTANCE:11]') ; Click the Yes button EndIf Sleep(1000) $g_hWnd1 = WinWait('Remote Desktop Connection', '', 5) ; Wait for the second warning window If IsHWnd($g_hWnd1) = 1 Then ; Check if the second warning window handle was obtained Sleep(2500) ; Wait 2.5 seconds - without a wait, the buttons aren't clicked $g_hCheckBox = ControlGetHandle($g_hWnd1, '', '[CLASS:Button; INSTANCE:3]') ; Get the control handle for the checkbox _GUICtrlButton_SetCheck($g_hCheckBox, True) ; Check the checkbox ControlClick($g_hWnd1, '', '[CLASS:Button; INSTANCE:5]') ; Click the Yes button EndIf Sleep(1000) $g_hWnd1 = WinWait('administrator - windows-1', '', 5) ; Wait for the Remote Desktop Connection to appear If IsHWnd($g_hWnd1) = 1 Then ; Check if the Remote Desktop Connection window handle was obtained WinClose($g_hWnd1) ; Close the window $g_hWnd2 = WinWait('Remote Desktop Connection', '', 5) ; Wait for the close confirmation window If IsHWnd($g_hWnd2) = 1 Then ; Check that we found the above window ControlClick($g_hWnd2, '', '[CLASS:Button; INSTANCE:1]') ; Click Yes EndIf WinWaitClose($g_hWnd1, '', 5) ; Wait for the RDP to close EndIf
    1 point
×
×
  • Create New...