Thanks Bruce for the info. just leave off the "runas" then (if you know you'll never need a prompt for increased security), and that should work for you then right?
Chip -----Original Message----- From: BT [mailto:[email protected]] Sent: Wednesday, June 22, 2011 10:10 PM To: [email protected] Subject: Re: Shell In Script Hi Chip, it is because that is the.vbs file version and the app version has none of that. The path is missing and execute works but no place for the file to be found. except once found in the windoweyes program files directory... the runas option displays the security stuff. Without it I get my prompt and it works. but no path... the original error display nothing so I had to guess, but the next time powering-up I got the line number and error instead of the line 1 error and it said, "File not found" So the path is the issue for the run command. Bruce Sent: Wednesday, June 22, 2011 9:29 PM Subject: RE: Shell In Script Bruce, you shouldn't be using the line: Set WshShell = WScript.CreateObject("WScript.Shell") and I don't know why that isn't giving you an error, unless you've opened wScript earlier? there's no need to use it's createObject, since the one built into WE will work fine. I don't know why you'd be having a problem with wScript.run, but there's no reason not to use the example I sent you. I don't have it's docs handy, so I don't know if it has a parameter to control the initial window or not, but that should be the only difference (if it doesn't). the "runas" parameter will have no effect if a prompt isn't needed. I don't think it's correct to keep saying "we doesn't like external scripts". if you want to start a vbs running under WSH, you can do so. Chip -----Original Message----- From: BT [mailto:[email protected]] Sent: Wednesday, June 22, 2011 3:48 PM To: [email protected] Subject: Re: Shell In Script Chip, Below is the script that works inside the default directory. But WE does not like calling an external script. I placed this inside the app and dies at the point of calling the run... I looked at the external suggestion you made last night but have not tested it yet. Was not sure of all the parms to pass in yet. Below uses all the parms I pass in, but as I said, don't need to play back and would not need to pass in any more than the file name. winType of 3 allows keyboard interaction and True is for waiting until script is done... Bruce Dim wintype: winType = 3 '3 Activates the window and displays it as a maximized window. Dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") Dim ReturnCode: ReturnCode = WshShell.Run( "RecordAndPlayWav\RecordAndPlay.exe Test.Wav 3", winType, True) Set WshShell = Nothing Set winType = Nothing Set ReturnCode = Nothing Sent: Wednesday, June 22, 2011 3:28 PM Subject: Re: Shell In Script Hi Chip, I was looking at the Burn to CD and it uses the Homer stuff. Does that also fail in Vista? Knowing that Vista liked to destroy everything... I wrote a simple record and play routine in Python. It needs no prompt, just pass into it the file name and if you want to also play back, but I can also have 2 executables for that, but playsound would be the one to use at that point... So, no prompt needed, just to pass in a file name, but can also have an input statement inside the record instead of passing in the name. I already have a .vbs file that can do all of that, but WE does not like external scripts. That uses the run method with the option for window opened full size to allow the use of keys to stop record and exit. But, it is an external script. No big deal, but an option for an option to record wav files. Bruce Sent: Wednesday, June 22, 2011 9:38 AM Subject: RE: Shell In Script Hi Bruce, you can look at either wScript.shell or shell.application, depending on what you need. If you need to run an executable command, and you'd like that command to not fail in Vista/win 7, but to use the UAC prompt if necessary, have a look at the lines below which I use in one of my apps to do this: Set loShell = CreateObject("Shell.Application") Speak "Now running the WSRMacros installation program." loShell.ShellExecute fileName, "/passive", "", "runas" It's the "runas" parameter which allows UAC to prompt the user. hth, Chip -----Original Message----- From: BT [mailto:[email protected]] Sent: Tuesday, June 21, 2011 9:23 PM To: [email protected] Subject: Shell In Script Hi! One question, what is used to do a shell command in script? bruce
