VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need help stopping the "Help Window" from poping up

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
craig.michels
623 Views, 6 Replies

Need help stopping the "Help Window" from poping up

I am using VS2010 and AutoCAD 2014. I am writing a stand-alone exe form to automate running multiple different Lisp programs on hundreds of files at one time. I have written lots of scripts and Lisps, but this is my first try at VB.

 

I have two private subs that are called to perform modifications on selected files. The first "WriteScript" writes a custom .scr file to load the lisp and enter any user prompts the Lisp needs based on information the user entered previously into the form. The second "OpenDWG" opens the selected files and calls the previously written .scr file.

 

It runs and makes all the needed changes to the files, but the AutoCAD "Help Window" pops up every time as if I had clicked F1. I included the parts of my VB code that are used for this.

...
If ckbxChgIssue.Checked = True Then
                Dim x As Integer = Val(lbActionCount.Text)
                Dim File2Open As String
                WriteScript()

                For i = 0 To x - 1
                    File2Open = (lbPath.Text & "\" & ListBox2.Items(i) & ".dwg")
                    OpenDWG(File2Open)
                Next i
                       
                MsgBox(cbChgIssue.Text & " - Drawings Issue Stamp Updated")
            End If
...


Private Sub OpenDWG(ByVal File2Open As String)
        Dim acadApp As AcadApplication = GetObject(, "AutoCAD.Application")
        acadApp.Application.Visible = True

        Dim acadDoc As AcadDocument
        acadDoc = acadApp.Documents.Open(File2Open)
        acadDoc.SendCommand("(command " & Chr(34) & "._script" & Chr(34) & Chr(34) & "C:/temp/B_UWIZ.SCR" & Chr(34) & ") ")
        acadDoc.SendCommand("zoom e ")
    End Sub

    Private Sub WriteScript()
        Dim FILE_NAME As String = ("C:\temp\B_UWIZ.SCR")
        Dim nStamp As String = cbChgIssue.Text
        Dim nNote As String = DateChgIssue.Text
        Dim sPath As String = ("(load " & Chr(34) & "W:/Energy Services/Control/Team Corona/Team Corona/LSP/UDM_ISSUE_WIZ.lsp" & Chr(34) & ") ")

        'If System.IO.File.Exists(FILE_NAME) = False Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, False)
        objWriter.WriteLine(sPath)
        objWriter.WriteLine("UBIW")
        objWriter.WriteLine(nStamp)
        Select Case nStamp
            Case "Manufacture"
                objWriter.WriteLine(nNote)
            Case "Construction"
                objWriter.WriteLine(nNote)
        End Select
        objWriter.Close()
        'End If

    End Sub

 

6 REPLIES 6
Message 2 of 7
owenwengerd
in reply to: craig.michels

Try removing the space character from the end of your first script line.

--
Owen Wengerd
ManuSoft
Message 3 of 7
craig.michels
in reply to: owenwengerd

If I remove that space, I get this error. I have previously tried removing many different spaces since it seems like there is an extra return, but then the program doesn't run at all. So far I am just living with the help window popping up since the rest of the program works well.

 

error1.PNG

Message 4 of 7
paulritter
in reply to: craig.michels

sendcommand "zoom" & vbcr & "e" & vbcr
or
sendcommand "(command ""zoom"" ""e"")" & vbcr

Message 5 of 7
owenwengerd
in reply to: craig.michels

I think you misunderstood. I'm referring to the space at the end of the line that you're writing to the script file, not the space in the commands you're sending to the command line.

--
Owen Wengerd
ManuSoft
Message 6 of 7
craig.michels
in reply to: owenwengerd

Worked! Thought I needed that space since the space was needed when sending to the command line. But regardless, the program works and the Help Window no longer pops up! Thanks!

Message 7 of 7
owenwengerd
in reply to: craig.michels

The reason the space isn't needed in the script file is because WriteLine appends a carriage return, which performs the same function as the space.

--
Owen Wengerd
ManuSoft

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost