Jump to content

JuggaloZeke

Active Members
  • Posts

    47
  • Joined

  • Last visited

JuggaloZeke's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks for the help. It was a bit frustrating because I could easily write a script that used message boxes with inputs to accomplish the task. Since I haven't tried using an AutoIt GUI before I figured this would be an excellent opportunity but I just couldn't figure it out. Thanks again!
  2. Trying to write a small program in AutoIt here at work to help out the mathematically challenged. We have a machine that requires a surface area measurement (both sides +10% for components) which the younger generation seems to have trouble calculating. I made up a quick spreadsheet that they could put the length and width measurements into but I thought it would be great to make an AutoIt GUI that can stay on top of the program window at all times. The problem is... I have never used GUI's with AutoIt and I'm not having much luck figuring it out. Ideally, I'd like the program to dynamically update the calculated value as users change the length and width input boxes. Less ideally, I tried to write in a "Calculate" button to force an update to the input boxes but not even that seemed to work. Also, my "Insert Results" button doesn't trigger the mouse clicks/typing like I think it should. I've been sitting in front of this and the help file for a few hours today toying with this but I figured it's time to ask those with more experience where I'm going wrong here. I've included what I've got so far. Any help would be appreciated, thanks. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Local $areaCalc = GUICreate("Surface Area Calculator", 525, 240, 150, 25, $WS_BORDER, $WS_EX_TOPMOST ) Local $correctedresult = 0 Local $result = 0 Local $length = 1 Local $width = 1 Local $percent = "10%" GUICtrlCreateLabel("Surface Area Calculator", 30, 10) GUICtrlCreateLabel("To use, measure the length and width of the board and enter each value into the white boxes below. ", 30, 25) GUICtrlCreateLabel("The tool will calculate the surface area measurement of the board and can input the values.", 30, 40) GUICtrlCreateLabel("Length",35,65) GUICtrlCreateLabel("Width",90,65) GUICtrlCreateLabel("Buffer",140,65) GUICtrlCreateLabel("Surface Area",190,65) Local $lengthbox = GUICtrlCreateInput($length,30,80,50,20,$ES_NUMBER) Local $widthbox = GUICtrlCreateInput($width,85,80,50,20,$ES_NUMBER) Local $percentbox = GUICtrlCreateInput($percent,140,80,30,20,$ES_NUMBER) Local $resultbox = GUICtrlCreateInput($correctedresult,175,80,80,20,$ES_READONLY) Local $calc = GUICtrlCreateButton("Calculate",260,77) Local $movResults = GUICtrlCreateButton("Insert Results",320,77) GUISetState(@SW_SHOW, $areaCalc) While 1 Switch GUIGetMsg() Case $calc $length = GUICtrlRead($lengthbox) $width = GUICtrlRead($widthbox) $percent = GUICtrlRead($percentbox) If IsNumber($length & $width) Then $result = (($length*$width)*2) $correctedresult = (($result*$percent)+$result) EndIf Local $lengthbox = GUICtrlCreateInput($length,30,80,50,20,$ES_NUMBER) Local $widthbox = GUICtrlCreateInput($width,85,80,50,20,$ES_NUMBER) Local $percentbox = GUICtrlCreateInput($percent,140,80,30,20,$ES_NUMBER) Local $correctresultbox = GUICtrlCreateInput($correctedresult,175,80,80,20,$ES_READONLY) Case $movResults MovResults() EndSwitch Sleep(1000) WEnd Func MovResults() MouseClick("left",350,435) Send("[TAB]CCA"&$correctedresult&"[TAB]"&$percent) MouseClick("left",440,680) EndFunc
  3. Just what I was looking for! Thanks a lot, I appreciate the help. Here is what I have come up with, is that a "good" way to use this function? I know there are usually multiple ways to accomplish a task, I usually do it the sloppy way because I don't know any better, haha.
  4. The part of the script I'm asking to could be universally applied to lots of scripts and doesn't make/break my script, just a little something extra. Not trying to be rude, I've been around here for six years so I know how things operate. I figured, like you said, since what I'm asking about is pertinent to the script I wouldn't have to hear that line, lol. Thanks for that, I knew there was a way to do that but I was trying to use plus signs, damn! Now, how about retrieving the data and putting it back into a variable with the iniRead command? I just can't seem to wrap my head around how to get these arrays into and out of the ini file. I'm going to mull it over and see if I can't work it out.
  5. Oh hey new guy, did I ask for help with game automation? Didn't think so. The ini is formatted by the iniWrite command, AFAIK. The problem I am having is it never writes anything into the "value" field. For what it's worth, here is what it produces: [Coords] bay1= bay2= bay3= bay4= bay5= bay6= bay7= bay8= job= exx= worker= stz= As far as loading without checking, I'm the only one using it so I know the file exists, lol. Thanks for the help. I forgot to mention in the first post that I tried storing the data returned from the getMousePos command in an array format(?) with the script in the first post. I also tried something like this: IniWrite ( "cartown.ini", "Coords", "bay1", $bay1 ) IniWrite ( "cartown.ini", "Coords", "bay2", $bay2 ) IniWrite ( "cartown.ini", "Coords", "bay3", $bay3 ) IniWrite ( "cartown.ini", "Coords", "bay4", $bay4 ) IniWrite ( "cartown.ini", "Coords", "bay5", $bay5 ) IniWrite ( "cartown.ini", "Coords", "bay6", $bay6 ) IniWrite ( "cartown.ini", "Coords", "bay7", $bay7 ) IniWrite ( "cartown.ini", "Coords", "bay8", $bay8 ) IniWrite ( "cartown.ini", "Coords", "job", $job ) IniWrite ( "cartown.ini", "Coords", "stz", $stz ) IniWrite ( "cartown.ini", "Coords", "exx", $exx ) IniWrite ( "cartown.ini", "Coords", "worker", $worker ) The script in the first post doesn't function at all because of formatting with the arrays in the iniWrite command. Replaced with the snippet above it will run but never write any values.
  6. I've got a script that I am trying to get to store mouse coords to load on later uses. I tried the iniWrite/Read commands but I guess I don't understand how the mouseGetPos returns the coordinates so it isn't storing them properly... or at all, actually, haha. Script included for reference... and hey, if you see a way to optimize anything in it, feel free to let me know! I am terrible at this stuff.
  7. PixelGetColor would get the color of a specific coord and return the value as a decimal. This could then be compared to your desired color. Now, anyone have any help for the original post?
  8. I'm trying to figure out a way to use the PixelSearch function to crawl over an image and record every pixel that is a certain color. I would like it to also log every pixel coord that matches the criteria. I just cannot figure out how to get the function to "continue" searching after it has found its first result. The ultimate point of this tool would be to then load the coord log into another script which would then trace out the image that was recorded pixel by pixel.
  9. That sounds like a winner. I was thinking in a completely different way but that looks like it should work. Thanks for the help.
  10. I'm not quite sure how to describe what I'm trying to do so it has made it difficult to search for answers.... basically, I've got a script built that I'd like to visit specific URLs at different intervals. I just can't figure out how to implement it into the script without putting each one in individually making my script 16x bigger than it needs to be. Here is what I'm trying to implement... $count = 1 $oMMC = _IECreate ("about:blank") While 1 _IENavigate ($oMMC, "http://myurl.com" & $counturl) $count = $count+1 If $count = 17 Then $count = 1 WEnd ;URL1="/" - 1, 4, 8, 11 - URL1 needs to be used on the 1st, 4th, 8th, and 11th loop. ;URL2="/ind" - 6, 13 - URL2 needs to be used on the 6th and 13th loop. ;URL3="/tra" - 16 - URL3 needs to be used on the 16th loop (and then reset counter) ;URL4="/sec" - 2, 5, 9, 12 - URL4 needs to be used on the 2nd, 5th, 9th, and 12th loop. ;URL5="/env" - 7, 14, 15 - URL5 needs to be used on the 7th, 14th, and 15th loop. ;URL6="/com" - 3, 10 - URL6 needs to be used on the 3rd and 10th loop. Something along those lines, I just don't know how to set up the count and stuff to call in specific stuff.
  11. To get your script to not close look into the While command.
  12. Are you going to share your payment with those who help?
  13. Actually, that worked flawlessly. When the script first searches for the icon in the task bar notice is is searching for the Orange value. By default, the icon is orange (while it is disconnected) so that is why I chose that as a starting point. Obviously, if the card is in any other state it won't work but I can easily make sure it is where it needs to be to start. Thanks for the help!
  14. I don't get what you mean? I am aware PixelGetColor returns a decimal number, and that when converted to Hex it creates a string. Did I not make the constants strings as well? This is one part that has had be confused and I've tried it several different ways, even listing my colors in the 0xFF0033 format. Or are you just talking about the $color variable? That is the part I've been struggling with.
  15. I have written a script that will continually connect to the internet via my air card, visit a webpage (http://autoit.myminicity.com/) which acts like a counter, and then disconnects from the internet and repeats the process to get a new IP. The problem I'm having is with my While loops. Either they are eternally stuck in the loop even though the expression is false or they work right through the loop while the expression is true. I may be calling them incorrectly, I am not sure which is why I'm here. The way the script SHOULD work: The script determines where the icon to my VZAccess Manager program is and records its position. It will use this position to poll its color to determine when to move on with the script. It will send an {ENTER} key to the program to begin connecting. At this point it should enter the first loop. While the icon is either orange(disconnected) or yellow(connecting) it should continue to loop. When it changes to another color (green[connected] or red[disconnecting]) is when it should exit the loop and continue on by sending a URL to browser, waiting for the page to load, and then going back into a loop to disconnect (just waiting for greed and red to pass this time) and then starting over. And I will be replacing the send lines with ControlSend after playing around with that a little bit. Pretty cool feature. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: Brandon Kling Script Function: Connect, load specified MyMiniCity pages, disconnect, repeat. #ce ---------------------------------------------------------------------------- ; Script Start AutoItSetOption("WinTitleMatchMode", 2) Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") Dim $coord = PixelSearch(625, 760, 950, 760, 0xDE5B04, 0, 16) ;Finds VZAccess Manager icon in taskbar. ;MsgBox ( 0 , "Location Selector" , "Place mouse in lower left corner of VZAccess Manager icon and press Enter." ) ;Dim $location = MouseGetPos() ;MsgBox ( 0 , "DEBUG" , "Mouse x,y: " & $location [ 0 ] & ", " & $location [ 1 ] ) ;MsgBox ( 0 , "DEBUG" , "Mouse x,y: " & $coord [ 0 ] & ", " & $coord [ 1 ] ) ;Dim $deccolor = PixelGetColor ( $location [ 0 ] , $location [ 1 ] ) ;MsgBox ( 0 , "DEBUG" , "Decimal color: " & $deccolor ) ;Dim $color = Hex ( $deccolor , 6 ) Dim $deccolor = PixelGetColor($coord[0], $coord[1]) ;Gets color of VZAccess Manager icon (which should be DE5B04) ;MsgBox ( 0 , "DEBUG" , "Decimal color: " & $deccolor ) Dim $color = Hex($deccolor, 6) ;Converts captured color to hex Dim Const $yellow = "71620E" ;Constant for the yellow color Dim Const $red = "A60000" ;Constant for the red color Dim Const $green = "00830C" ;Constant for the green color Dim Const $orange = "DE5B04" ;Constant for the orange color ;MsgBox ( 0 , "DEBUG" , "Hex color: " & $color & ", variable type: " & VarGetType ( $color ) & ", color types: " & VarGetType ( $red ) ) ;MsgBox ( 0 , "Ready to Start" , "The program is now ready to run." ) While 1 WinActivate("VZAccess Manager") ToolTip("Activated VZAccess Manager.", 0, 0) Sleep(1000) Send("{ENTER}") ToolTip("Sent ENTER key to connect.", 0, 0) While $color = $orange Or $yellow ToolTip("Starting WHILE loop", 0, 0) Sleep(1000) ; $deccolor = PixelGetColor ( $location [ 0 ] , $location [ 1 ] ) $deccolor = PixelGetColor($coord[0], $coord[1]) ToolTip("Updating COLOR variable.", 0, 0) Sleep(1000) WEnd ToolTip("Successfully worked through first WHILE loop.", 0, 0) Sleep(1000) WinActivate("Windows Internet Explorer") Send("{F6}") Sleep(1000) Send("http://autoit.myminicity.com/{ENTER}") WinActivate("VZAccess Manager") While $color = $green Or $red ; $deccolor = PixelGetColor ( $location [ 0 ] , $location [ 1 ] ) $deccolor = PixelGetColor($coord[0], $coord[1]) WEnd Send("{ENTER}") WEnd Func TogglePause() $Paused = NOT $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc
×
×
  • Create New...