Jump to content

MarkJoel60

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

MarkJoel60's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. John, Glad to see you are keeping up with this! I will be testing the new methods soon. I was just wondering, has anyone had to access/control a datagrid using the autoit classes? When I Spy them, they don't seem be fully accessible. Does anyone have an example of Datagrid access through managed code?
  2. As TriBlade said, the commands to put and get from ClipBoard can be used to simulate COntrol-V and Control-C behavior. Or you can literally send a control C with the send command SEND("{^C}") But that isn't what you said you wanted to do. Control C and V really don't enter in to it from what you describe. In fact, I am not sure how you are planning to do that in notepad at all, but... First you want to read your notepad text string -- plenty of examples show how to do that. Then, you will want to process what you read, looking for your keywords. If you can control what is in the notepad, you will be better off if you separate your keywords with a delimiter (such as a '|' or something) because then you can use the string function SPLIT to break up your long notepad string into smaller strings of your keywords. Then you use that information in the part of your script that accesses your browser (again there are examples for this) and does the google search. You will need to then grab the text of your google results screen by ControlGetText() and put it another large string. Then you will put that string into your notepad. You won't be using Control C and V, probably, you will be processing strings that you grab from the screens. Here is a code snippet of a routine I wrote which does some of the things you describe. I am hitting a search screen that has performed a license plate read, and I want to do a different search on the Model which is returned. The search screen is not formatted nicely, so I have to find the MODEL: substring, which is what I want, and the MAKE: substring which shows me the end of what I want. Then I have the keyword I want to search on. (It's hard to read here because all white space is trimmed in my code snippet... I find that makes readin code hard. You might want to cut and paste it into your editor. It won't run, because you don't have the other things around it, but at keast you can view it and understand it)
  3. OK, SmOke_N (and 'herewasplato' ) Thanks for helping maintain my sanity... Interesting script... here's the thing... for speed sake, I have converted my scripts to c# code and am just using the DLL... so, has anyone translated this into a function? (Be nice to add it to the DLL... but even just a class code...) I can do it... but I figured, hey, if someone already had it done...?
  4. Well, I can mouseclick into the position, too. It's just the documentation says: But if the instance changes, then it is fully unreliable. The ControlSend function also talks about an ID and even shows a snippet of how to use it: ControlClick("My Window", "", "[ID:254]") But there is no function available (that I can see) in AutoIt that allows you to get the ID. If they are referring to what UISpy calls: "RuntimeId" then this, too, will change every time a program is executed. Which would be fine, if I had a way of getting them and storing it in an internal table or something... but again, I see no function for getting a runtime ID within AutoIt. Anyone who is running AutoIt against a program that is using a tab control will have the same problem I am seeing. It appears that AutoIt is making an assumption that you are running a program which is a single window full of a static list of controls. But a Tabbed control, or in my case an application that uses only one screen, and changes the controls on them depending on choices, renders all of the control functions unreliable. Or, so it seems... I am hoping someone tells me I am oh-so-wrong...
  5. Oh... that is very cool... thanks!
  6. I was running through a test script that was working fine, and it fails to enter text into a control suddenly. Weird... since it was working last night... I pull up WinInfo and check the control, to find its INSTANCE NUMBER HAS CHANGED! I run the app as a user, and follow aong with WinInfo... sure enough, depending on which way I bring my windows up, my instances CHANGE... making my script completely unreliable. Two questions: 1) Am I crazy? Or have others seen this behavior? 2) Does anyone have a work-around? I was thinking that I could do a mouse click at the control's position, and grab the ID, and then use it instead of the CLASS and INSTANCE... but there seems to be no way of doing this... So, am I stuck with just using mouse-clicks and SENDS() followed by mouse clicks, right mouse click, select all, copy? (Yuck!)
  7. Hey John, Thanks for the post... a couple of things... Is there are reason for all of the calls to: [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] You call it ten times in your example... but an import is an import... no? Maybe adding that line once should be sufficient...? Also, it would be helpful if you could flesh out your example more.... maybe give the code snippet in a console app, so people can see how you are using it? FWIW: I also found this on the net, and it was pretty useful as well, to anyone looking to use AutoIt in C#. It just uses a reference and code, which would create the problem that John described earlier, in that AutoIt registers itself when it installs. http://dau.shynd.com/forum/index.php?showt...d&pid=12922 I list it because there seems to be very little love for C# on the forum here ;-)
  8. Yeah, but I want to be bullet proof in case my user does something unpredictable... Anyway, I have a kludge that works. Bascially, I call Pidgin, and then sleep, and call it again. This seems to work OK... so I'm good for now. Thanks for the advice! if WinExists("Buddy List") Then Run("C:\Program Files\Pidgin\Pidgin.exe") WinActivate("Buddy List") WinWaitActive("Buddy List") Else ;********* ; This doesn't work if Pidgin is minimize to tray! ;************************************************* Run("C:\Program Files\Pidgin\Pidgin.exe") WinActivate("Buddy List") Sleep(2000) Run("C:\Program Files\Pidgin\Pidgin.exe") Sleep(1000) EndIf
  9. Richard (or anyone), I was wondering how well you know Pidgin... I have it working, but a preference option will kill the script (and I hate that). Pidgin has a setting in preferences called: "Show System Tray Icon" If it is set to "ALWAYS" then when you first kick off Pidgin, it is minimized to the system tray. None of the calls I make (ie WinActivate) seem to work. Strangely, if it is already running and minimized, then everything is fine. The First call to Pidgin will make it the active window, and everything works from there. But, if I kick off the new Pidgin session, then it will NOT activate the window, and I am screwed. So, I can either make sure that the option to start as a System tray is turned off, or I can always make sure Pidgin is running before my script is called, but I would rather have the system be more bullet-proof than that. Here is my script (Again, the code setting the $ContactName variable has to be someone in your list): Any ideas? If $CmdLine[0] = 0 Then $ContactName = "markjoel60@MYEMAIL.COM{ENTER}" Else $ContactName = $CmdLine[1] & "{ENTER}" EndIf if WinExists("Buddy List") Then Run("C:\Program Files\Pidgin\Pidgin.exe") WinActivate("Buddy List") WinWaitActive("Buddy List") Else ;********* ; This doesn't work if Pidgin is minimize to tray! ;************************************************* Run("C:\Program Files\Pidgin\Pidgin.exe") WinActivate("Buddy List") ; WinWaitActive("Buddy List") Sleep(2000) EndIf $size = WinGetPos("[active]") MouseClick("Left", $size[0] + 35, $size[1] + 39) ; hit buddies drop down list MouseClick("Left", $size[0] + 71, $size[1] + 64) ; hit Send IM option Send($ContactName) $CNLen = StringLen($ContactName) $CNLen -= 7 ; get rid of the {ENTER} suffix $winName = StringLeft($ContactName, $CNLen) WinWaitActive($winName) Send("Message from AutoIt{ENTER}") Send("{ESCAPE}") MouseClick("Left", $size[0] + 241, $size[1] + 18)
  10. OK.. thanks for the advice... I guess I'll go that route then...
  11. Hey, thanks for the replies... Well, what I am trying to do is set up an automated program that runs different tests and things and if it hits an event, it messages me (or someone else if they want). I want to be able to push the message out to a handheld device. There aren't many choices on those things for messaging software. You have AIM, Yahoo (maybe) Skype and Google. Ideally, the routine could send it to any of them. The reason I wanted to use GoogleTalk was I was testing on a Nokia 810N, and it has GoogleTalk. The box says it has Skype, but it doesn't ... long story. I found a program called Pidgeon, and it will send messages to GoogleTalk. But I was hoping my routine would be versatile enouh to use virtually any chat software for the alerts. The TCP messages sound like a good idea, but I think I need to be able to install software on the handheld then, right? I don' think I have access to the handhelds for that... The thing is that my problem seems to be in Auto It, not Google. I could be wrong. But it seems like something weird is happening during the Auto It Sleep() function.... I guess from what I'm hearing thoguh, I'd be better off using Pidgeon than GoogleTalk to send, eh?
  12. Hello All. I am creating a little script that will fire and alert me, using my GoogleTalk Chat. I got something to work, but I had to do a really strange kludge, and I am wondering if someone has a better way of doing this. So, I want to login to GoogleTalk, and send a message to myself. But, Google Talk has no buttons or control codes to initiate a chat. The only way I can see to do it is search for a contact. The problem is that there is a lag until GoogleTalk is active (while it logs in). Waiting until Active on the window does not work, since the window is ACTIVE, it's just the server is busy. I even search the screen text for information (which you can see in the script) but this is apparently active before the log-in is complete, so that doesn't help. I thought to put a sleep command in, but when I do that, GoogleTalk sleeps as well! It takes a mouse click to start things back up again. So, I sleep, then move the mouse into the GoogleTalk Window, and then click, and this works -- 99% of the time. Anyone have any ideas? (BTW, you can see the strangeness I am talking about it you comment out the line right after Sleep(3000) Here is the script. This assumes there is a person in your contacts whose name can be found by using the string: "Mark". Run("C:\Program Files\Google\Google Talk\googletalk.exe") WinWaitActive("Google") $loggedIn = False AutoItSetOption("WinDetectHiddenText", 1) $location = 0 while $loggedIn == false $res = WinGetText("Google") $location = StringInStr($res, "Search All Contacts",0) if $location > 0 Then $loggedIn = True EndIf WEnd Sleep(3000) MouseClick("left",1175,388) ControlSend("Google", "", "[CLASS:RichEdit20W; INSTANCE:3]", "Mark{ENTER}") ;WinWaitActive("Mark") Send("Message from AutoIt{ENTER}")
×
×
  • Create New...