Page 1 of 3

PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Sat Jul 02, 2016 5:15 am
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

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Sat Jul 02, 2016 5:36 am
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?

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Sat Jul 02, 2016 6:03 am
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).

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Sat Jul 02, 2016 7:40 pm
by juror
Thanks for sharing.

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

Nice utility functions.

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Sun Jul 03, 2016 7:01 am
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.

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Tue Jul 05, 2016 3:10 am
by GoodNPlenty
Very Nice :D
Thank You for sharing.

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Fri Sep 09, 2016 6:20 am
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.

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Fri Sep 09, 2016 7:04 am
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)?

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Fri Sep 09, 2016 5:40 pm
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.

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Fri Sep 09, 2016 9:44 pm
by IdeasVacuum
Huge work ward, thankyou for sharing.
Simulated keystrokes, mouse movement and COM support. Could be very useful.

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Tue Sep 13, 2016 10:29 am
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:

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Tue Sep 13, 2016 10:43 am
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

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Thu Sep 15, 2016 9:57 pm
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.

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Mon Sep 19, 2016 3:23 pm
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

Re: PureAutoIt - Complete Autoit Functions In Purebasic

Posted: Thu Sep 29, 2016 10:31 am
by loulou2522
Thanks WARD for this great code