Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX Journal - Using MSScriptControl.ScriptControl and VBScript

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
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
 
Replies continue below

Recommended for you

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
 
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
 
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
 
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
 
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
 
Thanks for looking at it anyways. I'll keep banging my head against the wall and see if it helps ;)

Jeff
 
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
 
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
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor