Jump to content

fett8802

Active Members
  • Posts

    119
  • Joined

  • Last visited

About fett8802

  • Birthday 03/01/1987

Profile Information

  • WWW
    http://www.nerdpartyextreme.com
  • Interests
    Photography, Graphic Editing, Electronics, Video Games

Recent Profile Visitors

302 profile views

fett8802's Achievements

Adventurer

Adventurer (3/7)

1

Reputation

  1. Excellent KaFu! That will accomplish exactly what I need, and only in 6 extra lines of code instead of another 100. Thank you very much! Also, thanks to Melba and BrewMan for their input! - Fett
  2. Yea, sorry, I wasn't very clear about that. If I press a GUI button with the above function, it seems to work normally. However, if I start by pressing a HotKey, it creates a fatal error with SciTE returning: C:Documents and SettingskmillsDesktopScriptsProjectsAutoIt RegressionXT PanelsARP.au3 (169) : ==> Unknown macro.: Case @GUI_CtrlId = $bTop1 Or @HotKeyPressed = "{NUMPADDIV}" Case ^ ERROR Also, if I press buttons and hit hotkeys back to back it begins creating weird returns. It seems that the @HotKeyPressed returns the previous returned hotkey, regardless of if the HotKey function actually called the function. I actually realised as I was typing this response that I'm probably going to have to split it into two functions regardless. Unless there is a way to default them both at the end of the function? Sorry for the waste of time, BrewMan. Fett
  3. Hello all, I found a couple of threads that touched in this issue - but workarounds were always found before anyone could get around to answering the original request. So, I'll ask here: I've got a function that is going to be handling the administration of a lot of stuff. The GUI I have running is calling this function on 17 different GUI button presses and what will eventually be around 50 hotkeys. Before you think it's a keylogger, it isn't. The GUI is representing one of my companies keypads and controlling it via a serial connection. As it stands, if I want to enter an alphanumeric character in the keypad, I can do so by pressing a button. It would be MUCH simpler to be able to type everything into the keypad. Anyway, each hotkey press and GUI button press is calling the same function. The function sends the key to the keypad and writes the function call (_Reg_PressKey()) and its keypress to a listview that records the script. The beginning of the function code looks like this: Func bKeypadButtons() Select Case @GUI_CtrlId = $bTop1 Or @HotKeyPressed = "{NUMPADDIV}" _Reg_PressKey("T1") __WriteKeypress("T1") Case @GUI_CtrlId = $bTop2 Or @HotKeyPressed = "{NUMPADMULT}" _Reg_PressKey("T2") __WriteKeypress("T2") Case @GUI_CtrlId = $bTop3 Or @HotKeyPressed = "{NUMPADSUB}" _Reg_PressKey("T3") __WriteKeypress("T3") Case @GUI_CtrlId = $bTop4 Or @HotKeyPressed = "{NUMPADADD}" _Reg_PressKey("T4") __WriteKeypress("T4") Case @GUI_CtrlId = $bKey1 Or @HotKeyPressed = "{NUMPAD1}" _Reg_PressKey("1") __WriteKeypress("1") Case @GUI_CtrlId = $bKey2 Or @HotKeyPressed = "{NUMPAD2}" _Reg_PressKey("2") __WriteKeypress("2") Case @GUI_CtrlId = $bKey3 Or @HotKeyPressed = "{NUMPAD3}" _Reg_PressKey("3") __WriteKeypress("3") Case @GUI_CtrlId = $bKey4 Or @HotKeyPressed = "{NUMPAD4}" _Reg_PressKey("4") __WriteKeypress("4") ;ETC. This goes on for the enter numberpad and most of the alpha keys As it stands, it seems that I can not use both @GUI_CtrlID and @HotKeyPressed in the same function. This would save a significant amount of code and greatly increase the efficiency if it were possible. Any ideas? Thanks, Fett
  4. Melba!!! I had never thought to use GUIRegisterMsg in that way before. That's excellent! This thread is a prime example of why someone shouldn't PM someone asking for help. Also, a prime reason I read through problems that I'm not neccesarily having. You can still learn a lot from what's going on with others. Sorry for the slightly off topic post, but I was really excited by this piece of information! I will be using this idea a LOT in the future. Thanks again! - Fett
  5. I just wrote a working example. It's a progress bar clock! #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region $gMain = GUICreate("Progress Bar Clock", 633, 106, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "gMainClose") $lHours = GUICtrlCreateLabel("Hours:", 8, 8, 35, 17) $lMinutes = GUICtrlCreateLabel("Minutes:", 8, 32, 44, 17) $lSeconds = GUICtrlCreateLabel("Seconds:", 9, 56, 49, 17) $lMillis = GUICtrlCreateLabel("Milliseconds:", 8, 80, 64, 17) $pHours = GUICtrlCreateProgress(80, 8, 545, 12) $pMinutes = GUICtrlCreateProgress(80, 32, 545, 12) $pSeconds = GUICtrlCreateProgress(80, 56, 545, 12) $pMillis = GUICtrlCreateProgress(80, 80, 545, 12) GUISetState(@SW_SHOW) #EndRegion While 1 GUICtrlSetData($pHours, (@HOUR / 24) * 100) GUICtrlSetData($pMinutes, (@MIN / 60) * 100) GUICtrlSetData($pSeconds, (@SEC / 60) * 100) GUICtrlSetData($pMillis, (@MSEC / 1000) * 100) Sleep(100) WEnd Func gMainClose() Exit EndFunc Hope this helps! - Fett
  6. I've actually done a lot of path grabbing before. The easiest way I've found is: $sPath = "C:Documents and SettingstestMy DocumentstestTest Archivetest2test4CellTest.txt" $aPath = StringSplit($sPath,"") $sResult = $aPath[$aPath[0]] ConsoleWrite($sResult & @CR) Returns the last array entry. - Fett
  7. It took me a long time before I finally figured out that I could group If statements like mathematical statements (to an extent), for example: If (@HOUR = 18 Or @HOUR = 20 Or @HOUR = 22) And (@MIN = 15 Or @MIN = 30 Or @MIN = 45) And (@SEC = 00 Or @SEC = 30) Then This If statement will become true in 18 different ways - which should be what you are wanting. It's amazing what specific things you can filter when you group If statements in parenthesis. According to the help file: - Fett
  8. It was suggested by guiness that I add this here. This function will move the mouse to a control and click it: ; #FUNCTION# ==================================================================================================================== ; Name...........: _ControlMouseClick ; Description ...: Use the mouse to move to a control and click it ; Syntax.........: _ControlMouseClick($iTitle, $iText, $iControl [, $iButton = "left" [, $iClicks = "1" [, $iSpeed = "10" [, $iXpos = "" [, $iYpos = "" ]]]]] ) ; Parameters ....: $iTitle - The title of the window containing the control ; $iText - Some text from the window containing the control. Can enter no text be using "" ; $iControl - The Control ID of the control to click ; $iButton - [optional] The button to click: "left", "right", "middle", "main", "menu", "primary", "secondary". Default is "left" ; $iClicks - [optional] The number of times to click the mouse. Default is 1. ; $iSpeed - [optional] The speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10. ; $iXpos - [optional] The x position to click within the control. Default is center. ; $iYpos - [optional] The y position to click within the control. Default is center. ; Author ........: Kris Mills <fett8802 at gmail dot com> ; UserCallTip....: _ControlMouseClick ( "title", "text", controlID [, button [, clicks [, speed [, x [, y ]]]]] ) Use the mouse to move to a control and click it.(required: #include <KrisUDF.au3>) ; =============================================================================================================================== Func _ControlMouseClick($iTitle, $iText, $iControl, $iButton = "left", $iClicks = "1", $iSpeed = "10", $iXpos = "", $iYpos = "") $iOriginal = Opt("MouseCoordMode",2) ;Change the MouseCoordMode to relative coords and get the previous setting $aPos = ControlGetPos($iTitle, $iText, $iControl) ;Get the position of the given control MouseClick($iButton,$aPos[0] + ($aPos[2]/2) + $iXpos, $aPos[1] + ($aPos[3]/2) + $iYpos, $iClicks, $iSpeed) ;Move the mouse and click on the given control Opt("MouseCoordMode",$iOriginal) ;Change the MouseCoordMode back to the original EndFunc ;==>_ControlMouseClick
  9. Oh! Excellent! Not sure why I didn't see that in the help file. That will help shave off a bunch of code from my UDFs. - Fett
  10. You're very welcome! I'm glad it worked for you! Thanks for the feedback, I'll do that! -Fett
  11. I actually wrote a function for this years ago and have used it in many of my hardware/software testing programs. This will do exactly what you want: ; #FUNCTION# ==================================================================================================================== ; Name...........: _ControlMouseClick ; Description ...: Use the mouse to move to a control and click it ; Syntax.........: _ControlMouseClick($iTitle, $iText, $iControl [, $iButton = "left" [, $iClicks = "1" [, $iSpeed = "10" [, $iXpos = "" [, $iYpos = "" ]]]]] ) ; Parameters ....: $iTitle - The title of the window containing the control ; $iText - Some text from the window containing the control. Can enter no text be using "" ; $iControl - The Control ID of the control to click ; $iButton - [optional] The button to click: "left", "right", "middle", "main", "menu", "primary", "secondary". Default is "left" ; $iClicks - [optional] The number of times to click the mouse. Default is 1. ; $iSpeed - [optional] The speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10. ; $iXpos - [optional] The x position to click within the control. Default is center. ; $iYpos - [optional] The y position to click within the control. Default is center. ; Author ........: Kris Mills <fett8802 at gmail dot com> ; UserCallTip....: _ControlMouseClick ( "title", "text", controlID [, button [, clicks [, speed [, x [, y ]]]]] ) Use the mouse to move to a control and click it.(required: #include <KrisUDF.au3>) ; =============================================================================================================================== Func _ControlMouseClick($iTitle, $iText, $iControl, $iButton = "left", $iClicks = "1", $iSpeed = "10", $iXpos = "", $iYpos = "") $iOriginal = Opt("MouseCoordMode") ;Get the current MouseCoordMode Opt("MouseCoordMode",2) ;Change the MouseCoordMode to relative coords $aPos = ControlGetPos($iTitle, $iText, $iControl) ;Get the position of the given control MouseClick($iButton,$aPos[0] + ($aPos[2]/2) + $iXpos, $aPos[1] + ($aPos[3]/2) + $iYpos, $iClicks, $iSpeed) ;Move the mouse and click on the given control Opt("MouseCoordMode",$iOriginal) ;Change the MouseCoordMode back to the original EndFunc ;==>_ControlMouseClick There ya go. -Fett
  12. WOW! That is exemplary. I will try to create something basic with it and let you know how it turns out. Man, that really is incredible. -Fett
  13. First off, I just wanted to say that I'm not resurrecting this topic to spam. I wanted to say thanks for this UDF, it did exactly what I needed. I also wanted to post a new portion of the UDF that I wrote. I needed a service to be run on a computer that could receive the texts into an AutoIt program running while I was away from the computer. So, I wrote the following two functions: ; #FUNCTION# ;=============================================================================== ; Name...........: _GetGVSMS ; Description ...: Polls the Google Voice service for new texts ; Syntax.........: _GetGVSMS ( $FromGVAccount, $FromGVPassword [, $iCheckTime = 5000 ] ) ; Parameters ....: $FromGVAccount - Google Voice Account E-Mail to poll ; $FromGVPassword - Google Voice Account Password to for the above account ; $iCheckTime - The interval to poll the Google Voice account (in milliseconds) ; Return values .: Success - Returns an array containing the phone number and text message ; Author ........: Fett8802, original IE code by GoogleDude ; Remarks .......: Requires a Valid Google Voice Account. ; Requires.......; IE.AU3 and a valid Google Voice Account ;============================================================================================ Func _GetGVSMS($FromGVAccount,$FromGVPassword, $iCheckTime = 5000) $GV_SMS_URL = _IECreate("https://www.google.com/voice/b/0/m/sms",0,0,1,1) $GV_Form = _IEFormGetObjByName($GV_SMS_URL, "gaia_loginform") $o_username = _IEFormElementGetObjByName($GV_Form, "Email") _IEFormElementSetValue($o_username, $FromGVAccount) $o_password = _IEFormElementGetObjByName($GV_Form, "Passwd") _IEFormElementSetValue($o_password, $FromGVPassword) _IEFormSubmit($GV_Form,1) Do _IENavigate($GV_SMS_URL,"https://www.google.com/voice/m",1) $objNewMsg = _IEPropertyGet($GV_SMS_URL,"outerhtml") $aText = _GetText($objNewMsg) Sleep($iCheckTime) Until IsArray($aText) = 1 $iRefreshLink = StringRegExp($objNewMsg,"<A href=""/voice/m/archive(.*)"">archive",1) $iRefreshLink[0] = StringRegExpReplace($iRefreshLink[0],"&amp;","&") $sLink = "https://www.google.com/voice/m/archive" & $iRefreshLink[0] _IENavigate($GV_SMS_URL,$sLink,1) _IEQuit($GV_SMS_URL) Return $aText EndFunc Func _GetText($iText) $iMatches = StringRegExp($iText,"<DIV><SPAN class=sf>(.*)</SPAN>h</DIV>",3) If IsArray($iMatches) = 0 Then Return -1 $iNumber = StringRegExp($iMatches[UBound($iMatches)-1],"<B>+(.*):h</B>",1) If IsArray($iNumber) = 0 Then Return -2 $iText = StringRegExp($iMatches[UBound($iMatches)-1],"<SPAN>(.*)</SPAN>",1) If IsArray($iText) = 0 Then Return -3 Dim $iReturn[2] = [$iNumber[0],$iText[0]] Return $iReturn EndFunc The second function is used internally in the first. What this does is it opens an IE window in the background and polls the google voice mobile page every 5 seconds be default. This can be extended or shortened via the $iChecktime variable. When it sees a new text, it retrieves the text and the number it came from in an array and passes it. I use this in a service I wrote so that I can send various text commands to my computer to perform certain tasks while I'm away. Thought it would be useful. Thanks again! - Fett</a>
  14. Hello all, I'm starting to learn the immense functionality of the .dll file. I'm using at least one custom .dll file in my new program that contains all of the images and icons used within. It's a very nice way to quickly and easily package everything into one nice, neat file. My question is, my program actually has three separate .exe files it can call. These programs get user input and write to an .ini file for the main program to read. What I'd like to do is compile these three separate .exe files (written and compiled in AutoIt) into a .dll file (I have completed this step) and call the .exe directly from the .dll file when running the main program. This will help save space and clutter in the install directory. Can this be done? I've tried Run("RunDLL32.exe C:\SeparateExes.dll,test") Where "test.exe" is the name of the first program. Thanks for your help! -Fett
×
×
  • Create New...