Bluesmaster Posted August 11, 2013 Share Posted August 11, 2013 The preprocessor splits it in 2 commands. > One cannot echo the "|" -sign > One cannot create multiple statements sharing variables > One cannot use piping-commands any solution/ workaround? thanks a trillion Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic] Link to comment Share on other sites More sharing options...
kylomas Posted August 11, 2013 Share Posted August 11, 2013 (edited) BluesMaster, Post your code my crystal ball is broken... kylomas edit: Oops, misread this, apologies to the OP Edited August 11, 2013 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Developers Jos Posted August 11, 2013 Developers Share Posted August 11, 2013 It is correct I am using the | internally to indicate multiple run before commands, but what command do you need to run that requires this Pipe functions that needs to run before compilation? 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...
Bluesmaster Posted August 12, 2013 Author Share Posted August 12, 2013 (edited) Hello Jos, Well that is kind of complicated, some would say its fancy or useless but for me it is very important and I think it would be best practice to let the user decide wheter they need it or not, by making the "|" escapable (or introduce a workaround) In this case I want to implement a Snippet that replaces the hardcoded Path in "fileinstall" by the script itself by replacing the line in the script itself ( kind of reflective technique ). I am following my philosophy of replacing manual processes by "Peace-Of-Mind"-Automation It has to be a one-liner because I need to use variables: Here is an uncomplete Snippet: @echo off & @setlocal enableextensions enabledelayedexpansion & > "C:myScript.au3" (for /f "delims=" %%A in ('type "c:currentScript_replaceByVariableInFuture.au3"^|find /n /v ""') do ( set tst=%%A&set tst=!tst:ab=!&if not !tst!==%%A ( echo FileInstall( "abc" , $targetFile ^) ) else ( set "T=%%A" & call echo.%%T:*]=%% ) ) ) any suggestions? Thanks a lot Bluesmaster Edited August 12, 2013 by Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic] Link to comment Share on other sites More sharing options...
MHz Posted August 12, 2013 Share Posted August 12, 2013 Bluesmaster, A command script is what I would use for all of that which #AutoIt3Wrapper_Run_Before can run. Though you would need to keep the command script with the au3 script. That is just a workaround and not the solution you may like. The reason for pipe to be not split for me would be that a single pipe makes ConsoleRead seem nice to use. Another is that || is used as OR and yet when split on the pipe character, it runs it as an AND. These are known conditions for current @Comspec ; Pipe the output from commandA into commandB #AutoIt3Wrapper_Run_Before=TryThis.cmd | ToThis.cmd ; Run commandA and then run commandB #AutoIt3Wrapper_Run_Before=TryThis.cmd & AndThis.cmd ; Run commandA, if it succeeds then run commandB #AutoIt3Wrapper_Run_Before=TryThis.cmd && WithThis.cmd ; Run commandA, if it fails then run commandB #AutoIt3Wrapper_Run_Before=TryThis.cmd || ElseThis.cmd The 1st and last directive will not work as expected as either side of the pipe will be run with no conditional logic as set, as the split action ruins this command. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 12, 2013 Developers Share Posted August 12, 2013 I could change the delimiter I currently use but the #AutoIt3Wrapper_Run_Before and #AutoIt3Wrapper_Run_After were really setup to be able to execute one or more programs or batchfiles, not to contain one-line batchfile statements. 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...
MHz Posted August 12, 2013 Share Posted August 12, 2013 It looks like you have made a decision Jos with that but word. I just gave some concept of use expected. Some may expect that expected. No need to change though. Link to comment Share on other sites More sharing options...
Bluesmaster Posted August 12, 2013 Author Share Posted August 12, 2013 (edited) Some thoughts: - Why you delimit at all? If you really need multiple statements one could use multiple "#AutoIt3Wrapper_Run_Before=" which increases readability - piping is so elementary important for batch, its the same as stealing the parenthesis from autoIt - coding ist testing. Testing in batch is running a batch-file. If I cant paste the code of my batch file thats bad. If there is absolute no way of executing it (one-liner) that ist...well..why is that? Is that reasonable or just a dogma? regards Bluesmaster - ( why use batch at all? an autoIt coder knows...autoIt. But I understand there can be reasons, for example complexity) Edited August 12, 2013 by Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic] Link to comment Share on other sites More sharing options...
funkey Posted August 12, 2013 Share Posted August 12, 2013 Jos: You could escape the pipe char | like DOS did, with ^. Try type 'echo 123^|456' to console. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
James Posted August 12, 2013 Share Posted August 12, 2013 Jos: You could escape the pipe char | like DOS did, with ^. Try type 'echo 123^|456' to console. Surely the backslash character is a better escape sequence? Regular expressions use it too, so it's consistent. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Developers Jos Posted August 12, 2013 Developers Share Posted August 12, 2013 The modifications needed are pretty simple to provide support for the "|" in the commandlines and the "but" wasn't really meant to indicate I won't be changing it. I was merely trying to state that what the initial intent of these Directives was and hence also the rather simplistic implemention of it in AUtoIt3Wrapper. Will have a look to change AutoIt3Wrapper in a way it supports the | character without the need of any extra escape characters. 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...
Bluesmaster Posted August 12, 2013 Author Share Posted August 12, 2013 Thank you. My suggestion would be to just ignore it, as I cannot see any advantage of splitting the command artificially, but I am sure you will find the best solution regards Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic] Link to comment Share on other sites More sharing options...
Developers Jos Posted August 12, 2013 Developers Share Posted August 12, 2013 Uploaded a new beta version of AutoIt3Wrapper which doesn't use the "|" character internally any more, so allows for commands that contain "|" characters. It will still support the "|" character in case people ever defined the Run_Before or Run_After keywords in the [other] section of Autoit3Wrapper.ini. Let me know when you have issues with that version. Jos 0xdefea7 and Xandy 2 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