Jump to content

texan

Active Members
  • Posts

    55
  • Joined

  • Last visited

texan's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. I have an autoit script that I complied as an EXE and I call it from another software application. Is there any way to get the autoit script to return a string value instead of a number?
  2. Is this what you mean by using backbuffer technique? It seems to work, is there anything I am leaving out? #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Global $BaseFilePath, $GUI, $h, $w, $Base, $MaskFilePath, $Mask, $hwndGraphic, $backbuffer, $bitmap Opt("GUIOnEventMode", 1) ; Change to OnEvent mode OnAutoItExitRegister("OnExit") _GDIPlus_Startup() $BaseFilePath = "S:\AutoIt\ImageFailure\med.base.png" $MaskFilePath = "S:\AutoIt\ImageFailure\med.mask.png" $Base = _GDIPlus_ImageLoadFromFile($BaseFilePath) $Mask = _GDIPlus_ImageLoadFromFile($MaskFilePath) $h = _GDIPlus_ImageGetHeight($Base) $w = _GDIPlus_ImageGetWidth($Base) $WhiteBrush = _GDIPlus_BrushCreateSolid(0xffffffff) ;Create the Window based on the size of the Baseline file $GUI = GUICreate("Test",$w,$h,-1,-1,-1,$WS_EX_APPWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetOnEvent($GUI_EVENT_RESTORE, "Repaint") $hwndGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI) ;Create a Graphics object from a Window Handle $bitmap = _GDIPlus_BitmapCreateFromGraphics($w,$h,$hwndGraphic) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) GUISetState() Repaint() GUIRegisterMsg($WM_PAINT, "WM_PAINT") While 1 Sleep(100) WEnd Func Repaint() ;~ _GDIPlus_GraphicsDrawImageRect($hwndGraphic, $Base, 0, 0, $w, $h) _GDIPlus_GraphicsFillRect($BackBuffer, 0, 0, $w, $h, $WhiteBrush) ;clear the left side _GDIPlus_GraphicsDrawImageRect($BackBuffer, $Base, 0, 0, $w, $h) _GDIPlus_GraphicsDrawImageRect($BackBuffer, $Mask, 0, 0, $w, $h) _GDIPlus_GraphicsDrawImageRect($hwndGraphic, $bitmap, 0, 0, $w, $h) EndFunc Func WM_PAINT() Repaint() Return "GUI_RUNDEFMSG" EndFunc Func OnExit() GUIRegisterMsg($WM_PAINT, "") _GDIPlus_ImageDispose($Base) _GDIPlus_GraphicsDispose($hwndGraphic) _GDIPlus_Shutdown() GUIDelete() Exit EndFunc
  3. One followup question. I used UEZ option #1 and applied it to my larger script. In my larger script I actually have multiple Rect drawn on top of each other using _GDIPlus_GraphicsDrawImageRect. Each of these RECT are built from different PNG images and each of the PNG images have transparent areas so that the images can display on top of each other. The problem I have now is that the screen flickers when it calls the Repaint function because the Repaint function actually makes multiple calls to _GDIPlus_GraphicsDrawImageRect. Is there any way to avoid this? I was wondering if there might be a way to combine these mulitple PNG images into one Graphic before making a single call to _GDIPlus_GraphicsDrawImageRect? I assume this would stop the flickering affect.
  4. UEZ, both of those work, thanks! Now I need to see how to implement it on my actual larger script that has multiple images.
  5. I am creating a GUi that displays an image from a PNG file. I am using _GDIPlus_GraphicsDrawImageRect to display the image and this works fine. The problem I am having is that the image disappears if you minimize the window then restore it. It also disappears if you drag the window off screen and then back. The code below demonstrates my issue. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Global $BaseFilePath, $GUI, $h, $w Opt("GUIOnEventMode", 1) ; Change to OnEvent mode OnAutoItExitRegister("OnExit") _GDIPlus_Startup() $BaseFilePath = "S:\AutoIt\ImageFailure\med.base.png" $Base = _GDIPlus_ImageLoadFromFile($BaseFilePath) $h = _GDIPlus_ImageGetHeight($Base) $w = _GDIPlus_ImageGetWidth($Base) ;Create the Window based on the size of the Baseline file $GUI = GUICreate("Test",$w,$h,-1,-1,-1,$WS_EX_APPWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitScript") $hwndGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI) ;Create a Graphics object from a Window Handle GUISetState() _GDIPlus_GraphicsDrawImageRect($hwndGraphic, $Base, 0, 0, $w, $h) While 1 Sleep(100) WEnd Func OnExitScript() Exit EndFunc Func OnExit() _GDIPlus_ImageDispose($Base) _GDIPlus_GraphicsDispose($hwndGraphic) _GDIPlus_Shutdown() EndFunc
  6. Did you ever figure this out? I have a similar issue. Noticed it only occurs when using a basic theme in Windows 7 but works fine when using one of the Aero themes.
  7. Ugggg!!! finally figured it out. You can NOT perform GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitScript") BEFORE you create the GUI. Moved that line below GUICreate and it worked. Damn I spent forever trying to figure that out!!!
  8. #include <GuiConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode OnAutoItExitRegister("OnExit") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitScript") GUICreate("This is a test", 500, 500) $ExitButton = GUICtrlCreateButton("Exit", 400, 400, 80, 24) GUICtrlSetOnEvent($ExitButton, "OnExitScript") GuiSetState() While 1 Sleep(1000) WEnd ;End of main script ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Func OnExitScript() MsgBox(1,"test", "OnExitScript") Exit EndFunc Func OnExit() MsgBox(1,"test", "OnExit") EndFunc My GUI window will not close when I click the X in the top right of the window or when I try using Alt+F4. I have stripped this code down to the bare minimum for my example but the above code shows a window with a single Exit button. The button works but not the X in top right. I give up, what obvious simple thing am I overlooking?
  9. I have a script that I use for downloading dozens of reports from our company internal website. The script uses IELinkGetCollection function to find all the links to the reports that I want to download. The links would be in the format "http://ourwebsite.com/reports/mydownloadfile.rtf". I then use the InetGet function to actually download all the reports. This all worked great until this weekend. They made a change to the code so the links on the website are now Javascript references. Is there anyway to determine the actual link reference associated with the Javascript code so I can continue to use this script I created? I don't want to simulate the "click" event on the links because they would open the file and be a lot more complicated.
  10. The data is in Excel and I use _ExcelReadSheetToArray to put it in an Array. The rest of my AutoIt program works with the Array.
  11. I also wonder if using an Excel file is the best option for what I am doing. I am only using Excel because that is the format the data came to me. The data in the Excel file is not going to change regularly. I will probably get an update to the data once every year at which time I would plan to send out a new version of my AutoIt .exe file. The end users are not all on the same LAN so I can't just place the Excel file there. The data in the Excel file is not that big, maybe a few thousand lines. I just read it into an array and use it from there. Is there some other way to include this data other than compiling the Excel file with the AutoIt program?
  12. FileInstall() does accomplish what I need. I am wondering if there is "best pratices" for using FileInstall(). I currently have it coded as this: FileInstall("MyExcelFile.xlsx", @TempDir & "MyExcelFile.xlsx", 1) Any reason this would not work? Many of the end users might not have access to their C: on the PCs. Would @TempDir still work even if they don't have C: drive access?
  13. Let's say I have a 2 dimensional array that contains 3 columns and thousands of rows. The three columns contain data for STATE, COUNTY and CITY and all the rows are every combination of this data in the US. I am looking for some method of returning a new array that contains all the data that matches some subset of the main array. For instance, I want all the cities in NY so I would want the new array to countain all the rows where the STATE is equal to "NY". I could easily right SQL to do this on a table but I am not seeing any easy method in Autoit. Any suggestions? I have been looking at various _Array* functions but none seem to do this. _ArrayUnique is close.
  14. I have a script that reads various Excel files for input data. The end user will need to select which Excel file to use for input. I was hoping to give each user a single EXE file for the script and not have to include sending them the Excel files. One EXE would be easier to distribute plus I don't really want the user having the ability to mess with the data conained in the Excel files. I was wondering if there was some way to created a "compiled" version of my script that is a single .EXE file but somehow contains these Excel files for input?
  15. Never mind, I had my head my my a**. There is a form element on the website. The spy tool I was using did not display some information correctly and that confused me. Once I properly used the _IEFormElementSetValue everything worked just fine. Its amazing how you can waste an hour researching the simplest thing in the world. Of course, 2 minutes after posting on here you figure it out on your own.
×
×
  • Create New...