Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/03/2024 in all areas

  1. Hi @argumentum, I had an idea I’ve been working on for a while for the CHM. I almost gave it up because I kept coming across problems, but I finally got a working example to share, thanks to many web searches . This is probably more than the Devs would ever want to add, plus it would be probably for the CHM only? Not sure. But thought it would be worth passing on to you, maybe spark some ideas. One of the main problems I ran into is that the CHM doesn’t accept local storage, session storage, or cookies, so I had no way of storing any settings between pages. But in looking at another program’s help file I had seen, that offered a light/dark them switcher, I found that to save settings between pages, they were using the window.name property, which solved my problem. For this example I converted your three CSS’s (light, dark and buuf (which I called custom)). My modifications add a selector in the top right corner of every page, allowing you to change CSS styles actively. I currently have it set to refresh the page, but without a refresh works too, except some edging wasn’t being updated correctly until scrolling the page. With that said, there are some hang ups, namely: As I mentioned, this would probably be CHM only mod. The selector isn’t completely stylable. To style it more, it sounds like you would need to make a custom one using JS and CSS, using some coding/ settings which isn’t (I think) compatible with the CHM. More coding, and adds a new class. Loses CSS theme setting upon closing the CHM file, could get annoying. One other possibility, I think, would be the ability for the selector to be dynamically filled with CSS options found in the folder. But perhaps that would cause lag, and, of course much more code. Anyway, here it is. Thought you might be interested in it. Just open the chm file by double clicking, (at least that works for me?). I’m also including the htm files so you can see what I did. AutoIt CHM W Selector.zip
    2 points
  2. Hello guys. I just did another OCR wrapper for this nice library. What's AU3-RapidOCR? RapidOCR UDF is a simple wrapper for RapidOCR library. Features. Get Text From Image File. Easy to use. Usage: #include "RapidOCR.au3" _Example() Func _Example() MsgBox(0, "", _RapidOCR_ImageToText(@ScriptDir & "\images\Image1.png")) EndFunc Check RapidOCR UDF on GitHub. Saludos
    1 point
  3. Yep, one of those moments where I forgot that \u or \l doesn't work with our PCRE engine 😞. So I *slap-sticked* some code together to achieve what I needed on the fly. This is truly ugly IMO, but if you're not doing a lot of string manipulation concatenations it's ok. I know I wrote some pcre funcs in a dll back in the day for my personal use to be able to do some things like this, but of course I can't find it... So native it is. Anyway, I added this to my personal chars au3, thus the name you'll see. Please test and criticize away, like I said, it was a quick mod and it's A-L-O-T of regex this and regex that ... but maybe it's useful for someone. #include <StringConstants.au3> #include <Array.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AutChars_RegExpReplaceEx ; Description ...: Allows StringRegExpReplace replace with pattern to do upper/lower ; Syntax ........: _AutChars_RegExpReplaceEx($sData, $sRegEx, $sReplace[, $iCount = 0]) ; Parameters ....: $sData - The string to check ; $sRegEx - The regular expression to compare. See StringRegExp for pattern definition characters. ; $sReplace - The text to replace the regular expression matching text with ; $iCount - Number of replacements. Default is 0 for global replacement ; Return values .: Success - an updated string based on regular expressions ; @extended = number of replacements performed ; Author ........: SmOke_N (Ron Nielsen.. Ron.SMACKThatApp@GMail.com) ; Modified ......: ; Related .......: See StringRegExpReplace() ; Remarks .......: Will only work with \u or \l such as \u$2 in replace with pattern ; In my opinion, this is a pretty abusive way to achieve this, might be fine for small jobs ; but the overhead would be immense ; Example .......: _AutChars_RegExpReplaceEx("abcdAbcefg", "abc", "\u$0") will return ABCdAbcefg ; =============================================================================================================================== Func _AutChars_RegExpReplaceEx($sData, $sRegEx, $sReplace, $iCount = 0) ; work in progress Local Const $iGlobalMatch = $STR_REGEXPARRAYGLOBALMATCH Local $sRet = "" Local Const $sMatchRE = "[\\$](?:u|l)[\$\\]{?\d+\}?" If Not StringRegExp($sReplace, $sMatchRE) Then $sRet = StringRegExpReplace($sData, $sRegEx, $sReplace, $iCount) Return SetError(@error, @extended, $sRet) EndIf ; unique identifier Local $sUStart = "<" & Chr(1) & "@U@" & Chr(1) & ">" Local $sUEnd = "</" & Chr(1) & "@U@" & Chr(1) & ">" Local $sLStart = "<" & Chr(1) & "@L@" & Chr(1) & ">" Local $sLEnd = "</" & Chr(1) & "@L@" & Chr(1) & ">" ; modify replace string Local $sTmp = $sReplace $sTmp = StringRegExpReplace($sTmp, "(?i)([\\$]u)([\$\\]{?\d+\}?)", $sUStart & "$2" & $sUEnd) $sTmp = StringRegExpReplace($sTmp, "(?i)([\\$]l)([\$\\]{?\d+\}?)", $sLStart & "$2" & $sLEnd) Local $sRepStr = StringRegExpReplace($sData, $sRegEx, $sTmp, $iCount) Local $iExtended = @extended ; get upper and lower matches with unique identifier Local $aMatchUpper = StringRegExp($sRepStr, "(\Q" & $sUStart & "\E.*?\Q" & $sUEnd & "\E)", $iGlobalMatch) Local $aMatchLower = StringRegExp($sRepStr, "(\Q" & $sLStart & "\E.*?\Q" & $sLEnd & "\E)", $iGlobalMatch) ; no need to worry about case Local $aMUpUnique, $aMLrUnique If IsArray($aMatchUpper) Then $aMUpUnique = _ArrayUnique($aMatchUpper, 0, 0, 0, $ARRAYUNIQUE_NOCOUNT) EndIf If IsArray($aMatchLower) Then $aMLrUnique = _ArrayUnique($aMatchLower, 0, 0, 0, $ARRAYUNIQUE_NOCOUNT) EndIf $sRet = $sRepStr Local $sMatch For $i = 0 To UBound($aMUpUnique) - 1 $sMatch = StringRegExpReplace($aMUpUnique[$i], "\Q" & $sUStart & "\E|\Q" & $sUEnd & "\E", "") $sRet = StringReplace($sRet, $aMUpUnique[$i], StringUpper($sMatch), $iCount) Next For $i = 0 To UBound($aMLrUnique) - 1 $sMatch = StringRegExpReplace($aMLrUnique[$i], "\Q" & $sLStart & "\E|\Q" & $sLEnd & "\E", "") $sRet = StringReplace($sRet, $aMLrUnique[$i], StringLower($sMatch), $iCount) Next Return SetExtended($iExtended, $sRet) EndFunc
    1 point
  4. Thank you @SmOke_N, this is really helpful and I will definitely give it a try, making tests and enjoy it 😅 . Best regards Sven
    1 point
  5. Looks great! There is a "@Import" setting, but not sure on the details. Will think on it. Maybe some form of possibilities. Don't have time to look right now. Maybe later/ another day.
    1 point
  6. Yeap. And, since most installs are in and "Admin folder", writing down to a file the last selection is impossible (unless you find a way to write to %LOCALAPPDATA%) Hmmm, is going to be a hard no. The idea is enticing but it is not gonna fly. But hey, just having a chance to code ... is there a way to tell CSS to load another CSS from elsewhere ?, if so, we can make a script to change the CSS within ... somewhere .. thinking, ..anyway, if you can find that out
    1 point
  7. Well, this is what I did** and preparing for final product. I'm in a hurry right now, but I'll look at it tonight Edit: ** what I thought I did. Just broke it. Fixed it.
    1 point
  8. As indicated by Sven, you should be able to do this using _WD_Window. Take a look at the Rect option, which should allow you to restore the window.
    1 point
  9. Hi @MWIProd , I don't know exactly what you're trying to achieve, but with the au3WebDriver project (WebDriver), the _WD_Window() function let you maximize, minimize etc. the browser window. Could you describe your use case, then I am sure we could help you more precisely. Best regards Sven
    1 point
  10. This seems to work but you need libcairo-2.dll which can be found also on my OneDrive (x86 / x64 folders). ;Coded by UEZ build 2024-04-02 beta #AutoIt3Wrapper_UseX64=n #include "..\Cairo.au3" Cairo_Example() Func Cairo_Example() If Not Cairo_Init("libcairo-2.dll") Then ConsoleWrite(@error & @CRLF) Exit EndIf If FileExists("Example.pdf") Then FileDelete("Example.pdf") Local $MM_TO_PT = 72.0 / 25.4, $PAGE_WIDTH_A5 = 148, $PAGE_HEIGHT_A5 = 210, $PAGE_WIDTH_A4 = 210, $PAGE_HEIGHT_A4 = 297 Local Const $pSurface = Cairo_PDF_Create("Example.pdf", $PAGE_WIDTH_A5 * $MM_TO_PT, $PAGE_HEIGHT_A5 * $MM_TO_PT) Cairo_PDF_RestrictToVersion($pSurface, $CAIRO_PDF_VERSION_1_4) Local Const $pContext = Cairo_Context_Create($pSurface) Cairo_Context_SetLineWidth($pContext, 6) Cairo_Context_PathAddRectangle($pContext, 12, 12, 232,70) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArc($pContext, 64, 64, 40, 0, ACos(-1) * 2) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArcNegative($pContext, 192, 64, 40, 0, -ACos(-1) * 2) Cairo_Context_SetFillRule($pContext, $CAIRO_FILL_RULE_EVEN_ODD) Cairo_Context_SetSourceRGB($pContext, 0, 0.7, 0) Cairo_Context_FillPreserve($pContext) Cairo_Context_SetSourceRGB($pContext, 0, 0, 0) Cairo_Context_Stroke($pContext) Cairo_Context_Translate($pContext, 0, 128) Cairo_Context_PathAddRectangle($pContext, 12, 12, 232,70) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArc($pContext, 64, 64, 40, 0, ACos(-1) * 2) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArcNegative($pContext, 192, 64, 40, 0, -ACos(-1) * 2) Cairo_Context_SetFillRule($pContext, $CAIRO_FILL_RULE_WINDING) Cairo_SetColor($pContext, 0, 0, 0.9) Cairo_Context_FillPreserve($pContext) Cairo_SetColor($pContext, 0, 0, 0) Cairo_Context_Stroke($pContext) Cairo_Context_PathClear($pContext) Cairo_Context_PathAddMoveTo($pContext, 40, 150) Cairo_Font_SelectFace($pContext) Cairo_Font_SetSize($pContext, 30) Cairo_Context_PathAddText($pContext, "PDF Example") Cairo_SetColor($pContext, 0.9, 0, 0, 1) Cairo_Context_FillPreserve($pContext) Cairo_SetColor($pContext, 0, 0, 0.1, 0.5) Cairo_Context_SetLineWidth($pContext, 1.5) Cairo_Context_Stroke($pContext) Cairo_Surface_Finish($pSurface) Cairo_Surface_Flush($pSurface) ConsoleWrite(Cairo_Surface_GetStatus($pSurface) & @CRLF) Cairo_Context_Destroy($pContext) Cairo_Surface_Destroy($pSurface) Cairo_Close() ConsoleWrite(FileGetSize("Example.pdf") & @CRLF) EndFunc I seems that the Cairo.dll / Cairo64.dll doesn't work properly with PDF creation...
    1 point
×
×
  • Create New...