Login | |
|
 |
RE: What language is best for my goal? - 9/26/2005 11:44:53 PM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
As scripting languages go, you might want to look at AutoIT for this. Not only, IMO, is the sendkeys better but you can also send mouse clicks and use a function called controlclick, at least that is what I think it is called. They also have the ability to get screen location fairly easily with AutoIT spy.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/27/2005 6:30:25 AM
|
|
 |
|
| |
Snipah
Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
Some languages are designed to support programming in the large, some are designed to facilitate rapid development of small. Some are for writing device drivers, some are for research and some are for games. If you have complex structures that you wish to model, it's a good idea to pick a language that models them well. Prototype classes (JScript) are quite different from inheritance classes (C / C++), which in turn are different from simple record classes (VBScript). Hope this helps.. Snipah
< Message edited by Snipah -- 9/27/2005 6:31:36 AM >
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/27/2005 12:53:18 PM
|
|
 |
|
| |
OLELukoE
Posts: 9
Score: 0
Joined: 9/26/2005
Status: offline
|
I don't yet know much about the scripting languages and in particular what each of them is best for, so I'm looking for specific advice on what language to use and why. I'll be more concrete about what the script does, what I meant by "analyze the graphics" was: Suppose the program in question shows me one of 5 little pictures: say, parrot, dog, dolphin, elephant, and frog. I know exactly where in the program's window these pictures are displayed and there are only 5 possible pictures. My script needs to determine which animal is being shown (by, for example, taking the color of N pixels, with N around 5, i.e. large enough so that the colors uniquely determine the picture) and depending on the result click on one of several buttons in the program's window. Then the whole process repeats. Are all the required commands easily found in one or more of the scripting languages and/or C++? Also, as the next step, in actuality my script won't be able to decide which button to click on its own, but I have a program (call it Decider to distinguish it from the original program that i'm trying to control) that determines the button to click once it knows what animal is shown, so I want my script to determine the animal, then tell it to Decider, after which Decider would tell the script which button to click. So somehow the script needs to pass small amounts of information to the Decider and back (maybe through the clipboard, though I'm sure there's a better solution). At this level of complexity, are all the required commands readily available in one or more of the scripting languages and/or C++? Which one would you use and how would you pass the info back and forth between the script and Decider?
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/27/2005 8:21:13 PM
|
|
 |
|
| |
TNO
Posts: 1036
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Too much info for me I think... So is this what you are generally trying to do? - Show 1 of 5 pictures at a time (At random)
- determine which animal is being shown (Does it matter how this is determined?)
- depending on the result click on one of several buttons in the program's window (click a button? or just send a result somewhere)
- Repeat
I believe any COM language able to use the DOM (Document Object Model) can accomplish the task. I suggest for a beginner to use VBScript due to its intuitive ease of use. JavaScript is also a good choice (A personal favorite)
_____________________________
Consolidated Script Component: The Acid Test A universe of complexity...
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/27/2005 11:19:32 PM
|
|
 |
|
| |
TNO
Posts: 1036
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
I'm having trouble trying to figure out WHY you need to get the color of some pixels.....You can determine a picture by ALOT simpler means. Do you NEED to know the color of the pixels?
_____________________________
Consolidated Script Component: The Acid Test A universe of complexity...
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/28/2005 8:06:59 AM
|
|
 |
|
| |
Snipah
Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
Could you make a decision after knowing the source of the image e.g. If imgRndNumb.src = "C:\img\somewhat_annoying_elephant.jpg" Then Decider.NukeIT() (got a little carried away, but you get the picture ... euhm point ... -lol-)
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/28/2005 9:09:36 AM
|
|
 |
|
| |
OLELukoE
Posts: 9
Score: 0
Joined: 9/26/2005
Status: offline
|
Good point! I am sure the program keeps these images in separate picture files somewhere. Though, being the object-oriented programming virgin that I am, I have but a vague idea how this would work in principle. To my understanding, the window contains a bunch of objects, corresponding to all the buttons, images, etc. it displays. So my script would have to get a list of all the objects, then search for the one corresponding to the displayed picture, then get its source. Am I on the right track? I guess it still would be desirable to learn to get colors of pixels, in case, say, some of the images the program generates are not stored anywhere (like maybe it displays a letter of a specific font or something like that); or in case the program in question runs on a remote website. To that end, I've discovered that AutoIT has a function that gives me the color of the pixels. But I don't want to write the whole script on AutoIT, ideally I'd have Decider and Script as two parts of the same program, so ideally everything would be written in C++, but I'd make use of some functions from AutoIT and/or other scripting languages. Is that at all possible? To my understanding, if AutoIT has dll's, then a C++ program can use functions from these dll's. Is this right? P.S. For some strange reason, the banana on my computer has stopped moving thus becoming less annoying, while the elephant is still going at it...
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/28/2005 9:22:03 AM
|
|
 |
|
| |
TNO
Posts: 1036
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
I'll see what I can figure out......
_____________________________
Consolidated Script Component: The Acid Test A universe of complexity...
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/28/2005 4:54:17 PM
|
|
 |
|
| |
Snipah
Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
Look at some applications that are made for blind people, those are mostly object-oriented... And they have to read alotta info from the screen aswell.... PS, moved his thread to a more appropiate place...Scripting Discussions
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/29/2005 9:41:32 PM
|
|
 |
|
| |
TNO
Posts: 1036
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
when you click the button(s) what do they do?
_____________________________
Consolidated Script Component: The Acid Test A universe of complexity...
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/29/2005 10:10:48 PM
|
|
 |
|
| |
Snipah
Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
I habe found some C# .NET source code to get the color of the pixel: Visual C#.NET Source Code { ImageFileName = System.Web.HttpContext.Current.Server.MapPath(ImageFileName); oImage = new Bitmap(System.Drawing.Image.FromFile(ImageFileName)); y = oImage.Height; x = oImage.Width; string[,] ImagePixels = new string[y,x]; for(int h = 0; h < y; h++) { for(int w = 0; w < x; w++) { pixelColor = oImage.GetPixel(h,w); ImagePixels[h,w] = pixelColor.R.ToString() + "." + pixelColor.G.ToString() + "." + pixelColor.B.ToString(); } }
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: What language is best for my goal? - 9/29/2005 10:50:10 PM
|
|
 |
|
| |
TNO
Posts: 1036
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Thanks but I don't see the point of evaluating pixels to determine a picture, nor do i see a reason to use the mouse to automate button clicking when a simple function/event could suffice.
_____________________________
Consolidated Script Component: The Acid Test A universe of complexity...
|
|
| |
|
|
|
|
|