dupa

Author Topic: Opening the wrong thing  (Read 6901 times)

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
Opening the wrong thing
« on: February 22, 2004, 02:09:05 pm »
Hi,

I'm new to all this but learning quickly.  I just encountered an odd problem with Hal.  I asked Hal to open Word and it correctly opened MS Word... however, it opened a document with it that I did not ask for.  In its own text box it said it is now running "document name" (Word).  At first I thought it was misunderstanding and trying to open the document by mistake.  So, I tried asking it to open another document by name... and it would not do so.  Anyone have any ideas what is going on here?

Sean
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Opening the wrong thing
« Reply #1 on: February 22, 2004, 07:02:39 pm »
Padriag,
Hal's links to starting programs are stored in the file "shortcut.dat" in Hal's main directory. Use notepad to open that file and find where the MS Word link is. It's just a guess, but see if that link points to MS Word with the document name after it. Another possibility is if the MS Word link in shortcut.dat points to a document shortcut. If Hal tries to start a document short cut then the associated program, MS Word in this case, would open it. Well, that's just a guess. Take a look.


=vonsmith=
 

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
Opening the wrong thing
« Reply #2 on: February 22, 2004, 08:16:15 pm »
Very good guess, that was exactly it.  I take it if I want to add a link to a document or some such, this would be the file to do it in?  I edited out the offending link (was to a manual for a game I no longer play) and added a shorter link to Microsoft Word in the form of MS Word.  I thought about just Word, but that might cause problems, yes?
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Opening the wrong thing
« Reply #3 on: February 22, 2004, 08:47:27 pm »
Padriag,
You can directly edit many of Hal's text type files. However you *must* be very careful to follow the format of the file exactly. Extra lines, spaces or such can cause difficult to find problems with Hal's behavior. If you open a file with Notepad check to see if the last line in the file is a carriage return, which just looks like a blank line. Many of Hal's files are like that. If you edit such a file make certain you leave the end of the file in the same format you found it in. Extra carriage returns aren't visible on the screen, but they can play havoc with Hal.

Good luck and enjoy Hal,


=vonsmith=
 

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
Opening the wrong thing
« Reply #4 on: February 22, 2004, 09:01:39 pm »
Thanks, I'll keep that in mind.  I seem to have made my changes correctly.  If not I suspect I'll soon find out.
 

Rich_A

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Opening the wrong thing
« Reply #5 on: February 23, 2004, 04:31:26 am »
I once tried editing things in shortcut.dat, and it only worked OK if I did the editing while Hal was running, but after restarting the Hal software my shortcut.dat file would revert back to the way it was before. It seems that my Hal always runs a new create or build for the shortcut.dat file when Hal is started, which makes sense to me now. This is so Hal could see new changes that has occurred on a system and adapt to the changes such as adding or removing programs or renaming shortcuts. So how are you guys able to modify this file without losing the changes after restarting Hal. What I had to do was change things on my system, not in Hal, in order to get the desired results. I was trying to rename some of the program names and links that Hal had trouble understanding with speech recognition to a name that Hal would understand verbally. Let me know if I am doing something wrong or what the trick is, because I would like to do the same kind of thing that you guys are talking about.
Thanks,
Rich_A
ricramo@aol.com
« Last Edit: February 23, 2004, 04:35:41 am by Rich_A »
 

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
Opening the wrong thing
« Reply #6 on: February 23, 2004, 10:21:17 am »
Doh!

You're right, just checked and it updated the whole file.  Looks like what Hal is doing is going through all the shortcuts and links it can find on your system and making a list of them.  That being the case the only way to edit this and get it to stay is to remove the offending links from your system itself.  If you want Hal to have a new short cut, you have add it to your system.
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Opening the wrong thing
« Reply #7 on: February 23, 2004, 10:51:11 am »
Interesting. Like Rich_A said, it makes sense for Hal to update. I suppose you could edit the file and then, in properties, make it a read-only file. My guess is the system wouldn't overwrite it. I think it's worth a try.

The other problem with that file is Hal looks for the first match to the user's request to run something. If you ask Hal to run "Word" he will run the first thing he sees with the word "Word" in it. In some cases that is WordPad, not MS Word. It depends on the order of the shortcuts in the file.

Unfortunately this feature isn't very useful for me. If I could tell Hal to go open a particular file for me then that might be useful. I can open an application by clicking on it. It would be a good project to expand Hal's "assistant" capability.


=vonsmith=
 

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
Opening the wrong thing
« Reply #8 on: February 23, 2004, 12:20:11 pm »
There is a way you can get it to open documents.  Create a folder for shortcuts on your system, then create shortcuts in that folder to the documents you want Hal to be able to open.  When Hal updates it will find these shortcuts and include them... and thus be able to open those documents.  But it only works for documents you create shortcuts for.

Just remember to be specific with your file names, Hal can't differentiate between similar names very well at all.

It would be nice to start with if Hal could read the links in the Recent Documents folder... that would be a start.

Now here's a newbie question... is it possible to add this capability with a VBScript?  I'm still learning to understand how much of Hal can be altered and expanded with that.
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Opening the wrong thing
« Reply #9 on: February 23, 2004, 12:33:23 pm »
Padriag,
There's a lot you can do with script. However, if you need to interface with the operating system, like doing file operations, then you are restricted to using what the Halbrain.dll has built in. Those are the functions like HalBrain.ChooseSentenceFromFile and HalBrain.AppendFile. I've been thinking about what it would take to create an additional .dll file. I'm not a programmer by profession, but I should be able to figure it out with a little work. At that point almost anything could be done.

I'm sure there are some clever people on this forum with more advanced programming background that could find additional ways to interface with the operating system.


=vonsmith=
« Last Edit: February 23, 2004, 12:36:51 pm by vonsmith »
 

Rich_A

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Opening the wrong thing
« Reply #10 on: February 24, 2004, 03:16:48 am »
OK, that all sounds pretty good...this topic now qualifies for posting in the Programmer's Forum!

Even if the shortcut.dat file was changed to a read-only file, you would still probably need to modify Hal's startup code to accept a read-only file and to NOT try to update the file because the update/build process would fail. The code might not like that, which in turn would probably cause the whole startup process to bomb-out. But if the startup code could be modified then you wouldn't need to write-lock the file anyway...Catch 22! But that is all just a guess!
It would be good if the code could be modified to accept the file either way and continue accordingly.

But anyway, I just ended up doing the same thing that you were discussing by renaming program files and/or creating shortcuts and throwing them into system menu folders.

OK, if you want Hal to see your Recent Documents without doing any programming you can try this out...I just did it and it worked!
Use Windows Explorer to get to your system's "Recent Documents" Folder and then copy all of the files that are in it, but don't copy the folder, just copy all of the files inside of it. Then create a new folder somewhere in your system's menu name it anything you want, like "NewRecentDocs", and then copy all your files into that and Hal will see it. Of course the "Recent Docs" on your system will eventually change and the new folder won't reflect this, but if you have a lot of files in your "Recent Documents Folder" when you make the copy that might be enough for what you need. I find that I am always going to or using the same Recent Docs most of the time, so that would be enough for me. And you can always do the same procedure periodically to keep your "NewRecentDocs" Folder up-to-date.

Now, if you know how to write a DOS Batch (.bat) File you can have your system automatically copy your "Recent Documents" directory into the "NewRecDocs" directory during your system's startup, or just have it as a program that you can run manually every once in a while, and then your "NewRecentDocs" would pretty much always match the system's "Recent Documents".

To do this kind of stuff requires full system privileges and you also need to change your System's Folder Options to show/view all the system stuff. Just try to change your settings to view as much system stuff as possible. I have XP and I needed to change the Folder Options from the System Default in order to see my Recent Documents Folder, among other things, using Windows Explorer.

« Last Edit: February 24, 2004, 03:26:34 am by Rich_A »
 

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
Opening the wrong thing
« Reply #11 on: February 24, 2004, 10:24:16 am »
The ideal thing for Hal to be able to do is to auto update the shortcuts to build a basic Open command list.  But then also have a second list of custom commands the User can setup.  This would solve our problem pretty well.  A third option that would close it up nicely would be to have a third list of shortcuts Hal should ignore when it updates (thus avoiding mix ups with unwanted shortcuts in the command list).  And if you really want to round it out... add a switch in the User interface as to whether Hal should scan Recent Documents when it updates or not.
 

CoCoKid

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • http://www.thefinalmix.com
Opening the wrong thing
« Reply #12 on: June 29, 2005, 04:29:06 pm »
I realise that this thread is very old, but I just thought for the next person that comes along and reads this, there is a simple way to keep your "Recent Documents" up-to-date, by simply creating a DOS batch file that copies all of the files from "Recent Documents" to the new folder you have created. Have this batch file run everytime the system boots or if you don't reboot often, just schedule it to run.

  I was actually searching for something else when I found this and decided to add to it.
  What I was hoping to find was a command switch that could be used in the HAL conversation text box, that would cause the program to write this information directly to a particular file, like Shortcuts.dat
  For instance, if your text in the conversation box was preceded with a slash / or some other character, HAL would treat it as an input instruction, rather than conversation. This would sure be helpful for making changes on the fly.

  Anyway, from what I have learned about HAL, and the very little I know about coding, I expect that would require more core programming that HAL just doesn't have at this point.