Results 1 to 3 of 3

Thread: Add a EJECT button with NCS !

  1. #1
    Maximum Bitrate netsuo's Avatar
    Join Date
    Jan 2003
    Location
    Switzerland
    Posts
    557

    Add a EJECT button with NCS !

    After spaceman's question about eject cd button not found, i tried toi do it in neocarscript.

    And it WORKS !

    So, here's how to do it:

    1. create a blank NCS using a text editor
    2. copy/paste this code

    Code:
    '////////////////////////////////////////////////////////////////////////
    ' EXAMPLE NEOCAR SCRIPT
    '////////////////////////////////////////////////////////////////////////
    
    'INFORMATIONS
    '/////////////
    NAME=Eject CD/DVD Script
    AUTHOR=netsuo
    DATE=2005.04.19 08:15:00
    DESCRIPTION=Eject the CD/DVD Rom
    EXECUTE=FUNCTION:Eject DVD/CD-Rom
    '->
    '	FUNCTION:XXX		: XXX is your function's name. While setting this, never executed but added to the actions list. You can then access this function using buttons actions in skin.xml (Example: <ACTION>SCRIPTS_FUNCTION;your_function_name</ACTION>)
    '	NMC_START			: executed while starting NMC, after loading skin and config
    '	NMC_CLOSE			: executed while stopping NMC
    '	MODULE_START:XXX	: executed on start of desired module (where XXX is one of the following: ALL/APPLICATIONS/VIDEO/AUDIO/PHOTOS/FILELIST/MAIN)
    '	MODULE_CLOSE:XXX	: executed on start of desired module (where XXX is one of the following: ALL/APPLICATIONS/VIDEO/AUDIO/PHOTOS/FILELIST/MAIN)
    '	TRACK_START:XXX		: executed when track starts playing (where XXX is one of the following: APPLICATIONS/VIDEO/AUDIO/PHOTOS)
    '	TRACK_END:XXX		: excuted when track ends (where XXX is one of the following: APPLICATIONS/VIDEO/AUDIO)
    '	TIMER				: executed in a timer with "100" msec interval
    '////////
    '	IMPORTANT NOTE		: you can combine EXECUTE events by adding a "|" seperator. Example: MODULE_CLOSE:AUDIO|MODULE_START:AUDIO
    
    'START CUSTOM SCRIPT
    '///////////////////
    '-> here between "START" and "END" you can enter any VBScript code. (see NCS reference for objects available)
    
    NCS_START
    	
    	'Use WMP to eject CDRom
    	Set oWMP = CreateObject("WMPlayer.OCX.7")
    	Set colCDROMs = oWMP.cdromCollection
    
    	if colCDROMs.Count >= 1 then
            For i = 0 to colCDROMs.Count - 1
                    colCDROMs.Item(i).Eject
            Next
    	End If
    
    NCS_END
    3. Copy the file in scripts folder
    4. Open NPC and select the button you want to become "EJECT CD/DVD"
    5. Dble-click on it
    6. In actions list, select "SCRIPTS_FUNCTION"
    7. Choose your function in the combobox
    8. Save skin.
    9. Run NMC, click on your button and... YEAH

    Hope you like it, it shows the power of NCS
    NS - neocar suite
    -----------------
    http://www.neocarmediacenter.com

  2. #2
    Raw Wave RoyN's Avatar
    Join Date
    Sep 2004
    Location
    São Paulo, Brazil
    Posts
    3,534
    Cool, this will eject all drives on the machine tho! LOL!

    You can probably adjust the

    colCDROMs.Item(i).Eject

    to

    colCDROMs.Item(0).Eject or colCDROMs.Item(1).Eject

    if you have multiple and only want to eject 1 at a time! but this is really cool!

    Also, where do we find out the name to use in CreateObject for a particular OCX we use in VB? is it easy?

  3. #3
    Newbie karifan's Avatar
    Join Date
    May 2005
    Location
    Germany
    Posts
    23
    only to the completeness..
    just another example for an eject button, using invokeverbs.. like selecting a command from an item's shortcut menu...

    Code:
    NAME=Uni CD/DVD-Rom Script
    AUTHOR=karifan
    DATE=2005.06.08 12:15:00
    DESCRIPTION=Do something with the CD/DVD-Rom
    EXECUTE=FUNCTION:Uni DVD/CD-Rom 
    
    NCS_START
    
    Dim ShApp, CDex
    Set ShApp=CreateObject("Shell.Application")
    Set CDex=ShApp.NameSpace(17).ParseName( "E:\" )
    CDex.InvokeVerb("E&ject")
    
    NCS_END
    could be used for autoplay the CD:
    CDex.InvokeVerb("Auto&Play")
    or other verbs..

    note: must be specified to the CD letter... e.g.. 'E:/'
    and the invoked verbs are dependent on OS and language.

    for example on a German WinXP its:
    CDex.InvokeVerb("A&uswerfen")

Similar Threads

  1. Relocating computer power button
    By King_Xerxes in forum General Hardware Discussion
    Replies: 8
    Last Post: 02-21-2007, 10:15 PM
  2. button repeating bug?
    By scott_fx in forum Centrafuse
    Replies: 3
    Last Post: 02-24-2005, 12:35 AM
  3. Shuttle power button?
    By mazda3uzr in forum Power Supplies
    Replies: 2
    Last Post: 02-06-2005, 05:36 PM
  4. PC power button problem
    By BMp3W in forum Power Supplies
    Replies: 4
    Last Post: 10-12-2002, 03:36 AM
  5. internet button on my pc
    By babas151 in forum General Hardware Discussion
    Replies: 10
    Last Post: 05-31-2002, 03:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •