OLELukoE
(Fresh Scripter)
2005-09-27 12:46 PM
Which scripting language is best for my task?

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++.


LonkeroAdministrator
(KiX Master Guru)
2005-09-27 03:32 PM
Re: Which scripting language is best for my task?

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.


Bryce
(KiX Supporter)
2005-09-27 06:38 PM
Re: Which scripting language is best for my task?

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.


OLELukoE
(Fresh Scripter)
2005-09-27 09:41 PM
Re: Which scripting language is best for my task?

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?

Les
(KiX Master)
2005-09-27 09:53 PM
Re: Which scripting language is best for my task?

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.

LonkeroAdministrator
(KiX Master Guru)
2005-09-27 10:47 PM
Re: Which scripting language is best for my task?

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.


iffy
(Starting to like KiXtart)
2005-09-27 11:46 PM
Re: Which scripting language is best for my task?

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.

LonkeroAdministrator
(KiX Master Guru)
2005-09-27 11:49 PM
Re: Which scripting language is best for my task?

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.


iffy
(Starting to like KiXtart)
2005-09-28 12:44 AM
Re: Which scripting language is best for my task?

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 .

OLELukoE
(Fresh Scripter)
2005-09-28 03:54 AM
Re: Which scripting language is best for my task?

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?


LonkeroAdministrator
(KiX Master Guru)
2005-09-28 04:07 AM
Re: Which scripting language is best for my task?

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.


OLELukoE
(Fresh Scripter)
2005-09-28 07:21 AM
Re: Which scripting language is best for my task?

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

Mart
(KiX Supporter)
2005-09-28 09:37 AM
Re: Which scripting language is best for my task?

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.


OLELukoE
(Fresh Scripter)
2005-09-28 10:45 AM
Re: Which scripting language is best for my task?

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?


Richard H.Administrator
(KiX Supporter)
2005-09-28 11:08 AM
Re: Which scripting language is best for my task?

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.


Richard H.Administrator
(KiX Supporter)
2005-09-28 11:12 AM
Re: Which scripting language is best for my task?

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.


OLELukoE
(Fresh Scripter)
2005-09-28 12:41 PM
Re: Which scripting language is best for my task?

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?


Richard H.Administrator
(KiX Supporter)
2005-09-28 03:12 PM
Re: Which scripting language is best for my task?

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.


Bryce
(KiX Supporter)
2005-09-28 03:38 PM
Re: Which scripting language is best for my task?

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


OLELukoE
(Fresh Scripter)
2005-09-28 10:07 PM
Re: Which scripting language is best for my task?

Thanks a lot! I am now writing the script

OLELukoE
(Fresh Scripter)
2005-09-29 12:35 AM
Re: Which scripting language is best for my task?

I had another thought: if Autoit has a library AutoitX3.dll, can I use the functions from this library not just in Kix, but say in C++? I'm sure it's a silly question, I just haven't done any programming under Windows yet. If I can use AutoIt functions in C++, that would be ideal, because then I could essentially write the whole program (Decider+Script) in C++.

ShawnAdministrator
(KiX Supporter)
2005-09-29 01:50 AM
Re: Which scripting language is best for my task?

Yes you can, but it aint pretty. You say you never programmed in C++ under Windows ?

NTDOCAdministrator
(KiX Master)
2005-09-29 01:51 AM
Re: Which scripting language is best for my task?

I'm telling ya Assembler is the way to go. You'll have full control of anything you want.

http://nasm.sourceforge.net

http://eji.com/a86/

http://info.borland.com/borlandcpp/cppcomp/tasmfact.html

http://www.masm32.com/
http://www.masm32.com/masmmyth.htm

Microsoft Assembler 6.14 patch
http://support.microsoft.com/kb/228454/
NOTE:
MASM 6.11 is no longer available as a retail product. MASM 6.11 is included with some levels of the Microsoft Developer Network (MSDN). You can order MSDN by contacting Microsoft Sales and Service at 1-800-426-9400.


Richard H.Administrator
(KiX Supporter)
2005-09-29 09:50 AM
Re: Which scripting language is best for my task?

Quote:

I'm telling ya Assembler is the way to go. You'll have full control of anything you want




I started to think about handling objects in assembler and the distress caused me to pass out.

It's bad enough in C, but assembler? Nurse!


NTDOCAdministrator
(KiX Master)
2005-09-29 11:30 AM
Re: Which scripting language is best for my task?

Not sure if Ruud still does any portions of KiXtart with Assembler any more, but he used to.

LonkeroAdministrator
(KiX Master Guru)
2005-09-29 12:14 PM
Re: Which scripting language is best for my task?

maybe not.
all we know that part of kixtart code is/was done with assembler.
who did it or which part is in question, we can't know.


OLELukoE
(Fresh Scripter)
2005-09-30 12:16 PM
Re: Which scripting language is best for my task?

Quote:

I had another thought: if Autoit has a library AutoitX3.dll, can I use the functions from this library not just in Kix, but say in C++? I'm sure it's a silly question, I just haven't done any programming under Windows yet. If I can use AutoIt functions in C++, that would be ideal, because then I could essentially write the whole program (Decider+Script) in C++.




So what would you say is easier: use AutoIt (or Kixstart) functions in C++ or write my own functions for getting the color of pixels, moving the mouse, etc. in C++? Or maybe there's some other way to integrate an AutoIt/Kixstart script and a C++ program (which I called Decider earlier) that I'm overlooking?


Richard H.Administrator
(KiX Supporter)
2005-09-30 02:15 PM
Re: Which scripting language is best for my task?

How much effort do you want to put into this?

KiXtart + AutoIT is easy to get into and start scripting. You could have something up and running inside a few hours.

C++ has a very high learning curve. If you don't already know C++ or another object oriented language it is going to be days before you have even the basics of your project working, and debugging / enhancing it will take longer.

On the other hand, KiXtart cannot perform all the tasks that C++ can. It simply doesn't have the ability to handle certain data types or call the same APIs that C++ can.

To select the right language you must start by determining your final goal.

If your project is as simple as reading a graphical object, detecting a mouse click then clicking on a button then KiXtart + AutoIT will be fine.


OLELukoE
(Fresh Scripter)
2005-09-30 09:58 PM
Re: Which scripting language is best for my task?

Let's assume that I have to use C++ in any case - for writing the algorithm that decides which button to click. The only question now is which option is easier:
1. Somehow figure out how to call the AutoIT functions (for getting pixels and moving the mouse) from the C++ program
2. Somehow figure out how to call the C++ program from the AutoIT/Kixtart script.
3. Write everything in C++


LonkeroAdministrator
(KiX Master Guru)
2005-09-30 10:56 PM
Re: Which scripting language is best for my task?

2) you can call your c++ program from kixtart by just:
shell "myprogram"

there is nothing really to figure.


OLELukoE
(Fresh Scripter)
2005-10-01 03:46 AM
Re: Which scripting language is best for my task?

I should have been more clear in my description of option 2: Because the process is cyclic (determine picture -> decide which button (using algorithm written in C++)-> click the button -> determine picture -> etc.), I don't want to keep calling the program from hard disk. Script and Decider should both be running and somehow communicating, that's what option 2 entails. So back to the question: which option is better?

NTDOCAdministrator
(KiX Master)
2005-10-01 07:55 AM
Re: Which scripting language is best for my task?

Well if you can do this other part in C++ then I see no need to use KiXtart Scripting. When the selection is made you can easily have C++ do whatever else it is you're wanting to do.

OLELukoE
(Fresh Scripter)
2005-10-01 10:22 AM
Re: Which scripting language is best for my task?

Do you mean I can easily have C++ figure out the colors of the pixels and move the mouse?

NTDOCAdministrator
(KiX Master)
2005-10-01 10:57 AM
Re: Which scripting language is best for my task?

Not saying it would be easy, I'm saying that IF you can program the other part in C++ then doing anything else should be easy to do as well.

However, if you have no experience with programming then writing what you want on your own will NOT be easy. Using a mixture of Autoit and KiXtart as explained will probably be your only real chance at this point in time until some point in time when you learn how to do it in C++

VB or C# might be able to do it as well and I think they would have a less steep learning curve as compared to C++


Sealeopard
(KiX Master)
2005-10-01 04:39 PM
Re: Which scripting language is best for my task?

I'm really curious what the underlying purpose it to write this script/task? It's sounds like trying to automate a task that was more or less deliberately set up to require manual intervention?

OLELukoE
(Fresh Scripter)
2005-10-01 10:04 PM
Re: Which scripting language is best for my task?

This is actually a business idea, that's why I've been somewhat secretive about the exact purpose of the program. But if it works out, I'll let you guys know

Les
(KiX Master)
2005-10-02 02:47 AM
Re: Which scripting language is best for my task?

Well then KiX might not be your best route unless you work out a licensing deal with Ruud.