|
CommonDialog is possible
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.
CommonDialog is possible // Scriptorium
Post by Wigand // Feb 10, 2007, 9:29am
Wigand
Total Posts: 462
|
I searched and tried, and now it works.
You can have the standard-file-dialog in your LE-Scripts.
It's really simple. :)
' Execute
' Called to execute the command
Sub Execute(params)
Set Filesel = CreateObject("MSComDlg.CommonDialog")
With filesel
.Filter = "all Files (*.*)|*.*"
.DialogTitle = "Open File"
.MaxFileSize = 260
.ShowOpen
Filename=.Filename
End With
params.conValue("Filename")=Filename
End Sub |
Post by trueBlue // Feb 10, 2007, 6:59pm
trueBlue
Total Posts: 1761
|
Does not work here Wigand. I get an error. |
Post by Wigand // Feb 10, 2007, 9:58pm
Wigand
Total Posts: 462
|
Does not work here Wigand. I get an error.
Oh, :confused:
I'm sorry. Maybe you don't have the Microsoft developer Controls on your PC.
Don't you have the
\Windows\system32\comdlg32.ocx
Microsoft Common dialog Control 6.0 (SP6)
?
Please let me know the error text.
So I need to upload an installation file later. Then try this. |
Post by Wigand // Feb 11, 2007, 4:37am
Wigand
Total Posts: 462
|
So I need to upload an installation file later. Then try this.
Here is the installation file.
It brings the commondialog, but I do not know whether or not it
is possible to use it in the VBScript, because it could be that you
need the developer-version of the OCXes. I have the Visual-Studio6
on my PC, so I have nearly all of the controls.
I think it would be a good idea for Caligari to
implement such important controls in the next TS Version.
Please let me know if it works now. If not, I need to write some
WindowsApi functions. |
Post by trueBlue // Feb 11, 2007, 10:15am
trueBlue
Total Posts: 1761
|
Oh, :confused:
I'm sorry. Maybe you don't have the Microsoft developer Controls on your PC.
Don't you have the
\Windows\system32\comdlg32.ocx
Microsoft Common dialog Control 6.0 (SP6)
?
Please let me know the error text.
So I need to upload an installation file later. Then try this.
I do have comdlg32.ocx Version# 6.01.9782
Error: |
Post by Wigand // Feb 11, 2007, 10:37am
Wigand
Total Posts: 462
|
'unspecified Error' :mad:
If VBScript did not find the class it should give an other message.
But I don't really know. There are always problems with OCXs.
Every program uses this class, why it is not possible to use it in
your script. :confused:
So, did you tried the installation?
I always think it's a bad thing to write scripts which need installations.
And maybe many people are afraid of doing this.
But on the other side, if I want to use some other plugins, I must install too. |
Post by Norm // Feb 12, 2007, 6:25am
Norm
Total Posts: 862
|
I searched and tried, and now it works.
You can have the standard-file-dialog in your LE-Scripts.
It's really simple. :)
Hmm, it works ok here. Nice item to have. Thanks for sharing Wigand! |
Post by Wigand // Feb 12, 2007, 11:21am
Wigand
Total Posts: 462
|
Hmm, it works ok here. Nice item to have. Thanks for sharing Wigand!
Thank you, but please test it on a system without VB-Developer-OCXs.
I think it could be a problem for some people who do not have them. |
Post by Emma // Feb 14, 2007, 11:11am
Emma
Total Posts: 344
|
Guten Abend Wigand;)
Well, I tested it and can say it worked perfect.:) Since I got all that compilers
from VB6 till .NET on my machine I couldn't test it on a "clean" one
I do also have comdlg32.ocx Version# 6.01.9782
IMPORTANT: Tryd then converting into jScript, in an object-mode jScript, there it starts immediately after closing the code editor window, that worked faster for debug.
Had to fight with two errors
4317
REASON I forgot to change in the code to "new ActiveXObject" instead of "CreateObject" which is used in VBScript instead.
Another error was then
4318
This one came up every time I cancel the Opene file dialog window because in that case the code "Filename=filesel.Filename" results in a zero string. That didn't seem to matter in any way in VBScript. :confused:
Another problem I had "Filename=filesel.Filename" was the VBscript version which I had to change it into " Filename=filesel.filename" <-- the right filename is written with small "F" so that it differs from the variable "Filename" on the left side .:confused: It did work later:confused:
A final code fixed as sample looks like this:
// OnComputeOutputs
// Called to compute values of all output connectors
function OnComputeOutputs(params) (or function Execute(params) in Comand mode jScript)
{
filesel = new ActiveXObject("MSComDlg.CommonDialog");
filesel.Filter = "all Files (*.*)|*.*";
filesel.DialogTitle = "Open File";
filesel.MaxFileSize = 260;
filesel.ShowOpen();
if (filesel.Filenam != "")
{ Filename=filesel.Filename;}
else
{
return;
}
params.conValue("Filename")=Filename
} |
Post by Wigand // Feb 14, 2007, 6:17pm
Wigand
Total Posts: 462
|
O that's nice, you changed it into JScript. :)
After testing my scripts, I used to insert an "On Error resume next" to
prevent some errors which could occur.
And the script I showed is only an example. you still need to put all
the test in, to see whether or not the user selected or wrote
the right filenames. |
|