Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/26/2023 in all areas

  1. Danp2

    WebDriver + SingleFile

    FWIW, this appears to be the extension ID for FF, not Chrome. The correct one AFAICS is "mpiodijhokgodhhofbcjdecpffjipkle". Based upon what I found here, I would have thought that the following would trigger it. chrome.runtime.sendMessage('mpiodijhokgodhhofbcjdecpffjipkle', "save-page") Unfortunately, no such luck. No errors, but no saved file AFAICS.
    1 point
  2. Yes, the slash may be escaped in JSON. Unlike the backslash, however, this is not mandatory. That means "/" would be as valid in JSON as "\/" and would have the same result. I decided not to escape the slash, because I save one character and the readability is better. That was obvious, of course. My answer was also not really meant seriously. If it didn't come across that way, it's probably because of my English deficits or because of my nationality, which has a reputation - well, as they say here: having a stick up your ass. 🙃
    1 point
  3. Why only non-ASCII? If then already completely and also all ASCII characters escaped. So then you are really sure that the JSON produced in this way is no longer human-readable and also becomes significantly larger.
    1 point
  4. Welcome to the forum. Start here: https://www.autoitscript.com/wiki/WebDriver And after you do first step take a look here: and here: https://github.com/mlipok/Au3WebDriver-testing
    1 point
  5. This isn't guaranteed to access the desired window because some other controls / windows use this same class. Why not do it like this? $visibleTab = WinGetTitle( $Handle)
    1 point
  6. UEZ

    Resize & Rotate Image

    Sure: #include <Memory.au3> #include <ScreenCapture.au3> Example() Func Example() Local $hImage, $hImage2, $sCLSID, $tData, $tParams If FileExists(@ScriptDir & "\GDIPlus_Image2.jpg") Then FileDelete(@ScriptDir & "\GDIPlus_Image2.jpg") If FileExists(@ScriptDir & "\GDIPlus_Image.jpg") Then FileDelete(@ScriptDir & "\GDIPlus_Image.jpg") ; Capture screen _ScreenCapture_Capture(@ScriptDir & "\GDIPlus_Image.jpg") ; Initialize GDI+ library _GDIPlus_Startup() ; Load image $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\GDIPlus_Image.jpg") $hImage2 = _GDIPlus_ImageResize($hImage, @DesktopWidth / 8, @DesktopHeight / 8, 7) $hBitmap_Compressed = _GDIPlus_StreamImage2BinaryString($hImage2, "JPG", 100) ;converting back the memory bitmap to a JPG format _GDIPlus_BitmapDispose($hImage2) $hImage2 = _GDIPlus_BitmapCreateFromMemory($hBitmap_Compressed) ;load the JPG formatted image ; Get JPEG encoder CLSID $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") ; Set up parameters for 90 degree rotation $tData = DllStructCreate("int Data;") DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data")) ; Save image with rotation _GDIPlus_ImageSaveToFileEx($hImage2, @ScriptDir & "\GDIPlus_Image2.jpg", $sCLSID, DllStructGetPtr($tParams)) ; Shut down GDI+ library _GDIPlus_Shutdown() ShellExecute(@ScriptDir & "\GDIPlus_Image2.jpg") EndFunc ;==>Example Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "JPG", $iQuality = 80, $bSave = False, $sFilename = @ScriptDir & "\Converted.jpg") ;coded by UEZ 2013 build 2014-01-25 Local $sImgCLSID, $tGUID, $tParams, $tData Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) If $bSave Then Local $hFile = FileOpen($sFilename, 18) If @error Then Return SetError(6, 0, $bData) FileWrite($hFile, $bData) FileClose($hFile) EndIf Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString Br, UEZ
    1 point
  7. Melba23

    Quotes in quotes

    horne, From the Help file: Strings Strings are enclosed in double-quotes like "this". If you want a string to actually contain a double-quote use it twice like: "here is a ""double-quote"" - ok?" You can also use single-quotes like 'this' and 'here is a ' 'single-quote' ' - ok?' You can mix quote types to make for easier working and to avoid having to double-up your quotes to get what you want. For example if you want to use a lot of double-quotes in your strings then you should use single-quotes for declaring them: 'This "sentence" contains "lots" of "double-quotes" does it not?' is much simpler than: "This ""sentence"" contains ""lots"" of ""double-quotes"" does it not?" All clear? M23 Edit: 12k!
    1 point
×
×
  • Create New...