Bigger1338 Posted May 16, 2018 Posted May 16, 2018 Hello, I am new to the forum, but not entirely new to the tool. We use it a bit at my work to rotate browser tabs that have monitoring dashboards on them. But we are now using a CMS and some of the tabs are images we host on our network. I have the script I need working to a point, but what I need to do is resize a JPG that has an HTTP link, so that it fits any screen. When users upload their images to our CMS, they are not always sized the same, so as the tabs rotate, some images have large black boarders around them that are not part of the image. I could use some assistance getting the rest of the way if that's possible. Here's what I have so far. It makes the tabs full screen, but won't resize the "goals.jpg" tab. Thanks for any assistance. expandcollapse popup#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Opt("MustDeclareVars", 1) _GDIPlus_Startup() Global $iLoop = True, $title, $hImage, $hImage_new, $sCLSID, $hGraphics, $hBitmap_Scaled, $tData, $tParams, $pData, $pParams, $iJPEG_Quality = 10, $searchString $hImage = _GDIPlus_ImageLoadFromFile("http://ourcms.domain.com/sites/default/files/inline-images/goals.jpg") $hImage_new = _GDIPlus_ImageResize($hImage, 100, 80) ;resize image HotKeySet("{ESC}", "_ExitLoop") AutoItSetOption("WinTitleMatchMode", 2) $searchString = "" ; For $i = 1 to 100 WinActivate ("Chrome") Send("{F5}") ; This sends the F5 key to refresh the window. Send("^{TAB}") Sleep(25000) Opt("WinTitleMatchMode", 3) ; This is to tell the script to only refresh the EXACT window, incase there are similar windows. Such as: Window 1, Window 2. While 1 ; This begins a While LOOP Sleep(15000) ; Tell the script to pause for 5 seconds $title = WinGetTitle("Google - Mozilla Firefox", "") ; Grabs the exactly title and saves it to a variable to do an If statement against. If WinExists($title) Then ; Check to see if the desired window is running. Send("^{TAB}") WinSetState($searchString,"",@SW_MAXIMIZE) WinActivate($title) ; If it is running, first activate the window. WinWaitActive($title) ; This tells the script to not send the refresh key (F5) until the window has appeared. Send("{F5}") ; This sends the F5 key to refresh the window. _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled, 0, 0) ;display scaled image Else ; This is an else statement to tell the script to do a different operation if the window is not running. Sleep(10) ; Just a filler item to wait until the desired window is running. EndIf ; End the If statement to continue the script. WEnd $iLoop = False End While 1 Func _ExitLoop() $iLoop = False
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now