Jump to content

PureAutoIt machine code compiler small executable


ghost911
 Share

Recommended Posts

$x = BitShift(14, 2)
$y = BitShift(14, -2)
$z = BitShift(1, -31)
MsgBox(0, '', $x & @LF & $y & @LF & $z)
Define x.l, y.l, z.l
x = (14 >> 2)
y = (14 << 2)
z = (1 << 31)
MessageRequester("", Str(x) + #LF$ + Str(y) + #LF$ + Str(z))
$x = BitOR(3, 15, 32) ; x = 47
MsgBox(0, '', $x)
x = (3 | 15 | 32)
MessageRequester("", Str(x))
$x = BitAND(2, 3, 6) ; x = 2
MsgBox(0, '', $x)
x = (2 & 3 & 6) ; x = 2
MessageRequester("", Str(x))
$x = BitNOT(5)
MsgBox(0, '', $x)
x = ~5 ; x = -6
MessageRequester("", Str(x))
$x = BitXOR(2, 3, 6) ; x = 7
MsgBox(0, '', $x)
x = (2 ! 3 ! 6) ; x = 7
MessageRequester("", Str(x))

Example bit flag

Local $fgBit = 0

Func _SetFg($fgBit, $z)
    Return BitOR($fgBit, BitShift(1, -$z))
EndFunc

Func _GetFg($fgBit, $z)
    Return BitAND($fgBit, BitShift(1, -$z))
EndFunc

$fg = 31
$fgBit = _SetFg($fgBit, $fg)
$sText = StringFormat("%031s", StringReplace(StringFormat("%-" & $fg+1 & "s", "1"), ' ', '0')) 
$True =  (_GetFg($fgBit, $fg) = True)
MsgBox(0, '', $True & @CRLF & $sText)
Define fgBit.b = 0

Procedure SetFg(fgBit.b, z)
    ProcedureReturn fgBit | (1<<z)
EndProcedure

Procedure GetFg(fgBit.b, z)
    ProcedureReturn Bool(fgBit & (1<<z))
EndProcedure

fg = 7
fgBit = SetFg(fgBit, fg)
Debug RSet(Bin(1<<fg, #PB_Long), 8, "0")
True =  GetFg(fgBit, fg)
Debug True

 

Edited by AZJIO
Link to comment
Share on other sites

@AZJIO should further simplify the code even more so that everyone understands even a beginner I thank you for your help 

people like simplicity and then it's time saving when you program

I will study this from my side to optimize the code to have more clarity and faster execution speed

 

 
Link to comment
Share on other sites

FileExists()

Procedure.q FileExists(Filename$)
  Result.q = FileSize(Filename$)
  If Result.q = -1
    Result.q = 0
  Else
    Result.q = 1
   EndIf
  ProcedureReturn Result.q 
EndProcedure

Link to comment
Share on other sites

FileDelete()

Procedure.q FileDelete(Filename$)
  Result.q = DeleteFile(filename$,#PB_FileSystem_Force)
  If Result.q <> 0
    Result.q = 1
  EndIf
  ProcedureReturn Result.q 
EndProcedure
 

Link to comment
Share on other sites

IncludeFile "AutoitCoding.PB"
Procedure.q FileExists2(Filename$)
  Result.q = FileSize(Filename$)
  If Result.q = -1
    Result.q = 0
  Else
    Result.q = 1
   EndIf
  ProcedureReturn Result.q 
EndProcedure



TempsDepart.q = ElapsedMilliseconds()

If  FileExists ("upx.exe")
 ; MsgBox(0,"Autoit","the file exist")
Else
 ; MsgBox(0,"Autoit","the file does not exist")
EndIf
TempsEcoule.q = ElapsedMilliseconds()-TempsDepart
Debug TempsEcoule

TempsDepart2.q = ElapsedMilliseconds()
If  FileExists2("upx.exe")
  ;MsgBox(0,"Autoit","the file exist")
Else
  ;MsgBox(0,"Autoit","the file does not exist")
EndIf
TempsEcoule2.q = ElapsedMilliseconds()-TempsDepart2
Debug TempsEcoule2

 

The execution speed is the same

Link to comment
Share on other sites

is a new version of the code I thank you

it would be necessary to program in autolt a code converter au3 to pb for convert the small difference with PureAutoit

people could secure their source code by compiling it

 

Edited by ghost911
Link to comment
Share on other sites

  • Developers

@ghost911,

You started a nice little project which is growing rapidly I see. When AutoIt3 started it was around the 80 Kb if I remember well and it started to grow as many internal function were added.  You will find that there are several commands that aren't really simply to implement but just see that as a challenge. 

Just a few comments I would like to make:

  1. skip adding the compiled autoit3 exe to your 7z as people around here can compile the au3 file themselfs
  2. Also no need to include UPX.exe as that is also already available to everybody here, so you keep your repository nice and small.
  3. I see you are using the word Fonction all over the place but it is really spelled Function. :)

Curious about how this is going to turn out when it gets more functions available. 

Jos 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I fully understand the purpose of this project and am just curious how far it will get to be able to compile AutoIt3 code without any adaption and all the safeguards build in like is done in AutoIt3. Not trivial, but as stated, a nice challenge. :) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

If flag = 1
    MessageRequester(Title,Text,#MB_OKCANCEL)
ElseIf flag = 2 
    MessageRequester(Title,Text,#MB_ABORTRETRYIGNORE )
ElseIf flag = 3 
    MessageRequester(Title,Text,#MB_YESNOCANCEL)
ElseIf flag = 3
; ...........................
ElseIf flag = 262144
    MessageRequester(Title,Text,#MB_TOPMOST)
ElseIf flag = 2097152
    MessageRequester(Title,Text,#MB_SERVICE_NOTIFICATION) 
    
; Isn't it easier?
MessageRequester(Title,Text,flag)

Where flag 4?

Can do so:

Macro StringLen(String)
    (Str(Len(String)))
EndMacro

Procedure.s StringLen1 (String$)
    ProcedureReturn Str(Len(String$))
EndProcedure

String$ = "Hello"
Debug StringLen1(String$)
Debug StringLen(String$)

I do not understand why you convert to a string? A function that will use this will probably require the numeric type of the variable.

Do you know what the Enumeration is for?

Enumeration
    #FV_FileVersion      = $0001 
    #FV_FileDescription  = $0002 
    #FV_LegalCopyright   = $0004 
EndEnumeration

 

Edited by AZJIO
Link to comment
Share on other sites

10 hours ago, AZJIO said:

Usually they are needed for other cases. MsgBox is likely to be the exception of their rules

then we should imagine a 2 in 1 system that returns 1 string or 1 number with a flag for example with a default mode in autoit it's a string

 
Link to comment
Share on other sites

Indeed, AutoIt uses a variant of duck typing.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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