argumentum Posted April 12, 2019 Share Posted April 12, 2019 ..coding ..., I'm changing my style of coding to something more manageable. I make more #includes and test those, then those, are part of the main script. Ala UDF ( but not a UDF, just independently running ) While coding and testing each file I write a bunch of code that is not desired in the final stripped script. To remove those lines I do not want in the ( obfuscated by /RenameMinimum ) stripped file, I've added an option: #Au3Stripper_Skip_On and #Au3Stripper_Skip_Off I implemented it, by editing the AutoIt3Wrapper expandcollapse popup... ... Case $H_COMPILE, $H_SaveOnly ; Validate Extra resource Information $Au3StripperCmdLineRaw = GUICtrlRead($H_Au3Stripper_Parameters) ; added this ... ... Au3Stripper_rcwl($ScriptFile_In_stripped) ; added this ; Run au3check on the stripped source If $ExitCode > -1 And $ExitCode < 999 And $INP_Run_AU3Check = "y" Then Run_Au3Check($ScriptFile_In_stripped) EndIf Else __ConsoleWrite("! *** Au3Stripper Error: *** Skipping Au3Stripper: " & $Au3Stripperpgm & " Not Found !" & @CRLF & @CRLF) $ScriptFile_In_stripped = $ScriptFile_In $INP_Run_Au3Stripper = "n" EndIf $ScriptFile_In = $ScriptFile_In_stripped EndIf EndIf #EndRegion Run Au3Stripper Func Au3Stripper_rcwl($ScrptFl_In_strppd) ; added this If Not StringInStr($Au3StripperCmdLineRaw, "/rcwl") Then Return Local $s = "", $a = FileReadToArray($ScrptFl_In_strppd) Local $w = 0, $i = 0, $h, $n, $u = UBound($a) - 1 For $n = 0 To $u If StringInStr($a[$n], "#Au3Stripper_Skip_On") Then $w = 1 If StringInStr($a[$n], "#Au3Stripper_Skip_Off") Then $w = 0 $i += 1 ContinueLoop EndIf If $w Then $i += 1 ContinueLoop EndIf If StringInStr($a[$n], "ConsoleWrite(") Then $i += 1 ; ..this part is the one that removes ContinueLoop ; the "ConsoleWrite" but I undertand that may EndIf ; lead to more problems that solutions. Not part of the request. $s &= $a[$n] & @CRLF Next $h = FileOpen($ScrptFl_In_strppd, 2) If $h = -1 Then __ConsoleWrite('!> Au3Stripper_rcwl failed to open "' & $ScrptFl_In_strppd & '"' & @CRLF) EndIf FileWrite($h, $s) FileClose($h) __ConsoleWrite('--- > removed ' & $i & ' extra lines due to /rcwl option. (mod.)' & @CRLF) EndFunc ;==>Au3Stripper_rcwl #Region Compile the script ... ... so I add ... ... ConsoleWrite(Chr(0) & '#Au3Stripper_Skip_On' & @CRLF) If "my_script_testing.au3" = @ScriptName Then Exit the_func_Ill_Use_later() ConsoleWrite(Chr(0) & '#Au3Stripper_Skip_Off' & @CRLF) ... ... ...so, I've solved my problem, so what do I request ?. Nothing really, I think it would be welcomed to have this ON/OFF as part of Au3Stripper 😀 ( the emoji is to persuade you ) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
BrewManNH Posted April 13, 2019 Share Posted April 13, 2019 That, or something similar, is already included in Au3Stripper, isn't it? Quote #Au3Stripper_Off Stop the Stripping process below this line #Au3Stripper_On Start the Stripping process below this line #Au3Stripper_Ignore_Funcs= Do not Strip these functions. FuncNames may end with an * to indicated matching FuncNames starting with the specified string. #Au3Stripper_Ignore_Variables= Do not Strip these variables. VarNames may end with an * to indicated matching VarNames starting with the specified string. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
argumentum Posted April 13, 2019 Author Share Posted April 13, 2019 If you look at the code I posted, you'll see that it removes the lines between the Skip_On/Skip_Off from the compiled script. #Au3Stripper_On/Off is to, not alter the lines between Off/On. Say, you have Assign() / Eval() and want to use the option "/RenameMinimum". Being able to, not "/rm" those lines, would allow the script, to not break, due to the renaming of the variables. There is no options currently, that remove chunks of code from the script. And I understand that "why would you want that? ..just don't write it !", but there is usefulness to it. It let's me have the "developer version" and the "final compiled version", all in one, without sanitizing/cleaning up, beforehand. But is like anything else. If the option is there, you can explore the usefulness, or not. I for once, just start using the Stripper recently and found that I'll have to change the way I code to use it. All this new request does is to have more possibilities on how one can go about coding. Again, is not an issue for me, as I've patched my version to fit my needs. But I believe it would be a welcomed option for the community. ... I would still use a mod. to remove the lines with "ConsoleWrite(", if that aspect is not implemented. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted April 13, 2019 Author Share Posted April 13, 2019 (edited) @BrewManNH, a picture code is a thousand words. <attachment snipped by argumentum> PS: now that I read it again, I've should of call it differently, as skip is not what it does. RemoveSource is what it does. Edited April 13, 2019 by argumentum afterthought Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2019 Developers Share Posted April 13, 2019 So let me get this straight: you are asking for an option to always strip the code between those directives? 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 More sharing options...
argumentum Posted April 13, 2019 Author Share Posted April 13, 2019 Yes @Jos And maybe call the directive other than "Skip". I liked this word "Strip". Call it #Au3Stripper_Strip_On / #Au3Stripper_Strip_Off ?, no clue, English is a 2nd language for me and I'm not sure how it feels, one word from another, writing down the directive. I thought of "Exclude", Exclude_On / Exclude_Off. And the ConsoleWrite thing if you feel is ok too. You can try the attached modified Wrapper with example in my past post, to see/verify, that is safe to implement. The thing is that, with the simple code I've written, the "/rsln" would end up with the wrong @ScriptLineNumber Even tho, all this may be very unorthodox, I found these requested options quite useful. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2019 Developers Share Posted April 13, 2019 Call me slow, but could you give me an example script were you always want to strip lines that aren't stripped automatically by Au3Stripper, as this doesn't make sense to me as yet? 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 More sharing options...
argumentum Posted April 13, 2019 Author Share Posted April 13, 2019 I've posted ( https://www.autoitscript.com/forum/topic/198550-au3stripper-request-au3stripper_skip_on-au3stripper_skip_off/?do=findComment&comment=1424722 ) above. Unless you'd like a more real life example, but i'll take me time to write it. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2019 Developers Share Posted April 13, 2019 Ah, the attachment. This is actually very simple to do although I doubt I ever use it. Try the current Beta version with this code: #AutoIt3Wrapper_Run_Au3Stripper=y #au3stripper_alwaysstrip_on call ("useless_test") Func useless_test() ConsoleWrite('--- this will not be in the compiled nor in the stripped file' & @CRLF) MsgBox(0, @ScriptName, "non sense", 1) EndFunc #au3stripper_alwaysstrip_off ConsoleWrite("this" & _ " will not be in the code" & _ "" & _ "" & @CRLF & _ " =)") MsgBox(0, @ScriptName, "yolo", 5) Or this of course will also work: #AutoIt3Wrapper_Run_Au3Stripper=y #au3stripper_alwaysstrip_on call ("useless_test") #au3stripper_alwaysstrip_off Func useless_test() ConsoleWrite('--- this will not be in the compiled nor in the stripped file' & @CRLF) MsgBox(0, @ScriptName, "non sense", 1) EndFunc ConsoleWrite("this" & _ " will not be in the code" & _ "" & _ "" & @CRLF & _ " =)") MsgBox(0, @ScriptName, "yolo", 5) Jos argumentum 1 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 More sharing options...
argumentum Posted April 13, 2019 Author Share Posted April 13, 2019 6 minutes ago, Jos said: Try the current Beta version with this code: Beautiful !, exactly what I wanted =D Will you have a switch/option to choose for the consoleWrite stripping ?, or if you use #au3stripper_alwaysstrip_* it assumes is desired ? Thanks a million ! Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted April 13, 2019 Author Share Posted April 13, 2019 22 minutes ago, argumentum said: Will you have a switch/option to choose for the consoleWrite stripping ? oops, ...I had my directives up on top and in my mod. wrapper, so I did not realized you've implemented just the #au3stripper_alwaysstrip_* part. =/ Did not meant to push Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2019 Developers Share Posted April 13, 2019 37 minutes ago, argumentum said: Will you have a switch/option to choose for the consoleWrite stripping ? No that is not in the planning. Autoit3wrapper can comment out or delete all debug and trace consolewrite statements and that is all I need. Jos argumentum 1 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 More sharing options...
argumentum Posted April 13, 2019 Author Share Posted April 13, 2019 4 minutes ago, Jos said: Autoit3wrapper can comment out or delete all debug and trace consolewrite statements Can you tell me how?, I did not know that Autoit3wrapper can do it. Nor I can find where from. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2019 Developers Share Posted April 13, 2019 For example: Put your cursor on a variable and press Alt+d to a an Console Debug line for that variable. Do that for multiple things you like to get console debug information on. Press Alt+Shift+d to comment all these Debug lines. Press Alt+Ctrl+d to uncomment all these Debug lines again. Press Alt+Ctrl+z to Delete all these Debug lines again. (Wondering why I made that helpfile as it is all in there or this nifty Tools dropdown box which contain all of these functions) Jos mLipok, argumentum and Skysnake 1 1 1 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 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