Jump to content

New SciTE4AutoIt3 available with SciTE v1.74


Jos
 Share

Recommended Posts

have you tried using this in your script:?

#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/cs 0 /cn 0 /cf 0 /cv 0 /sf 1
no :) does not work. inset a unused function with a cryptic name at the top and stops compiling with an error.

and: it only replaces vars and funcs with useless crap of cryptic names, witch blows the code up instead of reducing it.

what i want, is to count for every variable, every user defined function, how often used,

and based on this replace the most used with "a", the next with "b", the next ...., .., the next with "0", ..., .. with "aa" ..

(shorten long descriptive human understandable names with shortest possible names, because compiled scripts do not care about the human meaning of an var- or func-name.)

and i will show this search&replace table for the user, to select names, witch should not be replaced, because they're for instance read from ini and "assign"-ed.

remove whitespace, comments, functions, vars and #regions with "debug_" in the name, replace constants with the values, add them up, to shorten the code in the compiled exe.

replaxe @CRLF by @CR or @LF may also a good idea <_<

AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)

Link to comment
Share on other sites

  • Replies 72
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Developers

no :P does not work. inset a unused function with a cryptic name at the top and stops compiling with an error.

and: it only replaces vars and funcs with useless crap of cryptic names, witch blows the code up instead of reducing it.

what i want, is to count for every variable, every user defined function, how often used,

and based on this replace the most used with "a", the next with "b", the next ...., .., the next with "0", ..., .. with "aa" ..

(shorten long descriptive human understandable names with shortest possible names, because compiled scripts do not care about the human meaning of an var- or func-name.)

and i will show this search&replace table for the user, to select names, witch should not be replaced, because they're for instance read from ini and "assign"-ed.

remove whitespace, comments, functions, vars and #regions with "debug_" in the name, replace constants with the values, add them up, to shorten the code in the compiled exe.

replaxe @CRLF by @CR or @LF may also a good idea <_<

Are you using the latest Obfuscator version ?

The parameters specified will cause Obfuscator NOT to rename Vars and Funcs ...

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

v. 1.0.20.0

but only to remove whitespace and comments is not what i want. ;-)

in obfuscator.log i see, that most of the lines had grown by additional whitespace :-/

..you are forgetting all unused functions are skipped ...but he... have a go at it <_<

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

..you are forgetting all unused functions are skipped ...but he... have a go at it :)

I am wondering will the shortenning of code as in removing unused functions, changing $long_variable to $short change anything for the speed of the program or even the size of the executable at all? I haven't tested that myself because i would think it's not gonna change anything <_<

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

  • Developers

I am wondering will the shortenning of code as in removing unused functions, changing $long_variable to $short change anything for the speed of the program or even the size of the executable at all? I haven't tested that myself because i would think it's not gonna change anything <_<

Gave this idea a go and this is the result for AutoIt3Wrapper using the current AutoIt3 production version:

Normal compile: 369Kb

Compile using the strip unused Funcs: 360Kb

Compile using the strip unused Funcs and renaming vars to $1,$2 etc: 350 Kb

:)

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

Jos, I found a bug with my horizontal scrollbar code. Folding would cause the wrong lines to be used for the calculation. Here's a fixed version:

-- Called when the UI is updated.
 function OnUpdateUI()
     CalculateHorizontalScrollWidth(editor)
     CalculateHorizontalScrollWidth(output)
     -- We want to allow others to play, too, so return false.
     return false
 end    -- OnUpdateUI()
 
 -- What we do here is calculate a new horizontal scroll width for the
 -- specified pane based on the longest line visible.
 -- args:
 --     pane - Specify either editor or output
 function CalculateHorizontalScrollWidth(pane)
     -- An interesting quirk, pane.FirstVisibleLine is 0-based but
     -- of course the display is 1-based.  Keep this in mind if
     -- debugging the line numbers and things look off-by-one.
     local longest_value = 0, longest_line, longest_temp
     local line
 
     -- Iterate over all the visible lines and find the longest.  Actually,
     -- we also iterate over the first non-visible line (at the bottom)
     -- as well just to prevent a loop where the scrollbar shows itself,
     -- obscures the line it's active for, then hides itself, then shows
     -- itself because the line becomes visible again, ad infinium.
     for line = pane.FirstVisibleLine, pane.FirstVisibleLine + pane.LinesOnScreen do
         -- Compute the longest line from the lines which are visible.
         -- We have to translate this to the actual document line, 
         -- otherwise folding may affect which line we get.
         local doc_line = pane:DocLineFromVisible(line)
         longest_temp = pane:LineLength(doc_line)
         if longest_temp > longest_value then
             longest_value = longest_temp
             longest_line = doc_line
         end
     end
 
     -- If we have a really small longest_value, set the width to 0
     -- and return.  This doesn't seem to work correctly for the
     -- output pane.
     if longest_value <= 2 then
         pane.ScrollWidth = 0
         return
     end
 
     -- Get the start of the line, this is used to retrieve the entire line's text.
     local line_start = pane:PositionFromLine(longest_line)
     -- This variable stores the position of the first non-whitespace character.
     local line_pos = pane.LineIndentPosition[longest_line + 2]
     -- We want to use a non-whitespace style if we can.
     local style = pane.StyleAt[line_pos]
     -- We don't want to grab the newlines so use this confusing code
     -- to strip 1 or 2 characters off the length (Really just a ternary).
     local adjust = (pane.EOLMode == 0 and 2) or 1
     -- Retrieve the line's text so we can calculate the width.
     local line_data = pane:textrange(line_start, (line_start + longest_value) - adjust)
     -- TextWidth() doesn't handle tabs, so, we replace tabs with spaces set to the
     -- indent size.
     line_data = line_data:gsub("\t", string.rep(" ", pane.Indent))
     -- Get an estimated width of the line.  We iterate all styles and pick the longest.
     local width = 0, width_temp
     local i
     for i = 1, 32 do
         width_temp = pane:TextWidth(i, line_data)
         if width_temp > width then
             width = width_temp
         end
     end
 
     -- Set the new width.  Hopefully it will be enough.
     pane.ScrollWidth = width
 end    -- CalculateHorizontalScrollWidth()
Link to comment
Share on other sites

You know how Visual Studio shows pretty little icons next to things in it's auto-complete drop-downs which help you identify what the symbol is? Would anybody like their symbols in SciTE to show up in a similar manner...?

Something like this, perhaps?

post-39-1194418416_thumb.pngpost-39-1194418411_thumb.pngpost-39-1194418405_thumb.png

Link to comment
Share on other sites

Seems nice, i was wondering what you meant the first time but it would be nice addition if you can make it and jos implement it in his Scite version <_<

I must say it would be awesome :)
Link to comment
Share on other sites

Jos, I've just spent a couple hours doing some interesting stuff with Lua. Basically what I've done is made a class/event factory. Here's an example:

-- Create our object.
 AutoIt = Utility:new()
 
 function AutoIt:OnChar(c)
      print("AutoIt:OnChar: " .. c)
 end

With the Utility library properly setup, AutoIt:OnChar() will be called as the user types. A couple cool things about this. You want to handle OnUpdateUI()? Add AutoIt:OnUpdateUI(). Any object deriving from Utility:new() can add the name of a SciTE event and it'll automatically be called. Which means, multiple callbacks can exist for the same event. Need a totally different OnChar() handler to do something else? No problem:

-- Create our object.
   AutoIt = Utility:new()
   
   function AutoIt:OnChar(c)
        print("AutoIt:OnChar: " .. c)
   end
 
 Other = Utility:new()
 
 function Other:OnChar(c)
     print("Other:OnChar")
 end

Both OnChar() functions will be called.

This was, of course, driven by need. I needed multiple, unrelated OnChar() handlers active simultaneously. It's a major cluster having two separate things in the same handler, so I took some concepts I knew Lua was capable of, figured them out and implemented them in a very small library (less than 100 lines (of code), provides support for all SciTE callbacks (adding support for any I missed or new ones is as simple as typing 1 line). It also provides object-oriented notation which helps keep things nice and clean.

Now that I have this in place, I'll be rewriting my auto-indent fixing OnChar() handler. I'll also be writing a new OnChar() handler which helps with the above prettified auto-complete dropdowns. Due to an issue in SciTE, I need to manipulate things manually to get the effect I want. This, of course, requires an OnChar() handler to get right.

Here's the file. Utility.lua contains the good stuff. I just provided a Sample.lua to show you how it works. Have a look at the file header to see the syntax for loading things correctly to give it a test.

I may end up renaming it. I kind of went a different direction with it than I intended and so the name doesn't fit now.

(Note: Had to make it a zip, I couldn't upload *.lua).

Link to comment
Share on other sites

Something like this, perhaps?

post-39-1194418416_thumb.pngpost-39-1194418411_thumb.pngpost-39-1194418405_thumb.png

This is freakin' sweet. In addition to what you see in those screenshots, I now have standard library functions showing up with a green cube, built-in pre-processor statements in olive (which looks bad, may need to change that) and special pre-processor statements (#Region, compiler flags, et cetera) showing up with a red cube. I also have the logic implemented to show the right cube at the right time (some of this is a feature done automatically by SciTE, some of it is a hack to work around a SciTE limitation).

It'll be a day or two before I have anything to release. I still need to clean up my Lua stuff (aka, merge all my stuff to using the new class thing I posted above). Then I'd like to spend a day or two just using everything to find any remaining bugs before I post it. So far, though, I'm pretty pleased with the outcome (both behind the scenes with the Lua stuff and the look).

Link to comment
Share on other sites

  • Developers

Good to see you are enjoying yourself here <_<

Will for sure look at it but will hold off on including it yet with the changes you are still making.

I was planning to release an updated version of the SciTE4AutoIt3 soon anyways but will hold off on that till this is included.

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

@jos

may i have a look at your obfuscator-code? i have some ideas, how to shrink the code as much as possible before compiling, but some tasks are hard to catch

(eval'ed variables, variables assigned from ini-file, ..). how do you select unused functions?

i think, in one week i have a first version.

btw.: atm. autoitwrapper does not recognize his directives and add them again on top, if i fill the fields while compiling. <_<

AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)

Link to comment
Share on other sites

  • Developers

@jos

may i have a look at your obfuscator-code? i have some ideas, how to shrink the code as much as possible before compiling, but some tasks are hard to catch

(eval'ed variables, variables assigned from ini-file, ..). how do you select unused functions?

i think, in one week i have a first version.

I have no intention to share the Obfuscator code for obvious reasons but basically it will do a recursive deepscan meaning it will check all Func's if they use it whatever level deep.

btw.: atm. autoitwrapper does not recognize his directives and add them again on top, if i fill the fields while compiling. <_<

Don't understand what you mean here ... but an obfuscator.log file is created in the Obfuscator program directory that will give some info about the processed command line options and directives.

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

This is freakin' sweet. In addition to what you see in those screenshots, I now have standard library functions showing up with a green cube, built-in pre-processor statements in olive (which looks bad, may need to change that) and special pre-processor statements (#Region, compiler flags, et cetera) showing up with a red cube. I also have the logic implemented to show the right cube at the right time (some of this is a feature done automatically by SciTE, some of it is a hack to work around a SciTE limitation).

It'll be a day or two before I have anything to release. I still need to clean up my Lua stuff (aka, merge all my stuff to using the new class thing I posted above). Then I'd like to spend a day or two just using everything to find any remaining bugs before I post it. So far, though, I'm pretty pleased with the outcome (both behind the scenes with the Lua stuff and the look).

I really cannot wait... Sounds like your doing a great job <_<
Link to comment
Share on other sites

Good to see you are enjoying yourself here <_<

Will for sure look at it but will hold off on including it yet with the changes you are still making.

I was planning to release an updated version of the SciTE4AutoIt3 soon anyways but will hold off on that till this is included.

Depending on your definition of "soon", you may wish to go ahead and release and then at worst you can just do a second release not long after with what I'm working on. I've got quite a bit of work to do cleaning up code. One of the major things is, I don't have to hide functions anymore since the object notation already hides them from the global scope. So I need to pull out all "sub-functions" and make them proper functions of the object. The result will be smaller, more manageable functions. I'm sure there's also examples of where I didn't use a good Lua-centric way of doing things. My SciTEStartup.lua file is quite a mess from a couple years of adding to it bit-by-bit, so it's going to take a bit of time to detangle it all. I definitely like the multiple, small, concise files, though. I have a bunch of Lua files now, but the new ones are all short and contain only one feature. Oh yeah, and I want to fix a few other outstanding indentation issues.
Link to comment
Share on other sites

I would just like to comment on how useful this addition would be... I don't have much time play with autoit anymore, so whenever I need it as a tool it takes me forever to remember all the keywords. This would nicely compliment the autocomplete feature already in Scite and it would make coding just a little bit easier.

-Thanks

Wus

Link to comment
Share on other sites

  • Developers

11/11/2007: Uploaded a new SciTe4AutoIt3.exe installer..

==> ScitillaHistory page containing all SciTE/Scintilla updates.

==> Visit the SciTe4AutoIt3 Download page for the latest versions

==> Check the online documentation for an overview of all extra's you get with this installer.

Enjoy,

Jos

11/11/2007
*** Updated AutoIt3Wrapper_Gui/AutoIt3Wrapper v1.9.4 (JdeB)
    - Added: Version info for the different utilities to the Tabs in AutoIt3Wrapper_GUI.
    - Fixed: Timing issue in getting STDOUT information of ran programs resulting in missing console output.
    - Fixed: Issue with Ico files not found error when adding extra Icons to the resources.
    - Fixed: Made Directives interpreter case insensitive.
*** Updated Tidy.exe v2.0.21 (JdeB)
    - Added: check for write access to input file which will now abort Tidy with console message.
    - Changed: Removed space between unknown UDFs and brace "UnknownUDFname (" and also removed space between "] )".   
    - Fixed: fix E notation format bug when followed by -.
    - Fixed: Recognise #cs and #ce when not followed by a space.
    - Fixed: occasionaly crash with long lines.
*** Updated Obfuscator.exe v1.0.22 (JdeB)
    - Fixed: fix as Obfucator to recognise #cs and #ce when not followed by a space.
    - Fixed: Error in output script when the "/CS 0"  parameter is used.
*** Updated AutoIt3.LUA (Valik)
    - Added function to size the horizontal scroll bar to the proper lenght of the lines.
*** Installer (JdeB)
    - Removed GUIBuilder from installer.
*** Updated CodeSnippet v 1.0.5.9 (garyfrost)
*** Updated Koda v 2.0.1 (lazycat)
Edited by Jos
Fixed link to download page

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

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