PureAutoIt - Complete Autoit Functions In Purebasic

Developed or developing a new product in PureBasic? Tell the world about it.
ward
User
User
Posts: 13
Joined: Mon Mar 20, 2006 8:44 am

PureAutoIt - Complete Autoit Functions In Purebasic

Post by ward »

The Features:
  • PureBasic version of following AutoIt functions:
    • Environment functions
    • File, Directory and Disk functions
    • Graphic and Sound functions
    • Keyboard functions
    • Message Boxes and Dialogs functions
    • Misc. functions (non-complete)
    • Mouse functions
    • Process functions (non-complete)
    • Registry functions
    • String functions
    • Timer and Delay functions
    • Window functions (include controls functions)
    • AutoIt macros
  • Window and control related functions is fully AutoIt-compatible.
    (Include options of WinTitleMatchMode, WinSearchChildren, WinDetectHiddenText,
    and full support of "Advanced Window Descriptions".)
  • Syntax for Send(), ControlSend() and HotKeySet() is fully AutoIt-compatible.
    (Include all send command, related options, and SendKeepActive() function.)
  • File read/write functions can detect different text encoding automaticly.
    Following encoding are supported: Unicode/UTF8/Ascii with or without BOM.
    (MemoryStringFormat() can detect more encoding.)
  • High speed string functions wrote in C source.
  • Easy to use StringRegExpReplace() function with PHP style back-references.
  • Thread safety. All dialog functions can create dialog from child thread.
  • OnAutoItExitRegister/OnAutoItExitUnRegister to realize atexit for PureBasic.
  • Assembly optimizer to strip unused procedures, strings, and externs.
    (Not yet ready, I will publish it in next release.)
Attention matters:
  • This is only a BETA VERSION, use on your own risk
  • The library is developed under windows 10, x86 compiler, unicode mode.
    Some functions may not work correctly in different environment.
    If you have any problems, please report it.
    I hope it finally supports all windows version and all mode what PureBasic supported.
  • Macros are PureBasic procedures with underline prefix.
    For example: _Error(), _Extended(), _MyDocumentsDir()
  • See the AutoIt document to know how to use the functions and macros, for example:
    _Error() and _Extended() will return what the document says.
    _HotKeyPressed() only works under HotKeySet() callback function.
    _ExitCode() only works under OnAutoItExitRegister() callback function.
  • FileRead(), FileWrite(), FileWriteLine() like AutoIt, accept file handle or filename.
    So FileOpen() actually return a "string" file handle.
    Don't mix it with PureBasic built-in file command.
  • FileReadBinary() And HexToMemory() return a memory buffer if *buffer = 0.
    The memory buffer must be freed with FreeMemory().
  • Some AutoIt function return an array, but PureBasic cann't.
    In PureAutoIt, it return comma separated string for position or size.
    e.g. WinGetPos(), WinGetClientSize(), etc.
    For others, it accept one extra parameter to return Array or List.
    e.g. FileReadToArray(), WinList(), etc.
  • Some AutoIt function use function name as callback parameter.
    For example, HotKeySet(), AdlibRegister(), OnAutoItExitRegister(), etc.
    In these functions, you must pass procedure address like @ProcedureName().
  • StringRegExp return different result accroding to flag.
    So I split it into 5 different procedures (StringRegExp0 ~ StringRegExp4).
  • Set #PureAutoIt_EnableRegExp to 0 can reduce to output size.
    (In this case, REGEXPTITLE and REGEXPCLASS are not supported.)
To do:
  • Check all function works under x64.
  • The document for PureAutoIt is not yet completed...
Download
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by Lunasole »

Thanks, looks interesting and might be used to greatly power-up Purebasic as language for simple scripts on Windows.
Going to test it when will be matching case.

PS. Did you ported whole AutoIt? And what those .obj files doing?
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
ward
User
User
Posts: 13
Joined: Mon Mar 20, 2006 8:44 am

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by ward »

Lunasole wrote:Thanks, looks interesting and might be used to greatly power-up Purebasic as language for simple scripts on Windows.
Going to test it when will be matching case.

PS. Did you ported whole AutoIt? And what those .obj files doing?
Not yet whole AutoIt, but almost.
The obj files contain the optimized string and hash functions used in PureAutoIt (by ImportC command).
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by juror »

Thanks for sharing.

Process_Memory_Counters structure is unnecessary (In windows - PB5.42)

Nice utility functions.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by Lunasole »

ward wrote: Not yet whole AutoIt, but almost.
The obj files contain the optimized string and hash functions used in PureAutoIt (by ImportC command).
(I've posted some stupid questions before fall asleep ^^)
From beginning I didn't look code and thought it is just a kind of bindings to autoit binaries and surprised that it is source code port. Nicely done man, thanks again.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
GoodNPlenty
Enthusiast
Enthusiast
Posts: 107
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by GoodNPlenty »

Very Nice :D
Thank You for sharing.
Aleks_Longard
User
User
Posts: 59
Joined: Mon Dec 24, 2012 9:07 am
Location: Germany, Munich

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by Aleks_Longard »

Very cool work!
I can not compile all examples, it's have many bugs in PureAutoIt.pbi

Testing on Windows XP x86, PB 5.50.
Sory my bad english
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by Kukulkan »

Sorry, I did not fully understand. Is this to run AutoIt scripts from within my PureBasic program (like a script interpreter to define Macros like VB in Office) or is this an enhancement to PB to offer AutoIt function syntax in my PB sourcecode (like a PB language extension)?
fryquez
Enthusiast
Enthusiast
Posts: 362
Joined: Mon Dec 21, 2015 8:12 pm

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by fryquez »

Thanks a lot ward!
Wish I had this a couple year earlier, when I ported all my program from Autoit to PureBasic.

@Kukulkan
It's a collection of very many Autoit v3 functions ported to PureBasic, which makes it much easy for Autoit users to switch to PureBasic.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by IdeasVacuum »

Huge work ward, thankyou for sharing.
Simulated keystrokes, mouse movement and COM support. Could be very useful.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by Kwai chang caine »

I try two examples (Macros.pb and InputBox.pb) of this splendid code under W7 X86 v5.50
I don't know if it's just me, but i have the error "Already declared"

Code: Select all

    Structure PROCESS_MEMORY_COUNTERS
      cb.l
      PageFaultCount.l
      PeakWorkingSetSize.i
      WorkingSetSize.i
      QuotaPeakPagedPoolUsage.i
      QuotaPagedPoolUsage.i
      QuotaPeakNonPagedPoolUsage.i
      QuotaNonPagedPoolUsage.i
      PagefileUsage.i
      PeakPagefileUsage.i
    EndStructure
After have commented the structure, i have the error line "UseModule PureAutoIt" :|
Debugger wrote:The constant of module public declared "#FILE_BEGIN" is declared in global scope
And here, i don't know how fix it :oops:
ImageThe happiness is a road...
Not a destination
fryquez
Enthusiast
Enthusiast
Posts: 362
Joined: Mon Dec 21, 2015 8:12 pm

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by fryquez »

Hi KCC,

used Defined() to solve these problems.

Code: Select all

CompilerIf Defined(PROCESS_MEMORY_COUNTERS, #PB_Structure) = #False
  
  Structure PROCESS_MEMORY_COUNTERS
    cb.l
    PageFaultCount.l
    PeakWorkingSetSize.i
    WorkingSetSize.i
    QuotaPeakPagedPoolUsage.i
    QuotaPagedPoolUsage.i
    QuotaPeakNonPagedPoolUsage.i
    QuotaNonPagedPoolUsage.i
    PagefileUsage.i
    PeakPagefileUsage.i
  EndStructure
  
CompilerEndIf


CompilerIf Defined(FILE_BEGIN, #PB_Constant) = #False
  
  Enumeration ; for FileSetPos
    #FILE_BEGIN   = 0
    #FILE_CURRENT = 1
    #FILE_END     = 2
  EndEnumeration
  
CompilerEndIf
ward
User
User
Posts: 13
Joined: Mon Mar 20, 2006 8:44 am

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by ward »

Thanks fryquez, I will add these fix for PB 5.5 in next release.
These code were developed under PB5.4, so some constant conflict.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by Kwai chang caine »

Thanks FRYQUEZ for your code 8)

Thanks too WARD for this great code 8)
After adding the Fryquez code, i have a last error line 4643 in "PureAutoIt.pbi"
PokeL(*flag, #KEY_WOW64_64KEY)
I have commented it, and that's works :wink:
W7 X86 v5.40
ImageThe happiness is a road...
Not a destination
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Post by loulou2522 »

Thanks WARD for this great code
Post Reply