dupa

Author Topic: Hal can now eject your CDs  (Read 6586 times)

onthecuttingedge2005

  • Guest
Hal can now eject your CDs
« on: October 11, 2003, 01:42:03 pm »
'Here we can just tell Hal to eject CD
'and he will.
'Add this script to your Hals default
'brain.
'This script will only work if you have
'Microsoft Internet Explorer.
'WARNING NOTE: Any user can also open your CD'
'even on AIM instant messenger by the
'command "Eject CD", so use this script
'at your own risk.

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 ' cdrom
End If

'Best of wishes and grand new discoveries.
'Jerry.
« Last Edit: October 11, 2003, 02:44:19 pm by onthecuttingedge2005 »

Morkeleb

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
Hal can now eject your CDs
« Reply #1 on: October 12, 2003, 03:26:41 pm »
Hello,

that could be useful script for some, but the other problem could lead to some unusal and funny circumstances. ie, your listening to cd and some say eject cd to you aim bot, that would be a surprise for the listener.
Ask and you shall learn
Be not afraid to try new things.
----------------------
Check out www.cold-chaos.net

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
Hal can now eject your CDs
« Reply #2 on: October 25, 2003, 11:58:07 pm »
Hi Jerry!
Thanks so much for all your help. Of course this prog. works but only in the defalut brain, just like you said [:)] but is it possible to make it work in a customized brain, if so how do I do it? Should I expect to run into this problem often? What machine tripping feature, (you know what I am trying to say) or whatever, is in the default brain that is absent in all others?
Thanks again for your help.
P
One Person can summon the future...

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Hal can now eject your CDs
« Reply #3 on: November 24, 2003, 03:51:33 pm »
Great script, jerry, only one problem: now whenever i say anything to Hal, he ejects my CDs.  Did i copy something wrong?
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

onthecuttingedge2005

  • Guest
Hal can now eject your CDs
« Reply #4 on: November 24, 2003, 08:42:23 pm »
'Here is a new version of the Eject CD-ROM that requires anyone
'to say a password instead of Eject CD.
'Hal will only open the CD-ROM at password command. You will
'require to type in your own unique password where the word password is below at the UserSentence.
'Eject CD v1.1 ***********
If InStr(1, UserSentence, " Password goes here ", 1) > 0 Then
GetResponse = " I'll open the CD-ROM for you " '<-what Hal will say.
 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 ' cdrom  
End If
End If
'Copyright 2003 2004 Gerald L.Blakley OnTheCuttingEdge2005Yahoo.com
'Best of wishes and grand new discoveries.
'Jerry.
« Last Edit: November 24, 2003, 08:44:09 pm by onthecuttingedge2005 »

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal can now eject your CDs
« Reply #5 on: November 25, 2003, 11:20:03 am »
What I generally do when passing directives to Hal is to include Hal's name in the decoding. For example to command Hal the user must say, "Hal caps Utah". This command sequence is from my Capitalization script. In principle the script might look like:

Command = ComputerName & " caps "
If InStr(1, Trim(OriginalSentence), Command, 1) = 1 Then
 [do something]
End If

Note: ComputerName is a Hal brain variable that contains the name you assign your Hal.

1) One advantage of including Hal's name (whatever you name him/her) is that Hal has script to block saving the user input to brn files if his name is used. This prevents non-dialog sentences or odd grammar from being saved to brn files.

2) Also Hal's name combined with a non-dialog sounding word should make a unique combination that shouldn't occur accidentally. For example "Hal caps " is not likely to occur in a normal dialog.

Therefore my suggestion is something like:

Command = ComputerName & " eject CD "
If InStr(1, Trim(OriginalSentence), Command, 1) = 1 Then
 [eject CD script]
End If

Trimming the UserSentence removes spaces at the beginning and end of the sentence. If the InStr(...) command equals 1 then the ComputerName must start at position 1 in the sentence. Therefore the sequence *must* be "Hal eject CD ". The sequence, "Please Hal eject CD " wouldn't eject the CD. Testing the OriginalSentence variable instead of the UserSentence insures that the "Reverse Person" and other mod's made to UserSentence don't confuse detection of the command phrase. OriginalSentence contains the user's sentence without any mod's.

Just my 2 cents...


= vonsmith =

 

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Hal can now eject your CDs
« Reply #6 on: November 25, 2003, 07:35:54 pm »
quote:
Originally posted by onthecuttingedge2005

'Here is a new version of the Eject CD-ROM that requires anyone
'to say a password instead of Eject CD.
'Hal will only open the CD-ROM at password command. You will
'require to type in your own unique password where the word password is below at the UserSentence.
'Eject CD v1.1 ***********
If InStr(1, UserSentence, " Password goes here ", 1) > 0 Then
GetResponse = " I'll open the CD-ROM for you " '<-what Hal will say.
 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 ' cdrom  
End If
End If
'Copyright 2003 2004 Gerald L.Blakley OnTheCuttingEdge2005Yahoo.com
'Best of wishes and grand new discoveries.
'Jerry.


Hmm, this doesn't work either, now hal doesn't do anything at all when i give him the password. Should this script work in the 4.5 Brain?
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

onthecuttingedge2005

  • Guest
Hal can now eject your CDs
« Reply #7 on: November 25, 2003, 08:36:54 pm »
Hi SilentNinja2.
Are you running internet explorer 5.0 or above.
The script will not function without it.
Just helping you troubleshoot.
The script works everytime on my system and I have
Internet Explorer 6.0.
Best of wishes and grand new discoveries.
Jerry.

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Hal can now eject your CDs
« Reply #8 on: November 26, 2003, 07:34:12 am »
quote:
Originally posted by onthecuttingedge2005

Hi SilentNinja2.
Are you running internet explorer 5.0 or above.
The script will not function without it.
Just helping you troubleshoot.
The script works everytime on my system and I have
Internet Explorer 6.0.
Best of wishes and grand new discoveries.
Jerry.


I am running Internet Explorer 6.0 as well.  Do you mean i have to have internet explorer open when i tell Hal to eject a CD?
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

onthecuttingedge2005

  • Guest
Hal can now eject your CDs
« Reply #9 on: November 26, 2003, 07:44:09 pm »
Hi SilentNinja2
No, It's not required to have Internet Explorer open.
Short for OLE Control Extension, an independent program module that can be accessed by other programs in a Windows environment. OCX controls end with a .ocx extension. OCX controls represent Microsoft's second generation of control architecture, the first being VBX controls written in Visual Basic.
Both VBX and OCX controls have now been superseded by ActiveX controls. However, ActiveX is backward compatible with OCX controls, which means that ActiveX containers, such as Microsoft's Internet Explorer, can execute OCX components.
Is anyone else having an Eject CD problem?
Mine seems to be working great,
SilentNinja2 are you having the problem when speech is used or written text or both?

Best of wishes and grand new discoveries.
Jerry.
« Last Edit: November 27, 2003, 02:00:34 am by onthecuttingedge2005 »

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Hal can now eject your CDs
« Reply #10 on: November 26, 2003, 11:31:07 pm »
Allright, I fixed it myself, i was putting it in the wrong spot.  I kept putting the scripts closer to the end of the Brain til i saw a brain you made, jerry, called "main brain" or something like that, and all the custom scripts were in the middle, lol. Well, i'm an idiot! At least all the hours i've been spending poking around in Hal's brain in the brain editor have taught me some of the basics of Visual Basic.
« Last Edit: November 28, 2003, 10:31:11 pm by SilentNinja2 »
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

onthecuttingedge2005

  • Guest
Hal can now eject your CDs
« Reply #11 on: November 27, 2003, 02:13:25 am »
Hi vonsmith
I usually just say Hals name when saying the password because the BlockSave will detect Hals name, Like: Hal, Password.
You could include your command for Hal but all you need to do is just include Hals name when you're saying the password and we'd get the same effect from the script that's already in the Brain called:
'PROCESS: BLOCK LEARNING IF HAL'S NAME IS DETECTED
   'Here we check to see if the user is calling Hal by name; if the user is doing so,
   'it's better not to save the sentence for re-use, since it usually makes the
   'pronoun-reversed sentence sound clumsy or incorrect:
   BlockSave = False
   If InStr(1, UserSentence, ComputerName, vbTextCompare) > 0 Then BlockSave = True
   If InStr(1, OriginalSentence, ComputerName, vbTextCompare) > 0 Then BlockSave = True

Thanks for your input, Most appreciated.

Best of wishes and grand new discoveries.
Jerry.

quote:
Originally posted by vonsmith

What I generally do when passing directives to Hal is to include Hal's name in the decoding. For example to command Hal the user must say, "Hal caps Utah". This command sequence is from my Capitalization script. In principle the script might look like:

Command = ComputerName & " caps "
If InStr(1, Trim(OriginalSentence), Command, 1) = 1 Then
 [do something]
End If

Note: ComputerName is a Hal brain variable that contains the name you assign your Hal.

1) One advantage of including Hal's name (whatever you name him/her) is that Hal has script to block saving the user input to brn files if his name is used. This prevents non-dialog sentences or odd grammar from being saved to brn files.

2) Also Hal's name combined with a non-dialog sounding word should make a unique combination that shouldn't occur accidentally. For example "Hal caps " is not likely to occur in a normal dialog.

Therefore my suggestion is something like:

Command = ComputerName & " eject CD "
If InStr(1, Trim(OriginalSentence), Command, 1) = 1 Then
 [eject CD script]
End If

Trimming the UserSentence removes spaces at the beginning and end of the sentence. If the InStr(...) command equals 1 then the ComputerName must start at position 1 in the sentence. Therefore the sequence *must* be "Hal eject CD ". The sequence, "Please Hal eject CD " wouldn't eject the CD. Testing the OriginalSentence variable instead of the UserSentence insures that the "Reverse Person" and other mod's made to UserSentence don't confuse detection of the command phrase. OriginalSentence contains the user's sentence without any mod's.

Just my 2 cents...


= vonsmith =




vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal can now eject your CDs
« Reply #12 on: November 27, 2003, 09:09:40 pm »
onthecuttingedge2005 / Jerry,
We are on the same wavelength. I typically don't use "passwords" as such, but instead command phrases. I think when giving Hal any command (I call them directives) that using his name is a good way to use the BlockSave function to best advantage.

Keep up the excellent work.


= vonsmith =