Hi Chip,
Thanks, it is a record button inside my Cuckoo Clock program. That
procedure is below and I now pass in the file name and require no path since
they are already there. The reason why I wanted to get away from passing it
in, but that was just a test when the spaces were also present and it forced
me to realize what that field was about.
I will post the Cuckoo Clock upgrade soon. I had done a bit rate of
44000 and that is high quality recording that takes a lot of disk space. Now
have to re-compile down to around 10000 or 5000 to get it in an OK quality
and small .wav files. I might have a choice on quality in the future.
It all works and the file is taking from the sound file edit field for
the name and everything works as expected.
but, since I don't have a Vista or Windows 7 OS I may need to have you
try it and see what happens without the runas option. I did notice that
shell has a executerunas command but did not bother to look at it.
So, in order to upload the upgrade I will need to test this recorder.
Bruce
Sent: Thursday, June 23, 2011 9:40 PM
Subject: RE: Shell In Script
It sounds very clever Bruce, and useful. are you going to post it as part
of some project?
Chip
-----Original Message-----
From: BT [mailto:[email protected]]
Sent: Thursday, June 23, 2011 1:33 AM
To: [email protected]
Subject: Re: Shell In Script
Hi Chip,
I found very good documentation outside of the MSDN library, then
finally found it inside the MSDN; searches are real pain with google...
the parms are what I use below and I could not find anything on the
"runas" but probably under Vista or windows7 where I did not bother to look.
The program is inside the compiled
Python folder as I labeled it and there are 3 programs there, Play, Record,
or RecordAndPlay.exe files.
so, any prompt message, raw_Input inside Python gets verbalized
perfectly but don't use it so path and name is inside the edit fields. I
stuck it there for testing only.
No parens are required for the Shellexecute if you don't care about the
return code, but put it there for any future needs.
so, this thread and project is done and works!
sincerely
Bruce
My Queued Procedure:
Sub RecordAndPlay()
Dim winType: wintype = 3
' Activates the window and displays it as a maximized window.
Dim WshShell
' Set WshShell = CreateObject("WScript.Shell") Set WshShell =
CreateObject("Shell.Application") Dim ReturnCode Speak "Now Recording and
press escape or return key to quit "
' Program does have a prompt and Windoweyes does speak it.
' Format: oBj.ShellExecute (FileSpec_FileName, Parms, workingDir,
"Verb_Action", typeWindow) ReturnCode = WshShell.ShellExecute
(clientPathToWav & "RecordAndPlayWav\RecordAndPlay.exe", "Testing52.wav",
scriptPathToWav, "open", winType) ', "runas"
Set WshShell = Nothing
Set winType = Nothing
Set ReturnCode = Nothing
End Sub
Sent: Wednesday, June 22, 2011 10:31 PM
Subject: Re: Shell In Script
Chip,
I need to have the description of each field. I found an execute
description but is for studio VB and not VBS. Assuming they may be the same.
I need to know the best description of this method and which field is
for passing parms. The run command places them in the same string as the
file name since there I am looking at the arguments after the name.
Is the field with nothing in it for parameters? Or is that for the
directory path?
Bruce
loShell.ShellExecute fileName, "/passive", "", "runas"
Sent: Wednesday, June 22, 2011 10:14 PM
Subject: Re: Shell In Script
Hi chip,
Yes, as I had just said, the runas only places a security thing up which
may be for Vista and maybe windows 7, I have neither, so I don't know but
suspect that is why you added it.
Now, the ShellExecute does work for running the program but the parms
are not getting in. Now, the Recordandplay.exe or RecordAndPlay.exe program
works and even plays back the file recorded.
but, it is no where to be found. Attempting to pass in the path and I
did. I got it to display part of it in the prompt message but the entire
path is not being displayed, so have no clue to where it is going. It is
going to the documents folder but what sub folder I don't know.
All I know is it works with the execute, but can not find the file.
bruce
Sent: Wednesday, June 22, 2011 9:32 PM
Subject: RE: Shell In Script
Yes; my one idea is that WE isn't doing anything to the parms. as I said
earlier, use a different object's run method if you're having troubles with
this one, and you're sure you have the path correct. the one I sent you
will work fine.
Chip
-----Original Message-----
From: BT [mailto:[email protected]]
Sent: Wednesday, June 22, 2011 6:11 PM
To: [email protected]
Subject: Re: Shell In Script
Hi Again,
I got the errors down to just one thing, it can not find the file.
I took out everything but the actual .exe file and it says it can not
find it.
the pathtowav is the client information path with the "\" added at the end.
Dim ReturnCode: ReturnCode = WshShell.Run( clientPathToWav &
"RecordAndPlayWav\RecordAndPlay.exe", winType, True)
Now, the only thing that could be going wrong is how WE processes all
the parms in the field.
Any ideas?
Bruce
Sent: Wednesday, June 22, 2011 3:48 PM
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