Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/28/2023 in all areas

  1. Simple : Local $hMenu = TrayItemGetHandle(0) Local $tInfo = DllStructCreate($tagMENUITEMINFO) DllStructSetData($tInfo, "Size", DllStructGetSize($tInfo)) DllStructSetData($tInfo, "Mask", $MIIM_STATE) DllStructSetData($tInfo, "State", 0) ; should remove check & hilite, but only check is done Local $aCall = DllCall("user32.dll", "bool", "SetMenuItemInfoW", "handle", $hMenu, "uint", 0, "bool", True, "struct*", $tInfo)
    2 points
  2. @LarsJ If problem CreateCoreWebView2EnvironmentWithOptions ERR then add to the autoit script: EnvSet ("WEBVIEW2_USER_DATA_FOLDER", @AppDataDir & "\WebView2") (or any other folder where the script can write)
    1 point
  3. nigmamun

    sheetRowsNum error

    Thank you so much, you gave me the idea that file name can be incorrect and a found mistake in extention of excel format. .xlsm instead of .xlsx
    1 point
  4. LinkOut

    Telegram Bot UDF

    Hi! I wrote an UDF that can simplify the way you can control Telegram Bot with AutoIt. If you don't know what is a Telegram Bot, maybe you should read their official website here. All about this UDF is on my GitHub: what is, how it work, how to use and also a Test.au3 to see the script in action. But... let's talk about this UDF. What is: It's an UDF that contain functions to control a Telegram Bot. Send messages, photo, video, stickers, wait for incoming messages and answer to them. How it works: Insert you Token given from BotFather, initialize your bot with _InitBot() function and... you're ready! All functions are commented: You will find a description of what it does, an explanation for every argument that function has need and what it return. This is the test script, that initialize your bot, run all functions and write the return value. #include "Telegram UDF.au3" $ChatID = "Your_Chat_ID_For_Test" _InitBot("Bot_ID","Bot_Token") ConsoleWrite("Test _GetUpdates -> " & @TAB & _GetUpdates() & @CRLF) ConsoleWrite("Test _GetMe -> " & @TAB & _GetMe() & @CRLF) ConsoleWrite("Test _SendMsg -> " & @TAB & _SendMsg($ChatID,"Test _SendMsg") & @CRLF) ConsoleWrite("Test _ForwardMsg -> " & @TAB & _ForwardMsg($ChatID,$ChatID,'MsgID') & @CRLF) ConsoleWrite("Test _SendPhoto -> " & @TAB & _SendPhoto($ChatID,"C:\image.jpg","Test _SendPhoto") & @CRLF) ConsoleWrite("Test _SendVideo -> " & @TAB & _SendVideo($ChatID,"C:\video.mp4","Test _SendVideo") & @CRLF) ConsoleWrite("Test _SendAudio -> " & @TAB & _SendAudio($ChatID,"C:\audio.mp3","Test _SendAudio") & @CRLF) ConsoleWrite("Test _SendDocument -> " & @TAB & _SendDocument($ChatID,"C:\document.txt","Test _SendDocument") & @CRLF) ConsoleWrite("Test _SendVoice -> " & @TAB & _SendVoice($ChatID,"C:\voice.ogg","Test _SendVoice") & @CRLF) ConsoleWrite("Test _SendSticker -> " & @TAB & _SendSticker($ChatID,"C:\sticker.webp") & @CRLF) ConsoleWrite("Test _SendLocation -> " & @TAB & _SendLocation($ChatID,"74.808889","-42.275391") & @CRLF) ConsoleWrite("Test _SendContact -> " & @TAB & _SendContact($ChatID,"0123456789","Josh") & @CRLF) ConsoleWrite("Test _SendChatAction -> " & @TAB & _SendChatAction($ChatID,"typing") & @CRLF) ConsoleWrite("Test _GetUserProfilePhotos -> " & @TAB & _GetUserProfilePhotos($ChatID) & @CRLF) ConsoleWrite("Test _GetChat -> " & @TAB & _GetChat($ChatID) & @CRLF) While 1 $msgData = _Polling() _SendMsg($msgData[2],$msgData[3]) WEnd Last part of the script (While cycle) use Polling function to put the script in a wait-state for incoming messages: _Polling() function return an array ($msgData in this case) that contain information about the received message (for example, $msgData[2] is the Chat ID of the user that send the message, important to send a reply. See GitHub page for other info. So, finally, here you can find and download the library -> https://github.com/xLinkOut/telegram-udf-autoit <- UPDATE: Thanks to @mLipok to added my Telegram UDF on AutoItScript Wiki! UPDATE 2: Functions that send files to Telegram Servers (photos, videos..) don't need anymore cURL executable file. Thanks to @Jos that suggested how to use WinHttp UDF by trancexx. If you have question, bug report or anything else just contact me or reply to this Thread Don't forget to follow me on GitHub for future updates. Bye!
    1 point
  5. ?? I do not understand just export the "\Computer Configuration\Administrative Templates\All Settings" to csv with a time stamp. ?
    1 point
  6. could export list from "\Computer Configuration\Administrative Templates\Windows Components\Microsoft Edge" if that's what you want Setting State Comment Allow Address bar drop-down list suggestions Not configured No Configure Autofill Not configured No Allow Microsoft Compatibility List Not configured No Allow clearing browsing data on exit Not configured No Allow configuration updates for the Books Library Not configured No Allow Developer Tools Not configured No Configure Do Not Track Not configured No Allow Extensions Not configured No Allow Adobe Flash Not configured No Configure the Adobe Flash Click-to-Run setting Not configured No Allow FullScreen Mode Not configured No Allow InPrivate browsing Not configured No For PDF files that have both landscape and portrait pages, print each in its own orientation. Not configured No Configure Password Manager Not configured No Configure Pop-up Blocker Not configured No Allow Microsoft Edge to pre-launch at Windows startup, when the system is idle, and each time Microsoft Edge is closed Not configured No Allow printing Not configured No Allow Saving History Not configured No Allow search engine customization Not configured No Configure search suggestions in Address bar Not configured No Allow Sideloading of extension Not configured No Configure Windows Defender SmartScreen Not configured No Allow Microsoft Edge to start and load the Start and New Tab page at Windows startup and each time Microsoft Edge is closed Not configured No Allow web content on New Tab page Not configured No Always show the Books Library in Microsoft Edge Not configured No Configure additional search engines Not configured No Configure Favorites Bar Not configured No Configure Home Button Not configured No Configure kiosk mode Not configured No Configure kiosk reset after idle timeout Not configured No Configure Open Microsoft Edge With Not configured No Provision Favorites Not configured No Configure cookies Not configured No Disable lockdown of Start pages Not configured No Allow extended telemetry for the Books tab Not configured No Configure the Enterprise Mode Site List Not configured No Configure Favorites Not configured No Prevent using Localhost IP address for WebRTC Not configured No Configure Start pages Not configured No Prevent changes to Favorites on Microsoft Edge Not configured No Prevent access to the about:flags page in Microsoft Edge Not configured No Prevent certificate error overrides Not configured No Prevent the First Run webpage from opening on Microsoft Edge Not configured No Prevent Microsoft Edge from gathering Live Tile information when pinning a site to Start Not configured No Prevent bypassing Windows Defender SmartScreen prompts for sites Not configured No Prevent bypassing Windows Defender SmartScreen prompts for files Not configured No Prevent turning off required extensions Not configured No Send all intranet sites to Internet Explorer 11 Not configured No Set default search engine Not configured No Set Home Button URL Not configured No Set New Tab page URL Not configured No Show message when opening sites in Internet Explorer Not configured No Suppress the display of Edge Deprecation Notification Not configured No Keep favorites in sync between Internet Explorer and Microsoft Edge Not configured No Unlock Home Button Not configured No Allow a shared Books folder Not configured No
    1 point
  7. what do you want to export?, for what purpose? that doesn't make sense because you already know that eg here If Not $CmdLine[0] Then Global $CmdLine[5] $CmdLine[0] = 4 ;cnt $CmdLine[1] = "\Computer Configuration\Administrative Templates\Windows Components\Microsoft Edge" $CmdLine[2] = "Allow Adobe Flash" $CmdLine[3] = 4 $CmdLine[4] = "" ;optional EndIf as long as you give the path to the parameter [1] What return it to you? "\Computer Configuration\Administrative Templates\Windows Components\Microsoft Edge"
    1 point
  8. The problem is more deep than you think. By getting the hMenu of the tray menu, you can use Win32 API to modify it. But (oh surprise) even with pure Win32 API you cannot remove the focus state. So the problem is not AutoIt at all, it is a Windows issue (feature ?).
    1 point
  9. While it doesn't look like what you're talking about, maybe you want something like I've only looked at this thread before, I haven't used it, but I don't think it's specifically for loading/launching a different script. You could however easily set it up to launch other scripts in the functions that the tasks that are called from this UDF.
    1 point
  10. I'm not that familiar with DllStructs and calls myself, but I've been using them a bit lately, so I gave this a try. Check this out, it seems to work for me. I have a couple of test strings in there and they all do what's expected. For the first one, it should be run through the function until the StringLen doesn't change, so put a URL through it until there's no changes: #include <WinAPI.au3> Global $asUrls[] = [ _ 'https%253A%252F%252Flearn.microsoft.com%252Fen-us%252Fwindows%252Fwin32%252Fseccrypto%252Fcommon-hresult-values', _ 'https%3A%2F%2Fwww.autoitscript.com%2Fforum%2Ftopic%2F209966-whats-needed-to-create-_winapi_urlunescape%2F', _ '\vbnet%20code%20library\', _ 'https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-urlescapew' _ ] Global $sReturn For $iIndex = 0 To UBound($asUrls) - 1 $sReturn = _WinAPI_UrlUnescape($asUrls[$iIndex]) If @error Then ConsoleWrite('Error: ' & @error & @CRLF) Exit EndIf ConsoleWrite('Output ' & $iIndex & ': ' & $sReturn & @CRLF) Next Func _WinAPI_UrlUnescape($sUrl, $dFlags = 0) ; https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-urlunescapew Local $aUrlUnescape = DllCall("Shlwapi.dll", "long", "UrlUnescapeW", _ "wstr", $sUrl, _ ; PWSTR pszUrl - A pointer to a null-terminated string with the URL "wstr", "decodedUrl", _ ; PWSTR pszUnescaped - A pointer to a buffer that will receive a null-terminated string that contains the unescaped version of pszURL "dword*", 1024, _ ; DWORD *pcchUnescaped - The number of characters in the buffer pointed to by pszUnescaped "dword", $dFlags) ; DWORD dwFlags If @error Then ConsoleWrite('UrlUnescape error: ' & @error & ', LastErr: ' & _WinAPI_GetLastError() & ', LastMsg: ' & _WinAPI_GetLastErrorMessage() & @CRLF) Return SetError(@error, @extended, 0) EndIf If IsArray($aUrlUnescape) Then For $iIndex = 0 To UBound($aUrlUnescape) - 1 ConsoleWrite(' $aUrlUnescape[' & $iIndex & ']: ' & VarGetType($aUrlUnescape[$iIndex]) & ' - ' & $aUrlUnescape[$iIndex] & @CRLF) Next EndIf Return $aUrlUnescape[2] EndFunc ;==>_WinAPI_UrlUnescape Edit: Note that there is nothing special about this line: "wstr", "decodedUrl", the "decodedUrl" can be anything, really, even just 0 works.
    1 point
  11. This will be fine if you run CMD with reduced privileges, but try to start CMD with Admin privileges .
    1 point
  12. I used _BmpSearch quite often. And I made some changes to improve usability: now it is not a UDF, but a function now the function accepts not only gdi32 hBitmap, but also GDI+ hImage or simply path to image file now there is no problem with the alpha channel now you can search for a 1x1 pixel image and get array of pixels now the search time is returned to the $aCoords[0][1] in milliseconds added error checking #include <GDIPlus.au3> #pragma compile(x64, false) ; #FUNCTION# ==================================================================================================================== ; Name : _BmpSearchEx ; Description : Searches for Bitmap in a Bitmap ; Syntax : _BmpSearchEx($vPic1, $vPic2, $iMax = 5000) ; Parameters : $vPic1 - Handle to bitmap (gdi32 or GDI+) to search or path to image file ; : $vPic2 - Handle to bitmap (gdi32 or GDI+) to find or path to image file ; : $iMax - Max matches to find ; Return values : Success: Returns a 2d array with the following format: ; : $aCoords[0][0] = Total matches found (0 if not found) ; : $aCoords[0][1] = Time of search in ms ; : $aCoords[$i][0] = Width of bitmap ; : $aCoords[$i][1] = Height of bitmap ; : $aCoords[$i][2] = X coordinate ; : $aCoords[$i][3] = Y coordinate ; : Failure: Returns 0 and sets @error: ; : @error = 1 - file $vPic1 not found ; : @error = 2 - file $vPic2 not found ; : @error = 3 - $vPic1 is not a bitmap ; : @error = 4 - $vPic2 is not a bitmap ; : @error = 5 - error decode opcode ; Author : Brian J Christy (Beege) ; Modified : InnI ; =============================================================================================================================== Func _BmpSearchEx($vPic1, $vPic2, $iMax = 5000) If $iMax < 1 Then $iMax = 5000 Local $hImg1, $hImg2, $iErr1, $iErr2, $iTime = TimerInit() _GDIPlus_Startup() If IsString($vPic1) Then If Not FileExists($vPic1) Then Return SetError(1, _GDIPlus_Shutdown(), 0) $hImg1 = _GDIPlus_BitmapCreateFromFile($vPic1) Else $hImg1 = _GDIPlus_BitmapCreateFromHBITMAP($vPic1) $iErr1 = @error EndIf If IsString($vPic2) Then If Not FileExists($vPic2) Then Return SetError(2, _GDIPlus_Shutdown(), 0) $hImg2 = _GDIPlus_BitmapCreateFromFile($vPic2) Else $hImg2 = _GDIPlus_BitmapCreateFromHBITMAP($vPic2) $iErr2 = @error EndIf $hSource = ($iErr1) ? _GDIPlus_BitmapCreateHBITMAPFromBitmap($vPic1) : _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg1) If Not $iErr1 Then _GDIPlus_BitmapDispose($hImg1) $hFind = ($iErr2) ? _GDIPlus_BitmapCreateHBITMAPFromBitmap($vPic2) : _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg2) If Not $iErr2 Then _GDIPlus_BitmapDispose($hImg2) _GDIPlus_Shutdown() Static Local $aMemBuff, $tMem, $fStartup = True If $fStartup Then ;####### (BinaryStrLen = 490) #### (Base64StrLen = 328 )##################################################################### Local $Opcode = 'yBAAAFCNRfyJRfSNRfiJRfBYx0X8AAAAAItVDP8yj0X4i10Ii0UYKdiZuQQAAAD38YnBi0X4OQN0CoPDBOL36akAAACDfSgAdB1TA10oO10YD4OVAAAAi1UkORN1A1vrBluDwwTrvVOLVSyLRTADGjtdGHd3iwg5C3UhA1oEi0gEO10Yd2Y5C3USA1oIi0gIO10Yc1c5' & _ 'C3UDW+sGW4PDBOuCi1UUid6LfQyLTRCJ2AHIO0UYczfzp4P5AHcLSoP6AHQNA3Uc6+KDwwTpVP///4tFIIkYg0UgBIPDBP9F/ItVNDlV/HQG6Tj///9bi0X8ycIwAA==' Local $aDecode = DllCall("Crypt32.dll", "bool", "CryptStringToBinary", "str", $Opcode, "dword", 0, "dword", 1, "struct*", DllStructCreate("byte[254]"), "dword*", 254, "ptr", 0, "ptr", 0) If @error Or (Not $aDecode[0]) Then Return SetError(5, 0, 0) $Opcode = BinaryMid(DllStructGetData($aDecode[4], 1), 1, $aDecode[5]) $aMemBuff = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", BinaryLen($Opcode), "dword", 4096, "dword", 64) $tMem = DllStructCreate('byte[' & BinaryLen($Opcode) & ']', $aMemBuff[0]) DllStructSetData($tMem, 1, $Opcode) ;############################################################################################################################ $fStartup = False EndIf Local $tSizeSource = _WinAPI_GetBitmapDimension($hSource) If @error Then Return SetError(3, 0, 0) Local $tSizeFind = _WinAPI_GetBitmapDimension($hFind) If @error Then Return SetError(4, 0, 0) Local $iRowInc = ($tSizeSource.X - $tSizeFind.X) * 4 Local $tSource = DllStructCreate('dword[' & ($tSizeSource.X * $tSizeSource.Y) & ']') _WinAPI_GetBitmapBits($hSource, DllStructGetSize($tSource), DllStructGetPtr($tSource)) Local $tFind = DllStructCreate('dword[' & ($tSizeFind.X * $tSizeFind.Y) & ']') _WinAPI_GetBitmapBits($hFind, DllStructGetSize($tFind), DllStructGetPtr($tFind)) _WinAPI_DeleteObject($hSource) _WinAPI_DeleteObject($hFind) ;####### (BinaryStrLen = 106) ################################################################################################# Static Local $Opcode_ = '0xC80000008B5D0C8B1383C3048B4D103913750C83C304E2F7B800000000EB118B5508FF338F028B451029C883C002EB00C9C20C00' Static Local $aMemBuff_ = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", BinaryLen($Opcode_), "dword", 4096, "dword", 64) Static Local $tMem_ = DllStructCreate('byte[' & BinaryLen($Opcode_) & ']', $aMemBuff_[0]) DllStructSetData($tMem_, 1, $Opcode_) ;############################################################################################################################## Local $iFirstDiffIdx, $iFirstDiffPix, $aFirstDiffCoords[2], $iMaxLoops = (DllStructGetSize($tFind) / 4) - 1 If $iMaxLoops Then Local $aFD = DllCallAddress('dword', DllStructGetPtr($tMem_), 'dword*', 0, 'struct*', $tFind, 'dword', $iMaxLoops) $iFirstDiffIdx = $aFD[0] $iFirstDiffPix = $aFD[1] Else $iFirstDiffIdx = 1 $iFirstDiffPix = DllStructGetData($tFind, 1, 1) EndIf $aFirstDiffCoords[1] = Int(($iFirstDiffIdx - 1) / $tSizeFind.X) $aFirstDiffCoords[0] = ($iFirstDiffIdx - 1) - ($aFirstDiffCoords[1] * $tSizeFind.X) Local $iFirst_Diff_Inc = (($aFirstDiffCoords[1] * $tSizeSource.X) + $aFirstDiffCoords[0]) * 4 If $iFirst_Diff_Inc < 0 Then $iFirst_Diff_Inc = 0 Local $tCornerPixs = DllStructCreate('dword[3]') DllStructSetData($tCornerPixs, 1, DllStructGetData($tFind, 1, $tSizeFind.X), 1) DllStructSetData($tCornerPixs, 1, DllStructGetData($tFind, 1, $tSizeFind.X * ($tSizeFind.Y - 1) + 1), 2) DllStructSetData($tCornerPixs, 1, DllStructGetData($tFind, 1, $tSizeFind.X * $tSizeFind.Y), 3) Local $tCornerInc = DllStructCreate('dword[3]') DllStructSetData($tCornerInc, 1, ($tSizeFind.X - 1) * 4, 1) DllStructSetData($tCornerInc, 1, (($tSizeSource.X - $tSizeFind.X) + $tSizeSource.X * ($tSizeFind.Y - 2) + 1) * 4, 2) DllStructSetData($tCornerInc, 1, ($tSizeFind.X - 1) * 4, 3) Local $pStart = DllStructGetPtr($tSource) Local $iEndAddress = Int($pStart + DllStructGetSize($tSource)) Local $tFound = DllStructCreate('dword[' & $iMax & ']') Local $ret = DllCallAddress('dword', DllStructGetPtr($tMem), 'struct*', $tSource, 'struct*', $tFind, _ 'dword', $tSizeFind.X, 'dword', $tSizeFind.Y, _ 'dword', $iEndAddress, 'dword', $iRowInc, 'struct*', $tFound, _ 'dword', $iFirstDiffPix, 'dword', $iFirst_Diff_Inc, _ 'struct*', $tCornerInc, 'struct*', $tCornerPixs, _ 'dword', $iMax) Local $aCoords[$ret[0] + 1][4] = [[$ret[0], Round(TimerDiff($iTime))]] If Not $ret[0] Then Return SetError(0, 0, $aCoords) For $i = 1 To $ret[0] $iFoundIndex = ((DllStructGetData($tFound, 1, $i) - $pStart) / 4) + 1 $aCoords[$i][3] = Int(($iFoundIndex - 1) / $tSizeSource.X) $aCoords[$i][2] = ($iFoundIndex - 1) - ($aCoords[$i][3] * $tSizeSource.X) $aCoords[$i][0] = $tSizeFind.X $aCoords[$i][1] = $tSizeFind.Y Next $aCoords[0][1] = Round(TimerDiff($iTime)) Return SetError(0, 0, $aCoords) EndFunc ;==>_BmpSearchEx
    1 point
  13. shaggy98, I use this function to write to RichEdit controls as it allows you to adjust the font size and attributes as well as the colour - here we leave the size and attributes as default and only adjust the colour: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> $hGui = GUICreate("RichEdit Test", 320, 350) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState() Sleep(1000) ; Write in black _GUICtrlRichEdit_WriteLine($hRichEdit, "I am in BLACK" & @CRLF, Default, Default, 0x000000) Sleep(2000) ; Write in red _GUICtrlRichEdit_WriteLine($hRichEdit, "I am in RED" & @CRLF, Default, Default, 0xFF0000) Sleep(2000) ; And back to black _GUICtrlRichEdit_WriteLine($hRichEdit, "I am back in BLACK" & @CRLF, Default, Default, 0x000000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Exit EndSwitch WEnd Func _GUICtrlRichEdit_WriteLine($hWnd, $sText, $iIncrement = 0, $sAttrib = "", $iColor = -1) ; Count the @CRLFs StringReplace(_GUICtrlRichEdit_GetText($hWnd, True), @CRLF, "") Local $iLines = @extended ; Adjust the text char count to account for the @CRLFs Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hWnd, True, True) - $iLines ; Add new text _GUICtrlRichEdit_AppendText($hWnd, $sText & @CRLF) ; Select text between old and new end points _GuiCtrlRichEdit_SetSel($hWnd, $iEndPoint, -1) ; Convert colour from RGB to BGR $iColor = Hex($iColor, 6) $iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2) ; Set colour If $iColor <> -1 Then _GuiCtrlRichEdit_SetCharColor($hWnd, $iColor) ; Set size If $iIncrement <> 0 Then _GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement) ; Set weight If $sAttrib <> "" Then _GUICtrlRichEdit_SetCharAttributes($hWnd, $sAttrib) ; Clear selection _GUICtrlRichEdit_Deselect($hWnd) EndFuncPlease ask if you have any further questions. M23
    1 point
×
×
  • Create New...