#148552 - 2005-09-27 12:46 PM
Which scripting language is best for my task?
|
OLELukoE
Fresh Scripter
Registered: 2005-09-27
Posts: 13
|
Ok, I am a scripting virgin. I need to write a script of what I believe to be medium complexity. I just read about Kixtart, VBS, WSH, Autoit, etc. I am wondering what are their relative advantages/drawbacks in general and for my specific task.
The script I need to write has to do the following: analyze the graphics displayed by a specific program and based on this click on various buttons in that program, then analyze the graphics again, etc.
Any thougths on which language to use would be greatly appreciated. Also, would it be completely insane to not use any of the scripting languages, but C++ instead? Since I've never written any scripts I don't know how much easier the scripting languages my it compared to C++.
|
Top
|
|
|
|
#148555 - 2005-09-27 09:41 PM
Re: Which scripting language is best for my task?
|
OLELukoE
Fresh Scripter
Registered: 2005-09-27
Posts: 13
|
Thanks! I'm still wondering how much harder (say in terms of required time) the task would be if I were to do in on C++ rather than on one of the scripting languages. My thinking is that if C++ also has commands to move the mouse and simulate mouse clicks and key strokes, wouldn't there be almost no difference if I used C++ or a scripting language?
|
Top
|
|
|
|
#148558 - 2005-09-27 11:46 PM
Re: Which scripting language is best for my task?
|
iffy
Starting to like KiXtart
Registered: 2005-05-29
Posts: 149
Loc: The Netherlands
|
What do you mean exactly with "analyze the graphics"? The rest sounds relatively simple but graphics recognition of any kind very quickly becomes advanced rocket science.
|
Top
|
|
|
|
#148560 - 2005-09-28 12:44 AM
Re: Which scripting language is best for my task?
|
iffy
Starting to like KiXtart
Registered: 2005-05-29
Posts: 149
Loc: The Netherlands
|
Like in looking at object handles and poking into the message queue? Hmm, that's doable. I guess you know CMDOW? Neat tool, an imaginative mind with enough admin rights can wreak havoc on a co-workers puter with that, not that I would know anything about that of course .
|
Top
|
|
|
|
#148561 - 2005-09-28 03:54 AM
Re: Which scripting language is best for my task?
|
OLELukoE
Fresh Scripter
Registered: 2005-09-27
Posts: 13
|
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. Would I need to "kludge together an assortment of external utilities" for that or are all the required commands easily found in one or more of the scripting languages?
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. At this level of complexity, are all the required commands readily available in one or more of the scripting languages? Which one would you use?
|
Top
|
|
|
|
#148563 - 2005-09-28 07:21 AM
Re: Which scripting language is best for my task?
|
OLELukoE
Fresh Scripter
Registered: 2005-09-27
Posts: 13
|
So there's no function that, given the coordinates, gives me the color of the pixel at these coordinates? Cuz that's all I really need to analyze the graphics
|
Top
|
|
|
|
#148565 - 2005-09-28 10:45 AM
Re: Which scripting language is best for my task?
|
OLELukoE
Fresh Scripter
Registered: 2005-09-27
Posts: 13
|
Hmmm... I found such a function in Autoit. I guess I'll need to go with Autoit then. Though still feels strange that such a simple-sounding function doesn't exist in Kix.
I still have a question about something Bryce said: "if autoit can do a screen sample, COM object control would let you use the scripting engine of your choice." What does this mean? I don't really know what a COM object control is, but it sounds like I can use Kix while "borrowing" a function from Autoit. Is this right?
|
Top
|
|
|
|
#148566 - 2005-09-28 11:08 AM
Re: Which scripting language is best for my task?
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
So there's no function that, given the coordinates, gives me the color of the pixel at these coordinates? Cuz that's all I really need to analyze the graphics
Not in KiXtart. However, the AutoIT control *does* allow you to examine the colour of the pixel under the cursor. It also allows you to determine the X/Y co-ordintate of the mouse relative to the window, which is usually more useful.
You can control the AutoIT object from KiXtart, which makes it pretty powerful.
Java / JavaScript will also allow you to do all this as well and might be more suitable depending on what you intend to do with it.
The problem is that the languages get harder to learn and use as you get more features, so you really need to decide what your ultimate goal is and then decide on which language is appropriate.
Here is a broad summary of the differences taking KiXtart, Java and C++ as examples - it's a quick list off the top of my head, and I'm sure we'll hear other opinions 
- KiXtart - Very easy to learn and code, very quick to produce working code, smaller source code, non-portable, less built-in functionality, slowest execution time, not suitable for general purpose programming, not a highly desired skill for employers.
- Java/JavaScript - Moderately difficult to learn, working code takes longer to produce, requires more source code for the same tasks as KiXtart, highly portable, more functionality, generally runs faster than KiXtart, is used for general purpose programming, desired skill for employers though possibly in niche markets.
- C/C++ - Very steep learning curve, large amounts of code required for the same tasks as KiXtart, takes much longer to produce working code and debug it, can be ported with a bit of effort, can perform just about any coding task you can think of with it, fastest execution time, highly desirable skill for employers.
I'd probably put VB on a par with C++ - it's easier to learn but my experience is that you can end up with a large amount of code whose only purpose is to support or circumvent some of the features of the language rather than doing anything useful.
|
Top
|
|
|
|
#148567 - 2005-09-28 11:12 AM
Re: Which scripting language is best for my task?
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
Though still feels strange that such a simple-sounding function doesn't exist in Kix
That's because KiXtart is a console based scripting language. It doesn't know anything about Windows, mice, graphics or the like. If you want to get access to these you need to use external libraries which provide the functionality via "automation" objects.
Quote:
but it sounds like I can use Kix while "borrowing" a function from Autoit. Is this right?
Yes.
|
Top
|
|
|
|
#148568 - 2005-09-28 12:41 PM
Re: Which scripting language is best for my task?
|
OLELukoE
Fresh Scripter
Registered: 2005-09-27
Posts: 13
|
Quote:
Quote:
Though still feels strange that such a simple-sounding function doesn't exist in Kix
That's because KiXtart is a console based scripting language. It doesn't know anything about Windows, mice, graphics or the like. If you want to get access to these you need to use external libraries which provide the functionality via "automation" objects.
I see. What is the best place to find these libraries along with a description of the functions they contain? Also, is the "get color of pixel" a standard function in one of these libraries? If so, which one?
Edited by OLELukoE (2005-09-28 12:43 PM)
|
Top
|
|
|
|
#148570 - 2005-09-28 03:38 PM
Re: Which scripting language is best for my task?
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
using autoitx com objects in kix to get the pixel color
Code:
;the color pf the pixel at 10,100 is.... $oAutoIt = CreateObject("AutoItX3.Control") $var = $oAutoIt.PixelGetColor(10,100) ? "The color is" + $var
Bryce
|
Top
|
|
|
|
#148571 - 2005-09-28 10:07 PM
Re: Which scripting language is best for my task?
|
OLELukoE
Fresh Scripter
Registered: 2005-09-27
Posts: 13
|
Thanks a lot! I am now writing the script
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 323 anonymous users online.
|
|
|