Jump to content

TheFluffyOne

Members
  • Posts

    12
  • Joined

  • Last visited

TheFluffyOne's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Many thanks to everyone for the replies, and sorry for not acknowledging them sooner -- I really must turn on watching of my own posts
  2. I've got a bunch of scripts that get run on end-user machines, and if a condition occurs that I didn't think to handle (ahem) the user gets a dialog on their screen telling them there was an AutoIt error -- not desirable! Having had a dig around, I've found the OnExitFunc option, which sounded like it might allow me to hide the error message, however it either doesn't work that way or I'm not using it correctly: Opt("OnExitFunc", "myExitFunction") callInvalidFunction() Func myExitFunction() ConsoleWriteError("An error occurred: " & @error) EndFunc I appreciate that the ConsoleWriteError is pretty useless here; it's just a placeholder for some more sensible code to output debug information to a file. The problem is that when I compile this to an EXE it doesn't seem to make a difference. I still get a dialog on the screen advising me of the error. Do I have the right function, or is there another way to do this?
  3. Yes, in some cases the path will have spaces and when this happens it will be quoted like so: [global] command=wscript.exe commandline="c:\some folder\with spaces\myscript.vbs" "c:\Program Files\Noddy Program\fixme.txt"
  4. The INI files are historical files supplied from elsewhere. For various reasons it is not a good idea for us to modify these.
  5. Suffers from the same problem as the suggestion by Valuater, unfortunately. Thanks anyway. Btw, the font you are looking for (the Common Tasks pane font) is 8pt Tahoma Bold with anti-aliasing disabled.
  6. The problem here is that my second example gets mangled to: wscript.exe ""c:\some folder\with spaces\myscript.vbs" scriptinput.txt" This also won't launch. I need to cope with entries that are completely enclosed in quotes as well as those that are not.
  7. I don't understand how this would resolve the problem. Could you explain please?
  8. Would it be practical for you just to download the web page directly into your script? Or possibly even just save the page out to an HTML file and read that into your script? Reading memory from another process seems a rather unusual way to achieve this.
  9. I am parsing INI files for entries used to launch other processes. A stripped-down example of such a file might be: [global] command=wscript.exe commandline="c:\some folder\with spaces\myscript.vbs" I'm using IniRead to grab these values like so: $commandName = IniRead("test.ini", "global", "command", "") $commandParams = IniRead("test.ini", "global", "commandline", "") $fullCommand = $commandName & " " & $commandParams ConsoleWrite($fullCommand) However IniRead is stripping the quotes from the value, so the output of the script is: wscript.exe c:\some folder\with spaces\myscript.vbs In the full script this fails because wscript.exe tries to load a script called "c:\some". If, however, I have a value that doesn't start and end with a quote, the path is quoted as expected. An example of an INI file that would work: [global] command=wscript.exe commandline="c:\some folder\with spaces\myscript.vbs" scriptinput.txt The output when using this as input is: wscript.exe "c:\some folder\with spaces\myscript.vbs" scriptinput.txt Is this expected behaviour? If so, does this mean I'm going to have to write my own INI parser to work around this behaviour? (Note that the INI files are from an old system, which is why I can't just alter the input file format).
  10. Thanks for the reply, and the welcome As mentioned in my original post, I was able to get the STDOUT/STDERR information when using Run. The issue is that the RunWait function doesn't allow me to read the standard output streams and that Run doesn't let me read the return code. I had already checked the help file under Run, RunWait, StdOutRead, and StdErrRead and couldn't see a way to achieve what I wanted. The code posted by ProgAndy looks to be the (slightly complex) solution muttley
  11. Thanks ProgAndy. I'm surprised it needs that much work, but that code should do the job. Cheers!
  12. I have some VBScripts that I wish to launch from a deployment tool that will only run BAT, CMD, and EXE files. Having seen AutoIt's ability to convert scripts to EXEs it seems the ideal way to solve my problem without resorting to a lower-level language. So I've created an AutoIt script that launches cscript.exe with the script name as a parameter and at a basic level this works. Using RunWait I was able to launch the scripts and check the return code (passing this out to the deployment tool so it knew if the task was successful or not). Unfortunately all of my debug information goes to STDOUT/STDERR and when using RunWait this appears to be routed to a black hole by default. I switched to using Run so that I can read the debug info and pass it back out to the calling app, and this works just fine. Except there now doesn't seem to be a way to read the return code muttley So can I have my cake and eat it? Can I spawn a process, read its STDOUT/STDERR streams, *and* check its return code using AutoIt?
×
×
  • Create New...