|
|
Script command help needed
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
Script command help needed // Archive: Tech Forum
Post by 3dvisuals dude // Aug 23, 2007, 5:16am
|
3dvisuals dude
Total Posts: 1703
|
Hi folks,
I've been trying to find a simple Script command / function / process, whatever you want to call it, which will allow me to open external programs from a clicked object in a trueSpace scene.
I know how to open an external browser from within truespace but unfortunately the jscript commands which I could place within a browser file to load any additional external program are all flagged as security threats (of course) by most system security software. Workarounds exist but are a hassle for users to implement, so that is unfortunately not a realistic option.
I thought I had an easy method spotted when I saw the code used inside Norm's vbLabyrinth.RsObj file for opening Excel files, but if that can be modified to open an external program other than Excel I am at a loss as to the right method of modification to use after many failed attempts.
The reason I need this capability is to provide some new handy truePlay companion programs which I can already write for the WindowsXP OS, but my intention is for a truePlay user to be able to quickly fire them up at will with a fast right-then-left-click on a designated object within a truePlace interactive scene.
Can somebody lend me a hand on this one?
If it's considered a potential security issue please contact me about it via the PM system here.
Thanks,
Mark / 3dvisuals dude |
Post by frootee // Aug 23, 2007, 5:20am
|
frootee
Total Posts: 2667
|
3dv,
Can you post a code snippet? Actually, the whole script?
PS there are tags you can use on the forums for maintaining the formatting though I forget what they are. I will check. But don't let that hold you back from posting before I find it!
froo |
Post by 3dvisuals dude // Aug 23, 2007, 5:31am
|
3dvisuals dude
Total Posts: 1703
|
3dv,
Can you post a code snippet? Actually, the whole script?
PS there are tags you can use on the forums for maintaining the formatting though I forget what they are. I will check. But don't let that hold you back from posting before I find it!
froo
The file already exists here in the first thread and post of the Scriptorium.
EDIT: here's the link: http://forums1.caligari.com/truespace/attachment.php?attachmentid=2531&d=1159915399
Sorry... I forgot you're at work, here's the code snippet (the rest does not apply):
' Execute
' Called to execute the command
Sub Execute(params)
Dim ExcelApp
rosDir = System.GetMainDir()
Wrkbook = rosDir + "\\RS Data\\labyrinth2.xls"
Mark |
Post by frootee // Aug 23, 2007, 5:52am
|
frootee
Total Posts: 2667
|
OK. Here's how to troubleshoot this.
First step: It looks like:
Dim ExcelApp
is a VB keyphrase. So you need to find out how ExcelApp is used to access the Excel Executable. You can probably do a help on that word. It looks like this line is just defining ExcelApp as a variable which is used later on.
Is there more code that references ExcelApp, which opens the xls file? This will also shed light on Opening the file you want. Because at some point, the file has to be opened.
I would think you may need to do something like this:
Dim VideoFile (note this is in place of the DIm ExcelApp line above)
then later,
VideoFile.Open
or something like that. You should be able to find what you need in a VBscript reference.
To give you an idea, I did a quick search on google and came up with this, for opening a text file:
http://www.cruto.com/resources/vbscript/vbscript-examples/misc/text/Read-a-Text-File-Character-by-Character.asp
and, the search I used was: vbscript example
I selected the first item in the search:
http://www.cruto.com/resources/vbscript/vbscript-examples/
HTH.. I know it is not a direct answer but I think you can find what you need here.
HTH!
Froo
The file already exists here in the first thread and post of the Scriptorium.
EDIT: here's the link: http://forums1.caligari.com/truespace/attachment.php?attachmentid=2531&d=1159915399
Sorry... I forgot you're at work, here's the code snippet (the rest does not apply):
' Execute
' Called to execute the command
Sub Execute(params)
Dim ExcelApp
rosDir = System.GetMainDir()
Wrkbook = rosDir + "\\RS Data\\labyrinth2.xls"
Mark |
Post by Norm // Aug 23, 2007, 6:28am
|
Norm
Total Posts: 862
|
http://forums1.caligari.com/truespace/showthread.php?t=235 is a thread where I was exploring some file system object scenarios. Might be that if you research file system object for jscript and vbscript, you will come up with an assortment of ways to do this. |
Post by 3dvisuals dude // Aug 23, 2007, 7:06am
|
3dvisuals dude
Total Posts: 1703
|
Thanks guys!
That gives me plenty to sink my teeth into right there!!!
I love options!:D
Thanks again!
- Mark / 3dvisuals dude |
Post by 3dvisuals dude // Aug 23, 2007, 7:55am
|
3dvisuals dude
Total Posts: 1703
|
Oh well... dead ends on all counts.
In every case the scripts pointed to above and all others on the sites pointed to above are for loading file content into applications, not explicitly for simply running applications.
If you wanted to run "solitaire" or whatever from a clicked object within a truePlay scene, for instance, none of these will work.
On FSO (file system objects), for instance, I found the following definition:
FSO creates an object. That top level object is like a super file that can create, open and manage a variety of file types, for example, text files or spreadsheet applications.
But I'm not looking to open files, I'm looking to simply run programs.
Thanks for trying though guys.
I can do this with javascript from within a webpage either online or local but as mentioned in my first post that will flag as a security threat on systems not specifically set to allow the operation of that specific script. Users of it could set their systems to allow it, and I do know how, but it is a PAIN for them to do that so I don't want to go that route at all.
When I write a BASIC program, for instance, a simple shell execute command followed by a program name will launch that application from within another program where a button is attached to that command.
That's the kind of thing I'm looking for to attach to objects in an interactive truePlay scene where a person with truePlay can have an interactive menu of things in the scene which launch scene-related external programs which I would be writing.
I'll find a way though, or make one. It's just that the longer it takes me to find that simple way the longer the companion programs which I could now be writing will be delayed. So I was hoping not to have to re-invent the wheel in case the wheel existed already, but it seems so far that the wheel has yet to be built.
Thanks though,
Mark / 3dvisuals dude |
Post by trueBlue // Aug 23, 2007, 8:37am
|
trueBlue
Total Posts: 1761
|
Sub Execute(params)
Dim objShell
Set objShell=CreateObject("WScript.Shell")
objShell.Run "calc"
End Sub |
Post by 3dvisuals dude // Aug 23, 2007, 9:06am
|
3dvisuals dude
Total Posts: 1703
|
Sub Execute(params)
Dim objShell
Set objShell=CreateObject("WScript.Shell")
objShell.Run "calc"
EndSub
Hahahahaha!!!!!
You beat me by 23 minutes trueBlue!!!
I just found it myself in the script for the truePlay opening scene in the pdf manual launch button!
I see you left out the comments there:
' Execute
' Called to execute the command
Hahahaha!!!
Man, you are just as fast as Délé!
Way cool... this will save me a ton of time now and opens up some very cool possibilities to explore with all our own interactive scenes for sure!
Thanks trueBlue.;)
Mark / 3dvisuals dude |
|