Page 1 of 2 12>
Topic Options
#148552 - 2005-09-27 12:46 PM Which scripting language is best for my task?
OLELukoE Offline
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
#148553 - 2005-09-27 03:32 PM Re: Which scripting language is best for my task?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, you can accomplish the goal with any scripting language (at least almost)

the issue usually is how you feel using the language.

if you search the board, you will see that this question has been asked and discussed many times.

imho, kixtart beats the competition by simplicity and good support.

now, if you are gonna do some automation of GUI stuff, you probably will end up doing it with AutoIt as it's the solution geared most for smooth control of GUI.

but like said, it's always about personal opinion.
_________________________
!

download KiXnet

Top
#148554 - 2005-09-27 06:38 PM Re: Which scripting language is best for my task?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Wow, that is a tall order that you have there...

I think that autoit has the ability to sample screen x/y cords and return the color of the pixels.. or I think it does.

And there are other scriptable programs out there made to do just this type of automation, but most of these are used for automated gamming bot's (google for actool).

if autoit can do a screen sample, COM object control would let you use the scripting engine of your choice.

Top
#148555 - 2005-09-27 09:41 PM Re: Which scripting language is best for my task?
OLELukoE Offline
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
#148556 - 2005-09-27 09:53 PM Re: Which scripting language is best for my task?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Doing it in KiX or any other scripting language would require that you kludge together an assortment of external utilities. Do it in C++ if you are proficient at it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#148557 - 2005-09-27 10:47 PM Re: Which scripting language is best for my task?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there are no commands in c++ to do such things.
you may use additional libraries to accomplish similar task but to get even there will take some time.

with scripting languages, you are ready to rock almost from the first second.
_________________________
!

download KiXnet

Top
#148558 - 2005-09-27 11:46 PM Re: Which scripting language is best for my task?
iffy Offline
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
#148559 - 2005-09-27 11:49 PM Re: Which scripting language is best for my task?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
iffy, I thought about that too.
in order to make his question possible for single lifetime, I guessed he ment control stuff.
just like autoIt or kixtart does.

well...
dunno, they don't actually recognize the graphics but play along.
_________________________
!

download KiXnet

Top
#148560 - 2005-09-28 12:44 AM Re: Which scripting language is best for my task?
iffy Offline
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 Offline
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
#148562 - 2005-09-28 04:07 AM Re: Which scripting language is best for my task?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
w0w.
so you really need an analyzer.

hmm...
so, basically, shawn, is there screeen capture in kf?
it's been too long I last played with kf2 so can't be sure.

what you basically could get along with is a screen capture (print screen) and clipboard to picturebox drop.
does kf support drop on picturebox?

with these two "little things" it indeed is doable.

I just don't know any scripting language that can do this without anything added.
_________________________
!

download KiXnet

Top
#148563 - 2005-09-28 07:21 AM Re: Which scripting language is best for my task?
OLELukoE Offline
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
#148564 - 2005-09-28 09:37 AM Re: Which scripting language is best for my task?
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Not in kix.
Would be nice but afaik you would have to build your own thingy for this.

I guess "medium complexity" was sort of an understatement in your first post.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#148565 - 2005-09-28 10:45 AM Re: Which scripting language is best for my task?
OLELukoE Offline
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 Offline
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 Offline
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 Offline
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
#148569 - 2005-09-28 03:12 PM Re: Which scripting language is best for my task?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
AutoIT contains such a library - it is the AutoItX3.dll.

Follow the instructions in the AutoItX.chm help file for registering the DLL. Once you've done that all the functionality which is documented in the AutoItX.chm is available to your KiXtart script.

Top
#148570 - 2005-09-28 03:38 PM Re: Which scripting language is best for my task?
Bryce Offline
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 Offline
Fresh Scripter

Registered: 2005-09-27
Posts: 13
Thanks a lot! I am now writing the script
Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.188 seconds in which 0.117 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org