Jump to content

Real programming language to re-write my autoit script in?


Recommended Posts

Hi, I have this autoit script that I want to use on my WindowsCE.NET PDA, so I need to need to re-write it in a programing lanugage that uses .NET framework.

Can anyone tell me how hard that would be judging by the autoit code below? And what language would be easiest (visual c++.net, vb.net or c#.net I guess?)? It is a simple script that sends commands to a remote pc (that then changes channels on my tv tuner that is streaming content through network). The remote script does not need to be re-written, I hope to create a new program that can communicate with it.

;----------------------------------------------------------------------------
; Network channel changer
;----------------------------------------------------------------------------

#include <GUIConstants.au3>

Global $ini_name =      "remotesettings.ini"
Global $ini_path =      @WorkingDir + $ini_name
Global $r_ip =          IniRead($ini_path, "Remote","IP","NotFound")
Global $r_port =        IniRead($ini_path, "Remote","Port","NotFound")

Opt("GUIOnEventMode", 1)
Opt("SendKeyDelay", 1000)
Opt("ColorMode", 0)

$MainForm =     GUICreate("Network Remote", 210, 210, -1, -1)
                GUISetOnEvent($GUI_EVENT_CLOSE, "MainFormClose")
                GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainFormMinimize")
                GUISetOnEvent($GUI_EVENT_MAXIMIZE, "MainFormMaximize")
                GUISetOnEvent($GUI_EVENT_RESTORE, "MainFormRestore")

$Label1 =       GUICtrlCreateLabel("PROG", 160, 50, 40, 10, BitOR($SS_CENTER,$SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Label2 =       GUICtrlCreateLabel("VOL", 160, 150, 40, 10, BitOR($SS_CENTER,$SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

$Button1 =      GUICtrlCreateButton("1", 10, 10, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 =      GUICtrlCreateButton("2", 60, 10, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button2Click")
$Button3 =      GUICtrlCreateButton("3", 110, 10, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button3Click")
                
$Button4 =      GUICtrlCreateButton("4", 10, 60, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button4Click")
$Button5 =      GUICtrlCreateButton("5", 60, 60, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button5Click")
$Button6 =      GUICtrlCreateButton("6", 110, 60, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button6Click")
                
$Button7 =      GUICtrlCreateButton("7", 10, 110, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button7Click")
$Button8 =      GUICtrlCreateButton("8", 60, 110, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button8Click")
$Button9 =      GUICtrlCreateButton("9", 110, 110, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button9Click")

$Power =        GUICtrlCreateButton("Power", 10, 160, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "PowerClick")
$Button0 =      GUICtrlCreateButton("0", 60, 160, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "Button0Click")
$Mute =         GUICtrlCreateButton("Mute", 110, 160, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "MuteClick")

$ChannelUp =    GUICtrlCreateButton("+", 160, 10, 40, 40, 0)
                GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
                GUICtrlSetOnEvent(-1, "ChannelUpClick")
$ChannelDown =  GUICtrlCreateButton("-", 160, 60, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "ChannelDownClick")

$VolumeUp =     GUICtrlCreateButton("+", 160, 110, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "VolumeUpClick")
$VolumeDown =   GUICtrlCreateButton("-", 160, 160, 40, 40, 0)
                GUICtrlSetOnEvent(-1, "VolumeDownClick")

GUISetState(@SW_SHOW)

Main()

Func Main()
;Starts TCP services
    TCPStartup()
    
;If there is an error show it
    If @error Then
        MsgBox(1,"Error", @error)
    EndIf
    
    While 1
        Sleep(100)
    WEnd
EndFunc



;----------------------------------------------------------------------------
; Function to send connect to remote then command and disconnect
;----------------------------------------------------------------------------

Func SendCommand(Const $buttonselect)
    Local $r_socket
    Local $command
    
;MsgBox(0,"DEBUG",$buttonselect)
    
;Connect to remote
    $r_socket = TCPConnect($r_ip, $r_port)
    
;If fail to connect then return
    If $r_socket = -1 Then
        MsgBox(0, "Error", "Failed to connect")
        Return
    EndIf

;Create command
    $command = "SC" + $buttonselect
    
    MsgBox(0,"DEBUG",$command)
    
;Send command
    TCPSend($r_socket, $command)
;If there is an error show it
    If @error Then
        MsgBox(1,"Error", @error)
    EndIf

;Close socket after sending command
    TCPCloseSocket($r_socket)
EndFunc

;----------------------------------------------------------------------------
; Functions to handle clicks on buttons
;----------------------------------------------------------------------------

Func Button0Click()
    SendCommand("0")
EndFunc

Func Button1Click()
    SendCommand("1")
EndFunc

Func Button2Click()
    SendCommand("2")
EndFunc

Func Button3Click()
    SendCommand("3")
EndFunc

Func Button4Click()
    SendCommand("4")
EndFunc

Func Button5Click()
    SendCommand("5")
EndFunc

Func Button6Click()
    SendCommand("6")
EndFunc

Func Button7Click()
    SendCommand("7")
EndFunc

Func Button8Click()
    SendCommand("8")
EndFunc

Func Button9Click()
    SendCommand("9")
EndFunc

Func ChannelDownClick()
    SendCommand("CD")
EndFunc

Func ChannelUpClick()
    SendCommand("CU")
EndFunc

Func VolumeDownClick()
    SendCommand("VD")
EndFunc

Func VolumeUpClick()
    SendCommand("VU")
EndFunc

Func MuteClick()
    SendCommand("M")
EndFunc

Func PowerClick()
    SendCommand("P")
EndFunc

;----------------------------------------------------------------------------
; Functions to handle clicks on window buttons
;----------------------------------------------------------------------------

Func MainFormClose()
;Stops TCP services
    TCPShutdown()
;If there is an error show it
    If @error Then
        MsgBox(1,"Error", @error)
    EndIf
    
    Exit
EndFunc

Func MainFormMaximize()
EndFunc

Func MainFormMinimize()
EndFunc

Func MainFormRestore()
EndFunc
Link to comment
Share on other sites

But Autoit is a real programming language. :whistle:

AutoIt is a scripting language.

And in any case can't be used on a "WindowsCE.NET PDA".

I would think something like vb.net would be the easiest/most similar to AutoIt from a learning/adaptability standpoint

Link to comment
Share on other sites

And in any case can't be used on a "WindowsCE.NET PDA".

I would think something like vb.net would be the easiest/most similar to AutoIt from a learning/adaptability standpoint

Thanks for your response ResNullius. I'll start looking for some vb.net tutorials.

For the rest of you

AutoIt v3 is a freeware BASIC-like scripting language...

Link to comment
Share on other sites

For the rest of you

Is is not a language for making scripts. So is C a language for creating what? binaries? :whistle: So C is a binary language rather then a programming language? ;)

The term of "scripting" is very loosely used IMO and does not describe accurately what AutoIt does. It is a term used by some people to try to divide what a imaginary "Real" language is which does not remotely correspond with the evolution of programming in general. A program does not need to be a binary to be recognized as a program else a lot of programs used in other areas of the computer age do not fit the program description then yet they are in fact programs.

I would look at FreeBasic with can do both basic and C code within the same source and compiles it into C. BCX is rather similar to the FreeBasic language and is also free for use. Not many other basic programming I would like to recommend.

:lmao:

Link to comment
Share on other sites

Is is not a language for making scripts. So is C a language for creating what? binaries? :whistle: So C is a binary language rather then a programming language? :P

The term of "scripting" is very loosely used IMO and does not describe accurately what AutoIt does. It is a term used by some people to try to divide what a imaginary "Real" language is which does not remotely correspond with the evolution of programming in general. A program does not need to be a binary to be recognized as a program else a lot of programs used in other areas of the computer age do not fit the program description then yet they are in fact programs.

I would look at FreeBasic with can do both basic and C code within the same source and compiles it into C. BCX is rather similar to the FreeBasic language and is also free for use. Not many other basic programming I would like to recommend.

:lmao:

I'm speculating here, 'cause I would generally take MHz's opinion over mine any day. But I think the definition has to do with what comes out. The output of 'compiling' an AutoIt script is just more reformatted text, which is then packed with the interpreter in the final .exe file. Nothing you type in the .au3 file becomes executable computer code, just text input to the interpreter at run time.

The output of a compiled C++ program could not be described that way. The AutoIt interpreter is written in a 'real' programming language, which is very different from the AutoIt scripting language.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

AutoIt is a freeware Microsoft Windows automation language. In its earliest release, the software was primarily intended to create automation scripts (sometimes called macros) for Microsoft Windows programs. Such scripts proved useful for "hands-free" completion of highly repetitive tasks, such as rolling out a large number of PCs with identical installation instructions.

With later releases, AutoIt evolved to include enhancements in both programming language design and overall functionality. This expanded the uses for Autoit, thus justifying comparison with other more established "general purpose" programming languages and scripting tools.

There are a few omissions in the AutoIt programming language that more experienced programmers may find limiting. AutoIt lacks (or has only limited support for) such features as: Namespaces; object-oriented programming; abstract data types; reference types; classes; and advanced graphics functions. Many of the omissions are by design.

Go Wikipedia!!!

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

According to my dictionary programming is simply a list of instructions in a programming language that tells a computer to perform a task which in my view pretty much sums up what AutoIT is designed to do.

That being the case I cannot see the relevance of arguing the finer points of whether AutoIT is a programming lanugage or not when the real issues that have to be understood and resolved before chosing any delivery methodology which has commercial focus is: (some not all and in no particular order of importance)

1 On going support and assistance covering the language and/or application

2 Future development of the language and or application

3 Commercial acceptance of the language (is it an orphan?)

4 Longevity of the language or application

5 Environment of the intended end user (Unix, Microsoft, Apple etc)

6 Cost to get in and the cost to stay in (licencing, maintenance, upgrades and support - to name a few)

7 Licencing (Seats or Sites)

8 Developer/owner leverage (employer/employee)

9 The evolving environment (new technologies, hardware and software etc)

10 Availability of suitably qualified expertise (development)

From my perspective AutoIT is an language which is simply brilliant at developing proof of concept solutions (something you can see and touch) however in the commercial world my guess is that the end users would want my ideas delivered in a universally accepted format which enjoys a high level of commercial status (acceptance).

If I was to hang my hat on converting some of my idea's (and was required so to do) then I would probably go for a Microsoft solution like .Net and perhaps C++ (or in combination) but I would let the end user drive that issue.

Cheers

Ant..

Link to comment
Share on other sites

Thanks for your response ResNullius. I'll start looking for some vb.net tutorials.

You might also want to check out http://www.rebol.com/platforms-core.html. Free for personal use.

I haven't tried it yet, but just came across a blurb on it while reading my latest copy of "Smartphone and Pocket PC" mag.

To quote a user:

This interpreted language consists of incredibly easy syntax, a relatively small binary runtime, support for all major Internet communication protocols, and a dedicated user community. While the site lists Windows CE 2.0 as its most recent Windows Mobile conversion, this version runs perfectly well on my Pocket PC.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...