Announcement

Collapse
No announcement yet.

Add a EJECT button with NCS !

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?
    Roy

    2005 Range Rover 4.4
    Any ideas for putting a PC in this? :)

    Comment


    • #3
      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")

      Comment

      Working...
      X