473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Timer or button to launch VB script?

118 100+
I am making a CD based website. I have made the code to open the CD tray... (below)

Expand|Select|Wrap|Line Numbers
  1.  
  2. <SCRIPT LANGUAGE="VBScript">
  3. <!--
  4.  
  5. Set oWMP = CreateObject("WMPlayer.OCX.7" )
  6. Set colCDROMs = oWMP.cdromCollection
  7.  
  8. if colCDROMs.Count >= 1 then
  9.         For i = 0 to colCDROMs.Count - 1
  10.                 colCDROMs.Item(i).Eject
  11.         Next ' cdrom
  12. End If
  13.  
  14. -->
  15. </SCRIPT>
  16.  
This code has to be placed in the <head> tag but will execute automatically on the loading of the page. Is it possible to set a timer for it to execute after 60 seconds, for example; or on the click of a button?

Thanks,

Sam
Apr 26 '07 #1
2 2124
AricC
1,892 Expert 1GB
I am making a CD based website. I have made the code to open the CD tray... (below)

Expand|Select|Wrap|Line Numbers
  1.  
  2. <SCRIPT LANGUAGE="VBScript">
  3. <!--
  4.  
  5. Set oWMP = CreateObject("WMPlayer.OCX.7" )
  6. Set colCDROMs = oWMP.cdromCollection
  7.  
  8. if colCDROMs.Count >= 1 then
  9.         For i = 0 to colCDROMs.Count - 1
  10.                 colCDROMs.Item(i).Eject
  11.         Next ' cdrom
  12. End If
  13.  
  14. -->
  15. </SCRIPT>
  16.  
This code has to be placed in the <head> tag but will execute automatically on the loading of the page. Is it possible to set a timer for it to execute after 60 seconds, for example; or on the click of a button?

Thanks,

Sam
This seems like more of a Javascript question or are you trying to do this with VB Script?
Apr 26 '07 #2
helraizer1
118 100+
I was thinking of a button or a timer to launch the code. Using either HTML or Javascript but I'm not sure how to do it. For instance, in a Javascript script the function has a name such as: "function1()" so then you can say using HTML:

<input type="button" onClick="function1()">
-or-
<Body onload="function1()" onunload="stoptimer()"> etc...

But for the VBScript I don't know how to execute it with a button using HTML or Javascript. At the moment when it is in the <head> of my site it executes the script as it loads the page.

Any ideas?

Sam
Apr 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get...
7
by: IntraRELY | last post by:
I am using the following command to launch and .NET VB Executable, which is a simple Windows Form (printCheckClient.exe). I am using a HyperLink Control and works perfect....
3
by: helraizer1 | last post by:
I am making a CD based website. I have made the code to open the CD tray... (below) <SCRIPT LANGUAGE="VBScript"> <!-- Set oWMP = CreateObject("WMPlayer.OCX.7" ) Set colCDROMs =...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.