Re: .vbs file only locks up inside a batch file.. why?
From: Chris Barber (chris_at_blue-canoe.co.uk.NOSPAM)
Date: 03/04/04
- Next message: Microsoft: "Re: Need equivalent of Win32_LocalTime on W2K"
- Previous message: Torgeir Bakken (MVP): "Re: Change Date Format Please"
- In reply to: Robert Cohen: "Re: .vbs file only locks up inside a batch file.. why?"
- Next in thread: JP: "Re: .vbs file only locks up inside a batch file.. why?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Mar 2004 23:48:03 -0000
I tried it and got the same effect (WinXP Pro) - a divorced cscript.exe
instance in the Task Manager indicating that the script engine instance was
being held open.
NB: The CD drawer does close with the double .Eject method in the script.
Chris.
"Robert Cohen" <dont@want.spam.com> wrote in message
news:uJ9vfAjAEHA.3004@TK2MSFTNGP10.phx.gbl...
Sorry, didn't read your vb script better; here is your answer; you can close
the cd player with the script only to open it. See link.
http://www.waxy.org/archive/2003/03/27/open_cdr.shtml
But for your questions:
actually I mentioned the logging on only in passing. I have a logon.bat for
a logon script. I use that to run different vbs at logon.
yeah I could do batch mode over interactive, but I like to see what is going
on. batch mode will suppress any errors and I won't see it.
to be honest I don'tremember what exactly "%0\..\" does; I think it says
that the vbs file is in the same folder that the bat file is run from
Robert Cohen
A legend in his own mind
--
"JP" <sendmenospam@getlostscum.com> wrote in message
news:cPudnXkthLkPCNrdRVn-gw@comcast.com...
> Please refresh my memory. Does %0 expand to the full path? I'm not
> sure what logging on has to do with my script? I plan to make this an
> desktop shortcut or keystroke shortcut. I understand nologo for a
> cleaner display, but why the interactive mode?
>
> Robert Cohen wrote:
>
> > this is what I do to call a vbs from a batch file for a logon script:
> >
> > cscript //i //nologo %0\..\closecdroms.vbs
> >
> > --
> > Robert Cohen
> > A legend in his own mind
> > --
> >
> > "JP" <sendmenospam@getlostscum.com> wrote in message
> > news:RKidnWlPa5iE6drdRVn-gg@comcast.com...
> >
> >>The code shown below is totally baffling this novice. The purpose of
> >>the code is to close ALL the cd-rom trays on my local computer. Simple
> >>enough, right? No matter how its executed, all the code inside the vbs
> >>file runs just fine. I know this because it gets to the last line,
> >>which is a test message that gets displayed. But to get the vbs file to
> >>release control back the batch file that it was called from, I have to
> >>run win-xp's task manager and delete the cscript.exe or wscript.exe
> >>process. Only then does the rest of my batch file run. I have another
> >>clue. By process of elimination, I found the code that causes the vbs
> >>file to "stall":
> >>
> >>colCDROMs.Item(i).Eject : colCDROMs.Item(i).Eject
> >>
> >>But when I put the code back, it closes the cd tray like it should. The
> >>really waky part is that the vbs file doesn't lockup at the above line.
> >> I even waited 20 minutes for the vbs file to close the cscript.exe
> >>program. I can see the "imapi.exe" execute and close in the task
> >>manager list. I have tried running the batch file several different
> >>ways. I have clicked on it in explorer, used the run command in the
> >>start menu, and even opened a command prompt and hand typed the batch
> >>file and pressed enter. Same result.
> >>
> >>This is not my code. I found it at several places on the web. Plase
> >>edit as needed. Any help would be appreciated. Let me know if you need
> >>more info.
> >>
> >>
> >>>' CLOSECDROMs.VBS
> >>>
> >>>dim oWMP
> >>>dim colCDROMs
> >>>dim i
> >>>
> >>>Set oWMP = Wscript.CreateObject("WMPlayer.OCX.7")
> >>>Set colCDROMs = oWMP.cdromCollection
> >>>
> >>>if colCDROMs.Count >= 1 then
> >>>
> >>>For i = 0 to colCDROMs.Count - 1
> >>>colCDROMs.Item(i).Eject : colCDROMs.Item(i).Eject
> >>>Next ' cdrom
> >>>
> >>>End If
> >>>
> >>>oWMP.close
> >>>set colCDROMs = nothing
> >>>set oWMP = nothing
> >>>set i = nothing
> >>>wscript.echo "CLOSECDROMs: Test Message.... It got here."
> >>
> >>
> >>>@echo off
> >>>rem cderase.bat
> >>>rem
> >>>rem
> >>>rem close cd/dvd drives
> >>>cscript "closecdroms.vbs"
> >>>echo It Never gets here!
> >>>rem
> >>>rem
> >>>rem erase o: cd drive, eject tray afterwards
> >>>createcd -v -erase -r:o -eject
> >>
> >>JP
> >>
> >>
> >
> >
> >
>
- Next message: Microsoft: "Re: Need equivalent of Win32_LocalTime on W2K"
- Previous message: Torgeir Bakken (MVP): "Re: Change Date Format Please"
- In reply to: Robert Cohen: "Re: .vbs file only locks up inside a batch file.. why?"
- Next in thread: JP: "Re: .vbs file only locks up inside a batch file.. why?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|