×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NX Journal - Using MSScriptControl.ScriptControl and VBScript

NX Journal - Using MSScriptControl.ScriptControl and VBScript

NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
Has anyone successfully used Microsoft ScriptControl in an NX Journal (VB.Net). I would like to incorporate some VBScript code into my journal, but I can't get NX to recognize:

CODE

Imports Interop.MSScriptControl
...
Dim Script = New MSScriptControl.ScriptControl
Script.Language = "VBScript"
... 

Since you are going to ask "Why would you want to use VBScript?" I am having trouble with the FolderBrowserDialog to select a folder and I wanted to use shell.BrowseForFolder, hoping I could get that to work...so if anyone had another workaround to allow a user to select a folder, I would be interested in that as well.

Thanks,
Jeff

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

Here is an example of using the folder browser:
http://nxjournaling.com/content/user-input-folder-...

Siemens limits the other libraries that you can reference with plain journaling, the Interop probably isn't one of them. If you have a .net author license, you can reference any libraries that you want.

www.nxjournaling.com

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
Cowski,

Thanks, but for some reason when I use FolderBrowserDialog, my journal just hangs. I can use OpenFileDialog and get a working file selection folder, but FolderBrowserDialog doesn't work for some weird unknown reason.

Jeff

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

I'd guess this is more of a .net framework issue rather than an NX issue. Different versions of NX will require different versions of the .net framework; which one your version of NX uses can usually be found in the release notes or the programmer's help. Make sure that you have the .net framework version installed that NX references.

www.nxjournaling.com

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
Yeah, that's what's weird. I'm trolling the VB.Net sites for answers too!

I can run a journal with just the FolderBrowserDialog in it, but when I try to add the FolderBrowserDialog to my existing journal, it hangs.

Jeff

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

If you are willing to post your code (the relevant portions, at least); I'd be glad to take a look.

www.nxjournaling.com

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
It's simply the code to execute when a user presses a button on a form:

CODE

Private Sub Button13_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button13.Click
	Dim folderBrowserDialog1 As New FolderBrowserDialog
	With FolderBrowserDialog1
            .RootFolder = Environment.SpecialFolder.MyComputer
            .SelectedPath = ""
            .Description = "Select a Destination Folder"
            If .ShowDialog = DialogResult.OK Then
                Destination = .SelectedPath
            Else
                Exit Sub
            End If
     End With
	 MsgBox("You picked " & Destination)	
    End Sub 

As I said, I have a similar subroutine which works for OpenFileDialog, so I don't understand why it gets hung on this.
And yes, in a standalone journal the code above does work.

Jeff

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

I pasted in your code to a test journal. As you say, it works in a stand alone journal. There must be something in your "real" code that is getting in the way of the folder browser. Off the top of my head, I don't have any good ideas of what that might be...

www.nxjournaling.com

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
Thanks for looking at it anyways. I'll keep banging my head against the wall and see if it helps ;)

Jeff

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
Okay - so I learned 1 thing.

My journal is meant to be executed from the command line "run_journal" executable, but when I run it that way, I have the problem above.

If I run the journal from within an NX session the FolderBrowserDialog works fine.

So what would be different between the environment in which I run from "run_journal" vs. within NX?

(Maybe I need to open a new thread since the current subject to this thread makes little sense at this point)

Jeff

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

Using the run_journal utility is similar to running code from the console; I'm not sure that GUI dialog boxes are allowed. Based on your experience, I'd guess not.

www.nxjournaling.com

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
Though I wonder why that is the only GUI form component that doesn't run. I have OpenFileDialog which works and the overall form works as well with radio buttons, list boxes and check boxes.

Sigh.
Jeff

RE: NX Journal - Using MSScriptControl.ScriptControl and VBScript

(OP)
I just wanted to circle back and let y'all know that I implemented code based on:

http://glassocean.net/how-to-create-a-treeview-fil...

in order to create my own folder dialog window that works when run from "run_journal".

Jeff

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources