Page 1 of 1

AutoCom v1.0.0.1

Posted: 25 Jun 2011 04:52
by Cleptography
Built on Autoit3 and for cmd.exe. I will not post the details here as there is a thread in a couple of places for this project already, so just links. There is a lot to explore if you find any bugs let me know, most everything is documented. If you enter a command and it returns nothing that is because the command is not yet built into the current build. :shock:

Download AutoCom v1.0.0.1: (x32 x64)
http://www.scriptingpros.com/scripts/cleptography/

Project Homepage:
http://www.scriptingpros.com/viewtopic.php?f=153&t=94

Re: AutoCom v1.0.0.1

Posted: 25 Jun 2011 05:05
by allal
it gives the message autocom is not a valid 32 application
do you need auto it installed for it to work

Re: AutoCom v1.0.0.1

Posted: 25 Jun 2011 06:10
by orange_batch
I like this idea, so long as it has good performance (don't see why it wouldn't). Access to unique AutoIt commands/functions is cool. 8)

This is the type of innovation for the command line this place needs, rather than people saying to use a different language all the time. :roll:

Re: AutoCom v1.0.0.1

Posted: 25 Jun 2011 06:52
by Cleptography
allal wrote:it gives the message autocom is not a valid 32 application
do you need auto it installed for it to work


@allal Sorry about that was late and forgot to post the x32 :oops:
Should be good to go now both x64 and x32 are available.

@orange_batch Thanks for the positive feed very much appreciated.
This is just the start there is so much code and so many functions to build.
Working on the dll functions at the moment integrated with _OptParse au3 that
provides core functions for command line parsing of arguments into an array.
Dll calls from a batch script who would of thunk. :P

Re: AutoCom v1.0.0.1

Posted: 25 Jun 2011 10:47
by Cleptography
Looking for some ideas and input. So, in Autoit there are some commands that require the environment to be local to the au3 script to retain the function and command values, such as EnvGet, EnvSet. In keeping with the formula even though it is not needed as we can just use set var=value I still would like to include the Autoit commands as is and as many as there are, and still independent of an au3 script file. So, my first thought is to use a .ini file to hold the values for the commands that require au3 to be local when running those functions and commands. Does this seem like the cleanest way to do this? As Autoit can already read, and modify .ini files easily, or maybe storing the data in the registry (Don't really like that idea as the cmd would require admin rights in some cases) or is there another way?

Yes this is an Autoit question but it relates to cmd / batch because that's what AutoCom is being built for.
Any input from those familiar with Autoit is appreciated.

Re: AutoCom v1.0.0.1

Posted: 25 Jun 2011 11:11
by dbenham
I agree registry is not good - I don't have admin rights at work.

Dave Benham

Re: AutoCom v1.0.0.1

Posted: 26 Jun 2011 08:33
by Cleptography
Yes I think I will stick with the ini file for storing variables, by default EnvGet will retrieve any variables set while the au3 script is active and any variables set by cmd but loses its internal variables once the autoit script exits. So what I have done is this

Code: Select all

EnvSet "var" "val"

Which creates a value pair in the ini file
And when executed

Code: Select all

EnvGet var

Will return val
Now what if we have two variables that are the same so in cmd we have "tmp"
and in the ini we have "tmp" I decided to enhance this as an array value so when
executed

Code: Select all

EnvGet tmp

Will return both the ini file value and cmd's stored value in an array :idea:
Download here:http://www.scriptingpros.com/scripts/cleptography/env.zip

Re: AutoCom v1.0.0.1

Posted: 27 Jun 2011 09:47
by Cleptography
UPDATE:
Added a few user defined functions
1. HexToString (Converts hex value to a text string)
2. HexToBinary(Converts a hex value to true binary string [00101])
3. PrintInColor(Prints text in 1 of 256 colors)

4. Added support for FASM.au3 library (Flat Assembler)
Allows inline ASM inside an Autoit script and now a batch / cmd script

5. Added -ls switch to a couple of commands for optimization purposes.
To get a list of the available colors was done by using a for loop...

Code: Select all

for /L %a in (0,1,255) do @autocom printincolor %a "COLOR:%a"

...which was dreadfully slow so opted out to use a -ls switch and process internally...

Code: Select all

autocom printincolor -ls

...which obviously sped things up quite a bit eliminating the unneeded call to autocom

TIMES:
Ran using for loop

Code: Select all

Test retrieve colors using a for loop:
00:00:59.36
00:00:13.83

Ran using internal -ls switch

Code: Select all

Test using internal -ls switch to retrieve colors
00:00:13.83
00:00:13.93

The same test using for /L %a (0,1,255)

Code: Select all

00:00:50.34
00:00:51.23

Code: Select all

00:00:01.40
00:00:02.17

Code: Select all

00:00:45.50
00:00:46.44

As we can see AutoCom / Autoit processes this command noticeably quicker.

Re: AutoCom v1.0.0.1

Posted: 27 Jun 2011 13:05
by Acy Forsythe
Quick Question Cleptography...

Is this Autoit required for Autocom or is Autocom a replacement for Autoit?

Re: AutoCom v1.0.0.1

Posted: 27 Jun 2011 14:25
by Cleptography
Acy Forsythe wrote:Quick Question Cleptography...

Is this Autoit required for Autocom or is Autocom a replacement for Autoit?


@Acy Forsythe
No Autocom is independent of Autoit, Autocom is compiled as a console application. Autocom is just a collection of powerful command line utilities / autoit functions packaged into a single executable, and built for the command line. Most all of the commands are referenced by their standard autoit names outside of the gui functions, and user defined functions. So in autoit to replace a string we use StringReplace, same thing that is used in Autocom. There is no install needed comes in a zip file and can be deployed where ever you would like. So no autoit is not required to run Autocom, and no Autocom is not an Autoit replacement.

There is a poll posted in this forum about incorporating the built in plugin feature that is offered by autoit which will allow us to build dll, au3 scripts which can be run as open source through autocom without the need of autoit to be installed. The main purpose of the plugin feature would be to allow users if they want to build their own functions and simply drop them in the plugin folder and have them automatically detected and launched every time an autocom command is executed very much in the same way a powershell profile or gimp plugin works, so that added functionality can be added without having to modify the source.

You should check out Au3int which is an interpreter for autoit, which inspired this project. It runs in its own environment which wont allow us to do things like execute autoit commands inside a batch / cmd script, which is the main purpose of autocom. You can follow the links in the first post in this thread which will take you to a couple of pages with more information. I released an early beta (v1.0.0.1) with some of the commands working and a list of most of the commands that will be used so users can explore and get a feel for how the tool works. It is pretty straight forward. I will release the v1.0.0.2 soon, there are a couple of bugs being worked out at the moment but once those are fixed there will be a new release.

UPDATE: 06/27/2011
Added SMTP, and POP3 email command line support
Added .zip command support

Re: AutoCom v1.0.0.1

Posted: 27 Jun 2011 16:02
by Acy Forsythe
What are you writing it in?

Does it currently support mouse and keyboard interaction or do you plan to add it?

I was using a GUI Macro program to automate some tasks a while back, but then started writting my own in C++ (Ok well I'm an old C programmer so it's really C using C++ functions and Windows API but call it what you will).

Since I already use a combination of HTML, SQL, Batch and VBScript I can create some fairly powerful scripts, but I don't always have SQL available and sometimes I need to interact with a GUI.

It's a win32 console application that can currently set active window, move the mouse, left-click, right-click, and send keyboard input. I will eventually add click-n-drag support, but haven't needed it personally. I thought about mentioning it earlier but did not know if external command line utilities were acceptable here.

I can definitely say that the e-mail and zip support would sway me to using it as long as it's supported (a nice thing about writing your own code is that it's supported as long as you need it).

Re: AutoCom v1.0.0.1

Posted: 27 Jun 2011 22:14
by Cleptography
@Acy Forsythe
Acy Forsythe wrote:What are you writing it in?

The main program is written in Autoit3 (Hence why autoit function names are used) but supports some inline c/++ and asm. There are a few links at
http://scriptingpros.com/viewtopic.php?f=153&t=94
under Ward that has built some UDF's and libraries for using
SHA1_MD5_RC4_BASE64_CRC32_XXTEA
EMBEDDED DLL'S
AES
HASH ALGORITHMS
EMBEDDED FLAT ASSEMBLER
MACHINE CODE ALGORITHMS
Acy Forsythe wrote:Does it currently support mouse and keyboard interaction or do you plan to add it?

Yes it will support simulated key strokes, and mouse interaction, cursor position, etc... not sure why since it is a console based application, but I will add support for them, maybe someone will find use for the functions. :roll:
Acy Forsythe wrote:It's a win32 console application that can currently set active window, move the mouse, left-click, right-click, and send keyboard input.

Sounds like AutoHotKey :wink:
Acy Forsythe wrote:I thought about mentioning it earlier but did not know if external command line utilities were acceptable here.

Of course you can mention them if they revolve around the command line and can be useful, it is good to share. As Orange_Batch has stated there are people that come around these forums from time to time asking questions that can not always be solved using simple batch or rather a challenge and are thrown things like use this language or that language etc, etc... So if you have a tool that can save time with some of these mundane task, viola.
Acy Forsythe wrote:e-mail and zip support would sway me to using it as long as it's supported (a nice thing about writing your own code is that it's supported as long as you need it).

Yes it will be supported as long as the project is supported. Both Windows zip and 7zip will be supported as of now. As of now two packages will be available, one that is all the commands compiled into the autocom.exe and the second which is all commands compiled into individual executables so users can pick and choose which commands they want.

COMMANDS:(Minus a few names that are supported just haven't added to the list yet)

Code: Select all

For more information on a command type the command without parameters

[ENVIRONMENT FUNCTIONS]
 ClipGet              Retrieves text from the clipboard.
 ClipPut              Writes text to the clipboard.
 EnvGet               Retrieves an environment variable.
 EnvSet               Writes an environment variable.
 EnvUpdate            Refreshes the OS environment.
 MemGetStats          Retrieves memory related information.

[FILE, DIRECTORY, and DISK FUNCTIONS]
 ConsoleRead          Read from the STDIN stream of the AutoIt script process.
 ConsoleWrite         Writes data to the STDOUT stream.
 ConsoleWriteError    Writes data to the STDERR stream.
 DirCopy              Copies a directory and all sub-directories and files (Similar to xcopy).
 DirCreate            Creates a directory/folder.
 DirGetSize           Returns the size in bytes of a given directory.
 DirMove              Moves a directory and all sub-directories and files.
 DirRemove            Deletes a directory/folder.
 DriveGetDrive        Returns an array containing the enumerated drives.
 DriveGetFileSystem   Returns File System Type of a drive.
 DriveGetLabel        Returns Volume Label of a drive, if it has one.
 DriveGetSerial       Returns Serial Number of a drive.
 DriveGetType         Returns drive type.
 DriveMapAdd          Maps a network drive.
 DriveMapDel          Disconnects a network drive.
 DriveMapGet          Retrieves the details of a mapped drive.
 DriveSetLabel        Sets the Volume Label of a drive.
 DriveSpaceFree       Returns the free disk space of a path in Megabytes.
 DriveSpaceTotal      Returns the total disk space of a path in Megabytes.
 DriveStatus          Returns the status of the drive as a string.
 FileChangeDir        Changes the current working directory.
 FileClose            Closes a previously opened text file.
 FileCopy             Copies one or more files.
 FileCreateNTFSLink   Creates an NTFS hardlink to a file or a directory
 FileCreateShortcut   Creates a shortcut (.lnk) to a file.
 FileDelete           Delete one or more files.
 FileExists           Checks if a file or directory exists.
 FileFindFirstFile    Returns a search handle according to file search string.
 FileFindNextFile     Returns a filename according to a previous call to FileFindFirstFile.
 FileFlush            Flushes the file's buffer to disk.
 FileGetAttrib        Returns a code string representing a file's attributes.
 FileGetEncoding      Determines the text encoding used in a file.
 FileGetLongName      Returns the long path+name of the path+name passed.
 FileGetPos           Retrieves the current file position.
 FileGetShortcut      Retrieves details about a shortcut.
 FileGetShortName     Returns the 8.3 short path+name of the path+name passed.
 FileGetSize          Returns the size of a file in bytes.
 FileGetTime          Returns the time and date information for a file.
 FileGetVersion       Returns the File version information.
 FileInstall          Include and install a file with the compiled script.
 FileMove             Moves one or more files
 FileOpen             Opens a text file for reading or writing.
 FileOpenDialog       Initiates a Open File Dialog.
 FileRead             Read in a number of characters from a previously opened text file.
 FileReadLine         Read in a line of text from a previously opened text file.
 FileRecycle          Sends a file or directory to the recycle bin.
 FileRecycleEmpty     Empties the recycle bin.
 FileSaveDialog       Initiates a Save File Dialog.
 FileSelectFolder     Initiates a Browse For Folder dialog.
 FileSetAttrib        Sets the attributes of one or more files.
 FileSetPos           Sets the current file position.
 FileSetTime          Sets the timestamp of one of more files.
 FileWrite            Append a text/data to the end of a previously opened file.
 FileWriteLine        Append a line of text to the end of a previously opened text file.
 IniDelete            Deletes a value from a standard format .ini file.
 IniRead              Reads a value from a standard format .ini file.
 IniReadSection       Reads all key/value pairs from a section in a standard format .ini file.
 IniReadSectionNames  Reads all sections in a standard format .ini file.
 IniRenameSection     Renames a section in a standard format .ini file.
 IniWrite             Writes a value to a standard format .ini file.
 IniWriteSection      Writes a section to a standard format .ini file.

[GRAPHIC and SOUND FUNCTIONS]
 Beep                 Plays back a beep to the user.
 PixelChecksum        Generates a checksum for a region of pixels.
 PixelGetColor        Returns a pixel color according to x,y pixel coordinates.
 PixelSearch          Searches a rectangle of pixels for the pixel color provided.
 PrintInColor         Prints a string in the specified color (1-255)
 SoundPlay            Play a sound file.
 SoundSetWaveVolume   Sets the system wave volume by percent.

[KEYBOARD FUNCTIONS]
 HotKeySet            Sets a hotkey that calls a user function.
 Send                 Sends simulated keystrokes to the active window.
 SendKeepActive       Attempts to keep a specified window active during Send().

[MATH FUNCTIONS]
 Abs                  Calculates the absolute value of a number.
 ACos                 Calculates the arcCosine of a number.
 ASin                 Calculates the arcsine of a number.
 ATan                 Calculates the arctangent of a number.
 BitAND               Performs a bitwise AND operation.
 BitNOT               Performs a bitwise NOT operation.
 BitOR                Performs a bitwise OR operation.
 BitRotate            Performs a bit shifting operation, with rotation.
 BitShift             Performs a bit shifting operation.
 BitXOR               Performs a bitwise exclusive OR (XOR) operation.
 Cos                  Calculates the cosine of a number.
 Ceiling              Returns a number rounded up to the next integer.
 Exp                  Calculates e to the power of a number.
 Floor                Returns a number rounded down to the closest integer.
 Log                  Calculates the natural logarithm of a number.
 Mod                  Performs the modulus operation.
 Random               Generates a pseudo-random float-type number.
 Round                Returns a number rounded to a specified number of decimal places.
 Sin                  Calculates the sine of a number.
 Sqrt                 Calculates the square-root of a number.
 SRandom              Set Seed for random number generation.
 Tan                  Calculates the tangent of a number.

[MESSAGE BOX and DIALOG FUNCTIONS]
 InputBox             Displays an input box to ask the user to enter a string.
 MsgBox               Displays a simple message box with optional timeout.
 ProgressOff          Turns Progress window off.
 ProgressOn           Creates a customizable progress bar window.
 ProgressSet          Sets the position and/or text of a previously created Progress bar window.
 SplashImageOn        Creates a customizable image popup window.
 SplashOff            Turns SplashText or SplashImage off.
 SplashTextOn         Creates a customizable text popup window.
 ToolTip              Creates a tooltip anywhere on the screen.

[MISC. FUNCTIONS]
 AdlibRegister        Registers an Adlib function.
 AdlibUnRegister      Unregisters an adlib function.
 AutoItSetOption      Changes the operation of various AutoIt functions/parameters.
 AutoItWinGetTitle    Retrieves the title of the AutoIt window.
 AutoItWinSetTitle    Changes the title of the AutoIt window.
 BlockInput           Disable/enable the mouse and keyboard.
 BinaryAlpha          Displays the English alphabet binary values table
 Break                Enables or disables the users' ability to exit a script from the tray icon menu.
 Call                 Calls a user-defined function contained in a string parameter.
 CDTray               Opens or closes the CD tray.
 Execute              Execute an expression.
 OnAutoItExitRegister Registers a function to be called when AutoIt exits.
 OnAutoItExitUnReg    UnRegisters a function that was called when AutoIt exits.
 AutoItSetOption      Changes the operation of various AutoIt functions/parameters.
 SetError             Manually set the value of the @error macro.
 SetExtended          Manually set the value of the @extended macro.
 VarGetType           Returns the internal type representation of a variant.

[MOUSE FUNCTIONS]
 MouseClick           Perform a mouse click operation.
 MouseClickDrag       Perform a mouse click and drag operation.
 MouseDown            Perform a mouse down event at the current mouse position.
 MouseGetCursor       Returns the cursor ID Number for the current Mouse Cursor.
 MouseGetPos          Retrieves the current position of the mouse cursor.
 MouseMove            Moves the mouse pointer.
 MouseUp              Perform a mouse up event at the current mouse position.
 MouseWheel           Moves the mouse wheel up or down. NT/2000/XP ONLY.

[NETWORK FUNCTIONS]
 FtpSetProxy          Sets the internet proxy to use for ftp access.
 HttpSetProxy         Sets the internet proxy to use for http access.
 HttpSetUserAgent     Sets the user-agent string sent with InetGet() and InetRead() requests.
 InetClose            Closes a handle returned from InetGet().
 InetGet              Downloads a file from the internet using the HTTP, HTTPS or FTP protocol.
 InetGetInfo          Returns detailed data for a handle returned from InetGet().
 InetGetSize          Returns the size (in bytes) of a file located on the internet.
 InetRead             Downloads a file from the internet using the HTTP, HTTPS or FTP protocol.
 Ping                 Pings a host and returns the roundtrip-time.
 TCPAccept            Permits an incoming connection attempt on a socket.
 TCPCloseSocket       Closes a TCP socket.
 TCPConnect           Create a socket connected to an existing server.
 TCPListen            Creates a socket listening for an incoming connection.
 TCPNameToIP          Converts an Internet name to IP address.
 TCPRecv              Receives data from a connected socket.
 TCPSend              Sends data on a connected socket.
 TCPShutdown,         UDPShutdown Stops TCP/UDP services.
 TCPStartup,          UDPStartup Starts TCP or UDP services.
 UDPBind              Create a socket bound to an incoming connection.
 UDPCloseSocket       Close a UDP socket.
 UDPOpen              Open a socket connected to an existing server .
 UDPRecv              Receives data from a opened socket
 UDPSend              Sends data on an opened socket

[OBJ/COM FUNCTIONS]
 ObjCreate            Creates a reference to a COM object from the given classname.
 ObjEvent             Handles incoming events from the given Object.
 ObjGet               Retrieves a reference to a COM object from an existing process or filename.
 ObjName              Returns the name or interface description of an Object

[PROCESS FUNCTIONS]
 DllCall              Dynamically calls a function in a DLL.
 DllCallbackFree      Frees a previously created handle created with DllCallbackRegister.
 DllCallbackGetPtr    Returns the pointer to a callback function that can be passed to the Win32 API.
 DllCallbackRegister  Creates a user-defined DLL Callback function.
 DllClose             Closes a previously opened DLL.
 DllOpen              Opens a DLL file for use in DllCall.
 DllStructCreate      Creates a C/C++ style structure to be used in DllCall.
 DllStructGetData     Returns the data of an element of the struct.
 DllStructGetPtr      Returns the pointer to the struct or an element in the struct.
 DllStructGetSize     Returns the size of the struct in bytes.
 DllStructSetData     Sets the data in of an element in the struct.
 ProcessClose         Terminates a named process.
 ProcessExists        Checks to see if a specified process exists.
 ProcessGetStats      Returns an array about Memory or IO infos of a running process.
 ProcessSetPriority   Changes the priority of a process
 ProcessList          Returns an array listing the currently running processes (names and PIDs).
 ProcessWait          Pauses script execution until a given process exists.
 ProcessWaitClose     Pauses script execution until a given process does not exist.
 Run                  Runs an external program.
 RunWait              Runs an external program and pauses script execution until the program finishes.
 RunAs                Runs an external program under the context of a different user.
 RunAsWait            Runs an external program under the context of a different user and pauses script execution until the program finishes.
 ShellExecute         Runs an external program using the ShellExecute API.
 ShellExecuteWait     Runs an external program using the ShellExecute API and pauses script execution until it finishes.
 Shutdown             Shuts down the system.
 StderrRead           Reads from the STDERR stream of a previously run child process.
 StdinWrite           Writes a number of characters to the STDIN stream of a previously run child process.
 StdioClose           Closes all resources associated with a process previously run with STDIO redirection.
 StdoutRead           Reads from the STDOUT stream of a previously run child process.

[REGISTRY FUNCTIONS]
 RegDelete            Deletes a key or value from the registry.
 RegEnumKey           Reads the name of a subkey according to it's instance.
 RegEnumVal           Reads the name of a value according to it's instance.
 RegRead              Reads a value from the registry.
 RegWrite             Creates a key or value in the registry.

[STRING FUNCTIONS]
 HexToBinary          Converts a hex value (0-9 A-F) to a binary string
 HexToString          Converts a hex value into a text string
 StringAddCR          Takes a string and prefixes all linefeed characters ( Chr(10) ) with a carriage return character ( Chr(13) ).
 StringCompare        Compares two strings with options.
 StringInStr          Checks if a string contains a given substring.
 StringIsAlNum        Checks if a string contains only alphanumeric characters.
 StringIsAlpha        Checks if a string contains only alphabetic characters.
 StringIsASCII        Checks if a string contains only ASCII characters in the range 0x00 - 0x7f (0 - 127).
 StringIsDigit        Checks if a string contains only digit (0-9) characters.
 StringIsFloat        Checks if a string is a floating point number.
 StringFormat         Returns a formatted string (similar to the C sprintf() function).
 StringFromASCIIArray Converts an array of ASCII codes to a string.
 StringIsInt          Checks if a string is an integer.
 StringIsLower        Checks if a string contains only lowercase characters.
 StringIsSpace        Checks if a string contains only whitespace characters.
 StringIsUpper        Checks if a string contains only uppercase characters.
 StringIsXDigit       Checks if a string contains only hexadecimal digit (0-9, A-F) characters.
 StringLeft           Returns a number of characters from the left-hand side of a string.
 StringLen            Returns the number of characters in a string.
 StringLower          Converts a string to lowercase.
 StringMid            Extracts a number of characters from a string.
 StringRegExp         Check if a string fits a given regular expression pattern.
 StringRegExpReplace  Replace text in a string based on regular expressions.
 StringReplace        Replaces substrings in a string.
 StringRight          Returns a number of characters from the right-hand side of a string.
 StringSplit          Splits up a string into substrings depending on the given delimiters.
 StringStripCR        Removes all carriage return values ( Chr(13) ) from a string.
 StringStripWS        Strips the white space in a string.
 StringToASCIIArray   Converts a string to an array containing the ASCII code of each character.
 StringToBinay        Converts a text string to binary data
 StringTrimLeft       Trims a number of characters from the left hand side of a string.
 StringTrimRight      Trims a number of characters from the right hand side of a string.
 StringUpper          Converts a string to uppercase.

[TIMER and DELAY FUNCTIONS]
 Sleep                Pause script execution.
 TimerInit            Returns a timestamp (in milliseconds).
 TimerDiff            Returns the difference in time from a previous call to TimerInit().

[TRAY FUNCTIONS]
 TrayCreateItem       Creates a menuitem control for the tray.
 TrayCreateMenu       Creates a menu control for the tray menu.
 TrayItemDelete       Deletes a menu/item control from the tray menu.
 TrayItemGetHandle    Returns the handle for a tray menu(item).
 TrayItemGetState     Gets the current state of a control.
 TrayItemGetText      Gets the itemtext of a tray menu/item control.
 TrayItemSetOnEvent   Defines a user-defined function to be called when a tray item is clicked.
 TrayItemSetState     Sets the state of a tray menu/item control.
 TrayItemSetText      Sets the itemtext of a tray menu/item control.
 TrayGetMsg           Polls the tray to see if any events have occurred.
 TraySetClick         Sets the clickmode of the tray icon - what mouseclicks will display the tray menu.
 TraySetIcon          Loads/Sets a specified tray icon.
 TraySetOnEvent       Defines a user function to be called when a special tray action happens.
 TraySetPauseIcon     Loads/Sets a specified tray pause icon.
 TraySetState         Sets the state of the tray icon.
 TraySetToolTip       Sets the tooltip text for the tray icon.
 TrayTip              Displays a balloon tip from the AutoIt Icon. (2000/XP only)

[VARIABLES and CONVERSION FUNCTIONS]
 Asc                  Returns the ASCII code of a character.
 AscW                 Returns the unicode code of a character.
 Chr                  Returns a character corresponding to an ASCII code.
 ChrW                 Returns a character corresponding to a unicode code.
 Assign               Assigns a variable by name with the data.
 Binary               Returns the binary representation of an expression.
 BinaryLen            Returns the number of bytes in a binary variant.
 BinaryMid            Extracts a number of bytes from a binary variant.
 BinaryToString       Converts a binary variant into a string.
 Dec                  Returns a numeric representation of a hexadecimal string.
 Eval                 Return the value of the variable defined by an string.
 Hex                  Returns a string representation of an integer or of a binary type converted to hexadecimal.
 HWnd                 Converts an expression into an HWND handle.
 Int                  Returns the integer (whole number) representation of an expression.
 IsAdmin              Checks if the current user has full administrator privileges.
 IsArray              Checks if a variable is an array type.
 IsBinary             Checks if a variable or expression is a binary type.
 IsBool               Checks if a variable's base type is boolean.
 IsDeclared           Check if a variable has been declared.
 IsDllStruct          Checks if a variable is a DllStruct type.
 IsFloat              Checks if a variable or expression is a float-type.
 IsHWnd               Checks if a variable's base type is a pointer and window handle.
 IsInt                Checks if a variable or expression is an integer type.
 IsKeyword            Checks if a variable is a keyword (for example, Default).
 IsNumber             Checks if a variable's base type is numeric.
 IsObj                Checks if a variable or expression is an object type.
 IsPtr                Checks if a variable's base type is a pointer.
 IsString             Checks if a variable is a string type.
 Number               Returns the numeric representation of an expression.
 Ptr                  Converts an expression into a pointer variant.
 String               Returns the string representation of an expression.
 StringToBinary       Converts a string into binary data.
 UBound               Returns the size of array dimensions.

[WINDOW FUNCTIONS]
 WinActivate          Activates (gives focus to) a window.
 WinActive            Checks to see if a specified window exists and is currently active.
 WinClose             Closes a window.
 WinExists            Checks to see if a specified window exists.
 WinFlash             Flashes a window in the taskbar.
 WinGetCaretPos       Returns the coordinates of the caret in the foreground window
 WinGetClassList      Retrieves the classes from a window.
 WinGetClientSize     Retrieves the size of a given window's client area.
 WinGetHandle         Retrieves the internal handle of a window.
 WinGetPos            Retrieves the position and size of a given window.
 WinGetProcess        Retrieves the Process ID (PID) associated with a window.
 WinGetState          Retrieves the state of a given window.
 WinGetText           Retrieves the text from a window.
 WinGetTitle          Retrieves the full title from a window.
 WinKill              Forces a window to close.
 WinList              Retrieves a list of windows.
 WinMenuSelectItem    Invokes a menu item of a window.
 WinMinimizeAll       Minimizes all windows.
 WinMinimizeAllUndo   Undoes a previous WinMinimizeAll function.
 WinMove              Moves and/or resizes a window.
 WinSetOnTop          Change a window's Always On Top attribute.
 WinSetState          Shows, hides, minimizes, maximizes, or restores a window.
 WinSetTitle          Changes the title of a window.
 WinSetTrans          Sets the transparency of a window. (Windows 2000/XP or later)
 WinWait              Pauses execution of the script until the requested window exists.
 WinWaitActive        Pauses execution of the script until the requested window is active.
 WinWaitClose         Pauses execution of the script until the requested window does not exist.
 WinWaitNotActive     Pauses execution of the script until the requested window is not active.

Re: AutoCom v1.0.0.1

Posted: 28 Jun 2011 04:46
by Cleptography
Most of the commands in autocom are straight forward and stick to the syntax provided by autoit at least the one liner ones.
Here is some autoit syntax:

Code: Select all

StringReplace ( "string", "searchstring/start", "replacestring" [, occurrence [, casesense]] )

In autocom we simply use all arguments and specify the optional defaults as either 0 or ""
So we end up with

Code: Select all

StringReplace $cmdline[1], $cmdline[2], $cmdline[3], $cmdline[4], $cmdline[5]

The format is strict and precise but it is the preferred way as to not to have to add a whole bunch switches -s -r -o -c etc... and allow us to stick with autoits syntax as much as possible. Now with user defined functions and commands such as email or zip we need a list of switches and arguments followed by parameters. So if anyone is interested in building some command utilities with switches, flags, that can be processed, and sanitized in any order. Here is the UDF template that I am using in order to accomplish this.

CmdArgsUDF.au3:

Code: Select all

;;Set some Global variables that will be used as the command parameters
Global $msgHeader       = ""         ;Varible for the message header
Global $msgBody         = ""         ;Varible for the message body
Global $flagX          = "False"      ;Flag X
Global $flagY          = "False"      ;Flag y

;Read in the optional switch set in the users profile and set a variable - used in case selection
Func ReadCmdLineParams()
 
;;Loop through every arguement
;;$cmdLine[0] is an integer that is eqaul to the total number of arguements that we passwed to the command line
for $i = 1 to $cmdLine[0]
   select
   ;;If the arguement equal -h
   case $CmdLine[$i] = "-h"
      ;check for missing argument
      if $i == $CmdLine[0] Then cmdLineHelpMsg()
 
      ;Make sure the next argument is not another paramter
      if StringLeft($cmdline[$i+1], 1) == "-" Then
         cmdLineHelpMsg()
      else
         ;;Stip white space from the begining and end of the input
         ;;Not alway nessary let it in just in case
         $msgHeader = StringStripWS($CmdLine[$i + 1], 3)
   endif
 
   ;;If the arguement equal  -b
   case $CmdLine[$i] = "-b"
 
      ;check for missing arguement
      if $i == $CmdLine[0] Then cmdLineHelpMsg()
 
      ;Make sure the next argument is not another paramter
      if StringLeft($cmdline[$i+1], 1) == "-" Then
         cmdLineHelpMsg()
      Else
         ;;Stip white space from the begining and end of the input
         ;;Not alway nessary let it in just in case
         $msgBody = StringStripWS($CmdLine[$i + 1], 3)
   endIf
 
   ;set the -x flag to True
   case $cmdLine[$i] = "-x"
      $flagX = "True"
 
   ;set the -y flag to True
   case $cmdLine[$i] = "-y"
      $flagY = "True"
EndSelect
Next
 
;Make sure any required options are set and if not display the Help Message
if $msgHeader  == "" or _
   $msgBody   == "" Then
   cmdLineHelpMsg()
EndIf
EndFunc
 
Func cmdLineHelpMsg()
   ConsoleWrite('Dummy function for retrieving the help context' & @LF & @LF & _
               'Syntax:   ' & @ScriptName & ' (switch) (parameters)' & @LF & _
               'Default: ' & ' Displays this help message.' & @LF & _
               @LF & _
               'Required Options:' & @LF & _
               '-h [Message Header]' & @LF & _
               '-b [Message Body]' & @LF & _
               @LF & _
               'Optional Options:' & @LF & _
               '-x ' & 'Flag X' & @LF & _
               '-y ' & 'Flag Y' & @LF)
   Exit
EndFunc

Then we can simply include this in a .au3 script to use it. We can add as many global values optional switches, and required switches as we want and then process them from the external script.

Test.au3:

Code: Select all

#include<CmdArgsUDF.au3>

;;Get Parameters
ReadCmdLineParams()
 
;; Display message dummy message
ConsoleWrite("MsgHeader: " & $msgHeader &@LF& "MsgBody: " & $msgBody &@LF& "FlagX: " & $flagX &@LF& "FlagY: " & $flagY &@LF)

This next method allows us to execute the menus and parameters as functions inside the main context and to end each line with a designated escape character in the example a space followed by two forward slashes a space marks the end of the command and everything after is ignored. We could also add ; or any other character that can be treated like a separator or the start of a new line or new command. This works very much in the same way as we would in a batch by using

Code: Select all

echo;Hello&&echo;World


Example:

Code: Select all

;Set the internal command name to reflect the script name
$CmdName = @scriptname

;Simple help context based on the command name which should reflect the script name
;Define the functions:
Func _CmdHelpMsg($CmdName)
if $CmdName = @scriptname then
   ConsoleWrite("DummTest Command"&@LF)
   ConsoleWrite("Syntax: "&$CmdName&" parameters"&@LF)
   exit
elseif $CmdName = "Another Help Context" then
   ConsoleWrite("Another Help Context")
   exit
endif
EndFunc

;Define a function to be used as a parameter to one of the switches in this case the -e switch
Func _ExecuteThisFunction()
   consolewrite($cmdline[$i]&@LF)
EndFunc

;Check if no parameters were specified execute the help context
if $cmdline[0] = 0 then
   _CmdHelpMsg($CmdName)
   exit
endif

;Define the number of allowed parameters and loop through them
for $i = 1 to 64
   if $cmdline[$i] =     "-p" then
      $i = $i + 1
      ;Execute the parameters based on the above switch could be a _Function instead of console write as in EXAMPLE 2:
      ;EXAMPLE: 1
      consolewrite($cmdline[$i]&@LF)
   elseif $cmdline[$i] = "-e" then
      $i = $i + 1
      ;Execute the parameters in the form of a function
      ;EXAMPLE: 2
      _ExecuteThisFunction()
   ;End each line of code with // Then we can comment anything after the line like so
   ;We could also a ; or any other seperator that you would like and process everything after that however you would like
   elseif $cmdline[$i] = "//" then
      exitloop
   else
      ;Print error message if the command was badly formatted or something is not reconized
      consolewrite("ERROR: Badly formatted command "&"("&$cmdline[$i]&")"&" is not reconized"&@LF)
      exitloop
   endif
next

Re: AutoCom v1.0.0.1

Posted: 28 Jun 2011 07:43
by Acy Forsythe
That's an impressive list Cleptography!

Yes it will support simulated key strokes, and mouse interaction, cursor position, etc... not sure why since it is a console based application, but I will add support for them, maybe someone will find use for the functions.


Batch scripts were originally intended to automate repetitive processes. That was fine and dandy from a command line when you never needed a mouse, but in windows, some processes just get stuck at an OK button and require user intervention when a single mouse-click could have made the whole process automated.

But I like what you're doing, back before the GUI, there were lots of batch utilities you could download that did all kinds of different things, but they were one-trick ponies. I had a few dozen exe files for special purpose tasks that Command.com couldn't do. That always drove me crazy, so I've stayed away from those since then. I really like the idea of having a single executable to deploy for all purposes :)

Re: AutoCom v1.0.0.1

Posted: 30 Jun 2011 12:40
by Cleptography
UPDATE: 06/29/2011
IMAP Support
Gzip, Bzip2, Tar archive types support
SFX archives support
Winpcap support
1. Display your device list with full information
2. Capturing ICMP packets
3. Saving http traffic to a pcap file
4. Reading a whole existing pcap file
5. Sending a valid ethernet broadcast on your lan

Changed switch options to long name in favor of the current syntax that is used by autoit. Makes no sense to have some commands that execute (CommandName Args Parameters) and then have some that execute (CommandName -a Parameters -b Parameters)

Screen Shots of the .zip functions.
Main Menu:
Image

Command and Return Data:
Image