Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/24/2018 in all areas

  1. Gianni

    Recursively on a site?

    given that using inprudently recursive functions can cause ramifications out of control, here a simple example of a recursive approach #include <array.au3> #include <ie.au3> Global $sStartingUrl = "https://alpari.com/" Global $oIE = _IECreate() Global $aVisited[] = [''] _GoToURL_rec($sStartingUrl) MsgBox(0, "Debug", "Done.") _IEQuit($oIE) Exit ; WARNING: recursive function Func _GoToURL_rec($sUrl) If _ArraySearch($aVisited, $sUrl) = -1 Then ; url not already visited _ArrayAdd($aVisited, $sUrl) ; mark as already visited _IENavigate($oIE, $sUrl) Local $oUrls = _IETagNameGetCollection($oIE, "A") If @extended Then ; MsgBox(0, "debug @extended", @extended & "links found") For $ohyperlink In $oUrls $sHref = $ohyperlink.href ; do not remove the following check or you'll lose on the web If StringLeft($sHref, 18) = "https://alpari.com" Then ; stay in the same domain only ; furter checking on url here If Not StringInStr($sHref, "#") Then ; do not open link on same page If Not StringInStr($sHref, ".pdf") Then ; do not open pdf ; ..... add more checks if needed _GoToURL_rec($sHref) ; ---> recursion EndIf EndIf EndIf Next EndIf EndIf Return EndFunc ;==>_GoToURL_rec
    2 points
  2. Deye

    Convert jpg to bmp? Modern?

    Hi Strydr, maybe there are much simpler or a cleaner way of doing it but this is what i have tried that seems to work you can try testing it on from here to suite your needs $sFilename = "" _GDIPlus_Startup() $hBitmap = _GDIPlus_BitmapCreateFromFile($sFilename) $iWidth = _GDIPlus_ImageGetWidth($hBitmap) $iHeight = _GDIPlus_ImageGetHeight($hBitmap) $hBitmap_Resized = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) $hBMP_Ctxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_Resized) _GDIPlus_GraphicsSetInterpolationMode($hBMP_Ctxt, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsDrawImageRect($hBMP_Ctxt, $hBitmap, 0, 0, $iWidth, $iHeight) $hHBitmap = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap_Resized) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iWidth, $iHeight, $GDIP_PXF24RGB) ; Save bitmap to file _GDIPlus_ImageSaveToFile($hClone, @ScriptDir & "\GDIPlus_Image.bmp") _GDIPlus_ImageDispose($hClone) _GDIPlus_ImageDispose($hImage) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_BitmapDispose($hBitmap_Resized) _GDIPlus_GraphicsDispose($hBMP_Ctxt) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_Shutdown() Deye
    2 points
  3. My first question would be why? Whats the problem if its accessible in mainscript But a solution could be use autoitobject internal. And make an object with same name as your udf and then use udf.varname See examples thread for the udf. alternative Read isdeclared function and assign function and use in udf variables declared thru assign without a $prefix.
    2 points
  4. water

    OutlookEX

    Version 1.7.0.1

    10,054 downloads

    Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None
    1 point
  5. I've been testing the subclassing technique in recent months and have used ComboBox examples for tests. Here is one of the examples. More examples will be added over the coming weeks. All examples are small and simple. However, all of them are based on the subclassing technique. It's the interesting aspect of the examples. Some are implemented with complete UDFs. Others are made as code examples only. First post becomes a list of examples as well as the first example. ComboBox Examples Color Combo (just below) Checkbox Combo Checkbox Combo slightly modified ListView Combo Other Control Examples Tabs and subtabs on demand My first script in the Examples forum. Well. You have to start somewhere. Windows Explorer address bar Colors and fonts in TreeViews Implementing Virtual TreeViews Hot-Track Enabled Toolbar Menu Simulating a modeless Choose Color Dialog Color Combo The first example is about color selection. It's an owner drawn ComboBox created with the $CBS_OWNERDRAWVARIABLE style so that colors can be displayed directly in the ComboBox by responding to $WM_DRAWITEM messages. There are already many of these examples, but none are implemented through the subclassing technique. The big advantage of subclassing is that a user of the UDF still can use his own $WM_DRAWITEM message handler through GUIRegisterMsg. The same Windows message can be used in both techniques without any conflicts. This is an example with a single ComboBox: #include <GUIConstantsEx.au3> #include "..\Includes\ComboColors.au3" Example() Func Example() ; Create GUI GUICreate( "1 ComboBox", 220, 264 ) ; Create ComboBox for color selection GUICtrlCreateLabel( "Named colors:", 10, 10, 200, 16 ) Local $aInfo = ComboColors_Create( "Tomato", 10, 26, 200, 26, 10, "Colors\NamedColors.txt", 9 ) ; $aInfo = [ $idComboBox, $aColors, $oColors, $sColors, $iColors ] ; $aColors = [ "Color name", 0xBackColor, 0xTextColor, 0xBrush ] ; $oColors dict obj: Key = "Color name", Val = index in $aColors ; $sColors = "Color0|Color1|Color2|..." ; $iColors = Number of colors ; Show GUI GUISetState() ; Message loop While 1 Switch GUIGetMsg() Case $aInfo[0] Local $sColor = GUICtrlRead( $aInfo[0] ) Local $iIndex = $aInfo[2]($sColor) ConsoleWrite( "Color = " & $sColor & @CRLF & _ "Index = " & $iIndex & @CRLF & _ "Back = 0x" & Hex( ($aInfo[1])[$iIndex][1], 6 ) & @CRLF & _ "Fore = 0x" & Hex( ($aInfo[1])[$iIndex][2], 6 ) & @CRLF & _ "Brush = " & ($aInfo[1])[$iIndex][3] & @CRLF & @CRLF ) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup GUIDelete() EndFunc Two different sources can be used to specify colors: An array and a text file. It's demonstrated in examples. ComboColors_Create() is defined this way: ; Create ComboBox for color selection ; ; Error code in @error Return value ; 1 => Invalid color info file/array Success => [ $idComboBox, $aColors, $oColors, $sColors, $iColors ] ; 2 => Error creating ComboBox Failure => 0 ; 3 => Too many ComboBoxes ; Func ComboColors_Create( _ $sColorInit, _ ; Initial ComboBox color $x, $y, $w, $h, _ ; Left, top, width, height $iListRows, _ ; Rows in drop-down ListBox $vColorInfo, _ ; File/array with color info $iFirstRow = 0 ) ; First row with color info There is also a ComboColors_Delete() function. This is a picture of an example with two ComboBoxes: The example above and this example is included in zip-file. Zip-file You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. ColorSelection.7z
    1 point
  6. @nooneclose it would help immensely if you post an actual file, rather than pictures (redacting your company data of course). Otherwise we have to spend a lot of time recreating your spreadsheet.
    1 point
  7. @Blois Happy to have helped
    1 point
  8. UEZ

    Convert jpg to bmp? Modern?

    #include <GDIPlus.au3> _GDIPlus_Startup() Global Const $hImage_JPG = _GDIPlus_ImageLoadFromFile("MyJPG.jpg") _GDIPlus_ImageSaveToFile($hImage_JPG, "MyBitmap.bmp") _GDIPlus_ImageDispose($hImage_JPG) _GDIPlus_Shutdown() @Deye you can use the built-in function to resize the image -> _GDIPlus_ImageResize(), _GDIPlus_ImageScale()
    1 point
  9. water

    Recursively on a site?

    Then it becomes quite complex as you have to analyze every page. But why would you want to open all pages of a site?
    1 point
  10. Search for findbmp in examples. Still works and full modifiable au3 source.
    1 point
  11. What about this? ImageSearch DLL Call - No Include.rar
    1 point
  12. Post your full script, and the images you're looking for.
    1 point
  13. careca

    AutoCompleter

    Here's my take on an auto completer, work in progress so don't be too harsh with me. The idea is that after a spacebar press, it learns the word that was previously written, and the next time you write, it gets a list of all words that fit into what you're writing, so if the user writes "com", a word that may appear is "complex", that is, if the user has written it anytime in the past. A popup will show up whenever the user writes with the list of words, the way to select one of the words from the list is to scroll with the mouse wheel, and middle click. The popup timeout is 2.5 secs. Best regards. PS for the next step would be nice to save words as they are, for example emails, as it is it doesn't get @ for example. Completer 1.0.exe AComp.ico Completer 1.0.au3
    1 point
  14. mLipok

    Autoit and High CPU usage

    if you do not using: #AutoIt3Wrapper_Change2CUI=y then AutoIt always create GUI see in AutoItWinSetTitle Beta HelpFile #include <GUIConstantsEx.au3> Example() Func Example() ; Set the title of of the AutoIt Hidden Window. AutoItWinSetTitle("My AutoIt Window") ; Display AutoIt's Hidden Window. AutoItWinShow() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example ; Display AutoIt"s Hidden Window. Returns the handle of the window. Func AutoItWinShow() Local $hWnd = WinGetHandle(AutoItWinGetTitle()) ; Get the handle of the AutoIt Hidden Window by finding out the title of the AutoIt Hidden Window. WinMove($hWnd, "", (@DesktopWidth / 2) - 250, (@DesktopHeight / 2) - 250, 500, 500) ; Move the AutoIt Hidden Window and re-size for a better view. WinSetState($hWnd, "", @SW_SHOW) ; Show the AutoIt Hidden Window, normally this is hidden, but in the interest of this example I"m displaying it. Return $hWnd EndFunc ;==>AutoItWinShow So there is a GUI, but mostly about him does not remember. At least, I think that about this. If anyone has other thoughts, then I be happy to take them.
    1 point
×
×
  • Create New...