Xenobiologist Posted January 22, 2010 Share Posted January 22, 2010 Hi everybody, anybody an Autoit function to strip all comments from an Autoit source code? (should be fast!) Thanks for sharing! Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 22, 2010 Moderators Share Posted January 22, 2010 Xenobiologist, Obfuscator with /STRIPONLY parameter. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 22, 2010 Author Share Posted January 22, 2010 Xenobiologist,Obfuscator with /STRIPONLY parameter.M23You see the code? I need the Autoit code for another Autoit script. Besides, I already asked Jos for the function Obfuscator is using. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 22, 2010 Moderators Share Posted January 22, 2010 Xenobiologist, Original: #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so ; Comment ; Comment ; Comment MsgBox(0,"Hi","I'm Obfuscated with /SO") ; Comment ; Comment ; Comment Exit ; Comment ; Comment ; Comment Obfuscated with /SO MsgBox(0,"Hi","I'm Obfuscated with /SO") Exit Looks like what you wanted, no? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ProgAndy Posted January 22, 2010 Share Posted January 22, 2010 Xenobiologist, Looks like what you wanted, no? M23 He wants do do it in plain AutoIt, without using an external application. I have sent him something I have coded, though. This is what I came up with: (1.1 secs for SQLite.dll.au3, 0.2 secs for WinAPI.au3) Func _stripComments(ByRef $string) ;Author: Prog@ndy #Region remove nested block-comments $string = StringReplace(StringReplace($string, "#comments-start", "#cs", 0, 2), "#comments-end", "#ce", 0, 2) Local $match, $depth, $offset, $start, $CommentsAfterce While 1 $depth = 0 $match = StringRegExp($string, "(?i)(?m)^\h*#cs\b", 1) $start = @extended If @error Then ExitLoop Do $match = StringRegExp($string, "(?i)(?m)^\h*(#cs|#ce)\b", 1, $offset) $offset = @extended If @error Then Return False Switch $match[0] Case "#ce" $depth -= 1 Case Else $depth += 1 EndSwitch Until $depth < 1 $string = StringLeft($string, $start-4) & StringRegExpReplace(StringMid($string, $offset), ".*", '', 1) WEnd #EndRegion remove nested block-comments $string = StringRegExpReplace($string, '(?m)^((?:[^''";]*([''"]).*?\2)*[^;]*);.*$', '\1') ; remove one-line comments Return True EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Mat Posted January 22, 2010 Share Posted January 22, 2010 (edited) Quick hack and not pretty: ; This is the first comment! $sString = FileRead(@ScriptFullPath) ; Another comment $sString = StringRegExpReplace($sString, "(.*)?;.*", "\1") ; End of line comment! (Matches last comment char) MsgBox(0, "Test", $sString) Edit: Looks like theres a much better solution above though Edited January 22, 2010 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 22, 2010 Moderators Share Posted January 22, 2010 ProgAndy,He wants do do it in plain AutoIt, without using an external applicationSorry, my mistake. It has been a long day.... M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MvGulik Posted January 23, 2010 Share Posted January 23, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 23, 2010 Author Share Posted January 23, 2010 Thanks to all. I'll have a look whether I can tune the one from Andy. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
MvGulik Posted October 26, 2010 Share Posted October 26, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now