
BrokenThumb
Members-
Posts
11 -
Joined
-
Last visited
Everything posted by BrokenThumb
-
Problem getting a script to repeat itself
BrokenThumb replied to BrokenThumb's topic in AutoIt General Help and Support
Thanks for the updated script NutStomper. This is what I've got so far, and it still works when minimized without the WM_PAINT section you have. (Though yours starts up much faster and the AdlibRegister section is pretty legit for getting it to repeat on a specific time clock) I've learned a ton in this thread already! Can you take a look and tell me what you think of it? #include <GDIPlus.au3> #include <GUIConstantsEx.au3> ;Pre-Defined Variables $hWGoose = "http://1.1.1.1/graph?width=500&height=200&time=900&refresh=0&dev=011BBCAB14000019&sen=1&sen=2&dev=2D0000008DFBC812&sen=1&sen=3" ;-------------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------------- Global $hGUI, $hImage, $hGraphic Local $hDownload ;Create GUI $hGUI = GUICreate("DFW WeatherGoose", 400, 200) GUISetState() $hDownload = InetGet($hWGoose, @TempDir & "\test.png", 1, 1) ;Loop until user exits Do IF InetGetInfo($hDownload, 2) then ;Check if download is complete or InetClose($hDownload) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@TempDir & "\test.png") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() $hDownload = InetGet($hWGoose, @TempDir & "\test.png", 1, 1) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE -
Problem getting a script to repeat itself
BrokenThumb replied to BrokenThumb's topic in AutoIt General Help and Support
Oh damn....thanks for checking me into Rehab guys. My script-fu isn't very powerful yet. I'm still pretty noobish. NutStomper: I checked out your script and it worked, but I guess I was under the influence that DoUntil had to wrap around your script, so I'm a bit confused as to why it actually works. careca: I'm going to mess with your script here in a bit and see how it works out. Edit: dang careca, your script is pretty slick! I like it! Thanks for all the help today guys, not much of an active, but this is one of the better web communities I've worked with so kudos and what not Looks like I need to read up on GDIPlus more. Edit Edit: Just for grins this is what I was working on before NutStomper/careca helped sober up my script. Global $hGUI, $hImage, $hGraphic ;Create GUI $hGUI = GUICreate("DFW WeatherGoose", 400, 200) GUISetState() ;Load PNG image _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@TempDir & "\test.png") ;Draw PNG image $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) $hDownload = InetGet($hWGoose, @TempDir & "\test.png", 1, 1) ;Loop until user exits Do IF InetGetInfo($hDownload, 2) then ;Check if download is complete or InetClose($hDownload) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@TempDir & "\test.png") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) Filedelete(@TempDir & "\test.png") $hDownload = InetGet($hWGoose, @TempDir & "\test.png", 1, 1) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE -
Hey Guys, Haven't posted for awhile, but I ran into a new problem today while I was trying to make this script. So I have a networked temperature monitor in my server room and I'm trying to download the graph that it creates and have it show up in a small GUI window. Now I've gotten it to download and display just fine, the issue happens when I try to get it to re-download the image, update the GUI and then do it again. Here's what I have so far: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> ;Pre-Defined Variables $hWGoose = "http://1.1.1.1/graph?width=500&height=200&time=900&refresh=0&dev=011BBCAB14000019&sen=1&sen=2&dev=2D0000008DFBC812&sen=1&sen=3" ;-------------------------------------------------------------------------------------------- Local $hDownload = InetGet($hWGoose, @TempDir & "\test.png", 1, 1) Do Sleep(100) Until InetGetInfo($hDownload, 2) ;Check if the download is complete InetClose($hDownload) ;Close the handle to release resources ;-------------------------------------------------------------------------------------------- Global $hGUI, $hImage, $hGraphic ;Create GUI $hGUI = GUICreate("DFW WeatherGoose", 400, 200) GUISetState() ;Load PNG image _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@TempDir & "\test.png") ;Draw PNG image $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) ;Loop until user exits Do Local $hDownload = InetGet($hWGoose, @TempDir & "\test.png", 1, 1) Do Sleep(100) Until ((InetGetInfo($hDownload, 2)) Or (GUIGetMsg() = $GUI_EVENT_CLOSE)) ;Check if download is complete or exit GUI Local $nBytes = InetGetInfo($hDownload, 0) InetClose($hDownload) ;Close the handle to release resources _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@TempDir & "\test.png") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown()The problem seems to be under the Do, I've got this section and when I comment it out it works fine, just no looping like I want: ;Loop until user exits Do ; Local $hDownload = InetGet($hWGoose, @TempDir & "\test.png", 1, 1) ;Do ;Sleep(100) ;Until ((InetGetInfo($hDownload, 2)) Or (GUIGetMsg() = $GUI_EVENT_CLOSE)) ;Check if download is complete or exit GUI ;Local $nBytes = InetGetInfo($hDownload, 0) ;InetClose($hDownload) ;Close the handle to release resources _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@TempDir & "\test.png") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) Until GUIGetMsg() = $GUI_EVENT_CLOSE Ideally I want it to re-download the image and refresh the PNG every 60 seconds, but this is the only way I could think of looping the script. = Any hints?
-
Using an InputBox to edit a FileDelete Function
BrokenThumb replied to BrokenThumb's topic in AutoIt General Help and Support
Woah, that's pretty sweet Jlogan. Much easier than I thought it would be. I'll have to go through all the rest of the Macros. Thanks a ton! So these Macros can be added onto a function even though they're not included in the syntax? -
Hey All, Silas here again. I've started work on another script that goes into a user's Window's profile folders and deletes a specified config file that works with one of our applications. I can get the script to work when I hard code the users name into the script, but what I'm trying to do now is use a variable and an InputBox so a user can type in their user name and delete the file if they have any issues with software. However I cant seem to get it to run right, here's what I have so far. ; Script Start ;Variables $UsrNm = InputBox ( "Username", "Please enter your program Username.", "dfw-" ) ;Username if @error=1 Then Exit Endif FileDelete( "C:\Users\dfw-user\AppData\Roaming\Program\Folder\config.xml" ) Now this one works when I hard code their user name where "dfw-user" is. However if I try to use the variable, of course, it just does nothing because its a string and that file path doesn't exist. I've tried breaking it up in to two strings and putting & $UsrNM in-between them however just like I thought, it didn't work. Does anyone have any ideas? I tried searching around but couldn't find anything that was quite what I was looking for. I found plenty of stuff about appending the variable onto the end of a string or a message box, but nothing like this.
-
Issue w/ MessageBox and @CRLF
BrokenThumb replied to BrokenThumb's topic in AutoIt General Help and Support
How obnoxious. I tried that before and I kept erroring out...must have been syntax haha. Thanks Mecha that worked! -
Hey Guys, So I'm working on another gimmicky script to improve my skills and I cant seem to figure out this issue I'm hitting. Maybe you guys can point out whats going on for me. This script is basically going to take the input from our users and paste it into the Add Trusted Sites for IE9 and wrap up the adding Trusted Sites process for them. While the below script works (it's not completed but I try to troubleshoot as I go) to the end, it just looks nasty when it adds the variable in. ; Script Start ;VARIABLES ;$newTRUST = User defined URL to be added to IE9's Trusted Sites. ;This segment sets the maching to mode 2 and brings forward the Internet Properties/Security menu. AutoItSetOption ( "WinTitleMatchMode", 2 ) ShellExecute ( "rundll32.exe", 'shell32.dll,Control_RunDLL inetcpl.cpl,,1' ) WinWaitActive ( "Internet Properties" ) ;Now we will access the trusted sites menu. Send ( "{Right} {RIGHT} {RIGHT}" ) Sleep ( 500 ) Send ( "!s" ) ;Alt + s WinWaitActive ( "Trusted sites" ) ControlCommand ( "Trusted sites", "Require &server verification (https:) for all sites in this zone", 1023, "UnCheck" ) ;This section will display the user input box so they can specify the site they would like added. $newTRUST = InputBox ( "Website URL to add", "Please enter the URL of the website you would like to add to your Trusted Sites. (ex. www.google.com, www.reddit.com)", "test.test.com", "") MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites." & $newTRUST ) So I did some digging and it appears that @CRLF is going to allow me to put the $newTRUST data on a new line of the msgbox. However after adding @CRLF it does not display $newTRUST. Any thoughts? Thanks in advance guys. ; Script Start ;VARIABLES ;$newTRUST = User defined URL to be added to IE9's Trusted Sites. ;This segment sets the maching to mode 2 and brings forward the Internet Properties/Security menu. AutoItSetOption ( "WinTitleMatchMode", 2 ) ShellExecute ( "rundll32.exe", 'shell32.dll,Control_RunDLL inetcpl.cpl,,1' ) WinWaitActive ( "Internet Properties" ) ;Now we will access the trusted sites menu. Send ( "{Right} {RIGHT} {RIGHT}" ) Sleep ( 500 ) Send ( "!s" ) ;Alt + s WinWaitActive ( "Trusted sites" ) ControlCommand ( "Trusted sites", "Require &server verification (https:) for all sites in this zone", 1023, "UnCheck" ) ;This section will display the user input box so they can specify the site they would like added. $newTRUST = InputBox ( "Website URL to add", "Please enter the URL of the website you would like to add to your Trusted Sites. (ex. www.google.com, www.reddit.com)", "intranet.chq.ei", "") MsgBox( 0, "The following website will be added to the IE9 Trusted Sites.", "The following website will be added to the IE9 Trusted Sites.", @CRLF & $newTRUST )
-
Ahhhh...I thought that when the window was hidden it would still take commands, just be hidden from the user's view. That makes since when you put it that way. I tried out your ShellExecute Function and it worked like a dream. I'll be sure to use that one instead. It's just a lot to try and take in all at once Thanks for the help JLogan!
-
Hey All, Its me again, trying to hammer through some more scripts today. I was able to get this script up and running to change proxy settings automatically on IE9 and I wrote it in a way that my Users will be able to get visual feedback that their settings are changing. ; Script Start ;This portion launches the Internet Properties menu. Run ( "cmd" ) WinWaitActive ( "Administrator: C:\Windows\system32\cmd.exe" ) Send ( "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4 {ENTER}" ) WinWaitActive ( "Internet Properties" ) WinClose ( "Administrator: C:\Windows\system32\cmd.exe" ) ;This section launches the LAN Settings. Send ( "!l" ) ;"Alt + l" ;The following unchecks the proxy server radio and sets it to Auto detect. WinWaitActive ( "Local Area Network (LAN) Settings" ) ControlCommand ( "Local Area Network (LAN) Settings", "", "Button6", "UnCheck", "" ) ControlCommand ( "Local Area Network (LAN) Settings", "", "Button2", "Check", "" ) ;This segment backs you out and closes the menu then displays a mesage letting you know the task is complete. Closes auto after 5 seconds. Sleep ( 1000 ) ;One Second break in script to show user the proxy settings have been changed. ControlClick ( "Local Area Network (LAN) Settings", "OK", 1 ) WinWaitActive ( "Internet Properties" ) ControlClick ( "Internet Properties", "OK", 1 ) MsgBox ( 0, "Proxy settings have been set to offsite.", "Your proxy settings have been changed. This window will close in five seconds.", 5 ) However as it is set up now, it shows the command prompt and I would like to remove that. So I looked up the RUN Function help page and I find that I need to add @SW_HIDE to make windows run in the background. However every time I make adjustments. (Code below) it hangs and keeps pausing itself. Looked around the forum and couldn't quite see my issue so I was hoping someone might be able to point out my fail for me. ; Script Start ;This portion launches the Internet Properties menu. Run ( "cmd", "", @SW_HIDE ) WinWaitActive ( "Administrator: C:\Windows\system32\cmd.exe" ) Send ( "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4 {ENTER}" ) WinWaitActive ( "Internet Properties" ) WinClose ( "Administrator: C:\Windows\system32\cmd.exe" ) ;This section launches the LAN Settings. Send ( "!l" ) ;"Alt + l" ;The following unchecks the proxy server radio and sets it to Auto detect. WinWaitActive ( "Local Area Network (LAN) Settings" ) ControlCommand ( "Local Area Network (LAN) Settings", "", "Button6", "UnCheck", "" ) ControlCommand ( "Local Area Network (LAN) Settings", "", "Button2", "Check", "" ) ;This segment backs you out and closes the menu then displays a mesage letting you know the task is complete. Closes auto after 5 seconds. Sleep ( 1000 ) ;One Second break in script to show user the proxy settings have been changed. ControlClick ( "Local Area Network (LAN) Settings", "OK", 1 ) WinWaitActive ( "Internet Properties" ) ControlClick ( "Internet Properties", "OK", 1 ) MsgBox ( 0, "Proxy settings have been set to offsite.", "Your proxy settings have been changed. This window will close in five seconds.", 5 ) Thanks Guys!
-
Hey Guys, I've been lurking the forums for a few days now since I just got into AutoIT and honestly scripting in general. I know a bit of Pascal, but not much more... Anywho I've started a project to help me at my job by automating some of the soul crushing tasks like "The internet on my laptop isn't working" or "***" software isn't running right." You know the kind of tier 1 questions you have to take care of that really make you cringe. Basically right now I'm working on creating a script that will automatically alternate your proxy settings in IE9 from our branch's proxy server to auto detect. The issue I've run into is that my script will work....but randomly. It will usually run the first time after saving the script but if I try to run it again it gets to the LAN window and just dies out with no error message. I've done a bit of searching on the forum, but didn't find anything that quite met my needs. I'm sure it's something easy, but I've spent close to an hour messing around with this ControlClick command. Run ( "cmd" ) WinWaitActive ( "Administrator: C:\Windows\System32\cmd.exe" ) Send ( "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4 {ENTER}" ) WinWaitActive ( "Internet Properties" ) WinClose ( "Administrator: C:\Windows\System32\cmd.exe" ) Send ( "!l" ) WinActivate ( "Local Area Network (LAN) Settings" ) ControlClick ( "Local Area Network (LAN) Settings", "Use a pro&xy server for your LAN (These settings will not apply to dial-up or VPN connections).", 1570 ) ;ControlClick ( "Local Area Network (LAN) Settings", "&Automatically detect settings", 1573 ) I've commented out the second ControlClick to try and figure out why I can't get this first command to consistently work. Any help would be greatly appreciated and if I manage to get her running I'll be sure to post my findings. Thanks Guys!