Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Hyperlinks to dwg-files moves Acad to another screen/monitor when opening

Anonymous

Hyperlinks to dwg-files moves Acad to another screen/monitor when opening

Anonymous
No aplicable

Hi,

 

we just upgraded to AutoCad 2016, and now we got a problem with our dual monitor workstations.

 

We got a large MS Access 2010 database with all our drawing info and search options - the DWG-files are hyperlinked drawing (\\server\\acad\ARKM\M00\000-199\300M024E.dwg). Acad is active on the primary monitor  - when we click the hyperlink in Access (secondary monitor), Acad moves to the secondary monitor instead of staying on the primary monitor. This was not a problem in Acad 2013.

 

Is there another way to link dwg-files in Access?

 

I tried this - but no luck.

"C:\Program Files\Common Files\Autodesk Shared\AcShellEx\AcLauncher.exe" /O

"%1 \\serrver\acad\ARKE\E00\000-199\400E118A.dwg"

 

Help is much appreciated.

 

/Frederik

0 Me gusta
Responder
Soluciones aceptadas (1)
1.139 Vistas
12 Respuestas
Respuestas (12)

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

this is not usual that AutoCAD moves the application window because of a file-open, it would also not be usual that AutoCAD even starts on another monitor than you closed it before (as long as you don't play with display settings or plugin and -out the second monitor in the meantime).

 

What happens when you have the Windows explorer on the second monitor and double click a DWG file?

 

>> "C:\Program Files\Common Files\Autodesk Shared\AcShellEx\AcLauncher.exe" /O

>> "%1 \\serrver\acad\ARKE\E00\000-199\400E118A.dwg"

Is that the hyperlink text? If so you just need the path of the DWG, it is not necessary to have the exe within the path.

I also don't know what /O stands for

And imho really incorrect is %1 ... as that is by default the placeholder of the filename, so either use %1 or use the filename (%1 is used as placeholder so the shell function knows it has to use the 1st parameter send from Windows Explorer .. and this is the filename), both is invalid and can end in a start of AutoCAD with incorrect parameters..

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Me gusta

Anonymous
No aplicable

Hi,

 

If I double click a dwg-file on the second monitor, it opens correctly on the primary monitor.....

 

I got the this to work from a command promt:

"C:\Program Files\Common Files\Autodesk Shared\AcShellEx\AcLauncher.exe" "\\mark-serv2\acad\ARKE\E00\000-199\400E118A.dwg"

 

In Access, instead of the the hyperlink (\\mark-server\acad\ARKE\E00\000-199\400E118A.dwg), I tried to make a SHELL call:

Shell "C:\Program Files\Common Files\Autodesk Shared\AcShellEx\AcLauncher.exe \\MARK-SERV2\Tegning\acad\ARKE\E00\000-199\400E118A.dwg", vbMaximizedFocus - dont work!!!

 

Using acad.exe it does work, but opens a new session every time.

Shell "C:\CAD\AutoCAD 2016\acad.exe \\MARK-SERV2\Tegning\acad\ARKE\E00\000-199\400E118A.dwg", vbMaximizedFocus

 

What else should I try? :cara_con_una_leve_sonrisa:

0 Me gusta

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I got the this to work from a command promt:

Which command prompt? MS-Access does not have a command prompt afaik.

 

>> What else should I try?

don't use vbMaximizedFocus as this could change the application window.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Me gusta

Anonymous
No aplicable

>>Which command prompt? MS-Access does not have a command prompt afaik

the windows command promt...

 

>>don't use vbMaximizedFocus as this could change the application window.

If I just could get the command in Access: Shell "C:\Program Files\Common Files\Autodesk Shared\AcShellEx\AcLauncher.exe \\MARK-SERV2\Tegning\acad\ARKE\E00\000-199\400E118​A.dwg", vbMaximizedFocus, to work I would be happy so far :cara_con_una_leve_sonrisa:

 

-Frederik

0 Me gusta

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

I understand that you want to have it started maximized, but for a test, just to see if AutoCAD again moves to the other screen or not don't use the vbMaximizedFocus.

Don't use the parameter (as the parameter is optional) or use vbNormalFocus instead, how is that working?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Me gusta

Anonymous
No aplicable

Hi,

 

the Shell command dosen't work at all with or with out the optional parameter....

 

Shell "C:\Program Files\Common Files\Autodesk Shared\AcShellEx\AcLauncher.exe \\MARK-SERV2\Tegning\acad\ARKE\E00\000-199\400E118​​A.dwg"

 

-Frederik

0 Me gusta

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

I think we have to make one step back and restart.

Where in Access do you want to start AutoCAD by a hyperlink? Do you have a form with a hyperlink-object you are filling from a database or how do you try to start AutoCAD from Access?

If you can upload a sample it would be great as this would reduce the time to solution.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Me gusta

Anonymous
No aplicable

Hi Alfred,

 

(see attached screenshot)

 

the hyperlink (opens dwg's on the wrong screen) is placed in a form - so is the new command button which I am trying to get to work.

 

If I use the command button and acad.exe the DWG opens on the right screen, BUT opens a new Autocad session/instance every time I open another dwg.

 

If I use the command button and aclauncher.exe NOTHING happens.

 

/Frederik

0 Me gusta

Alfred.NESWADBA
Consultant
Consultant
Solución aceptada

Hi,

 

try that access file, there is a form, some records with drawing names (well, you have to modify them for having correct/existing filenames and a button in the form which uses AutoCAD or starts AutoCAD if not already running (or responding).

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Me gusta

Anonymous
No aplicable

Hi Alfred,

 

superb, that's just what I needed. It works perfectly - thank you very much for your assistance.

 

Best regards,

Frederik

0 Me gusta

Anonymous
No aplicable

Hi again Alfred Emoticono feliz ,

 

is there a parameter I can add in you example to give Autocad focus?

 

If we hit the dwg-open-button in Access and Autocad is in the background, the dwg opens but Autocad stays in the background...

 

/Frederik

0 Me gusta

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

to give the focus to an application is a job Windows has to do, so you need to search for API function that makes the application pushed to the foreground.

Try that (lines to be changed compared to the previous code are green):

 

Option Compare Database
Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long

Private Sub CMD_OPEN_Click()
    On Error Resume Next
    Dim tAcadApp As Object
    Set tAcadApp = GetObject(, "AutoCAD.Application")
    If (tAcadApp Is Nothing) Then
        Set tAcadApp = CreateObject("AutoCAD.Application")
    End If
    If tAcadApp Is Nothing Then
        Call MsgBox("AutoCAD not responding or not starting")
    Else
        tAcadApp.Visible = True
        Call tAcadApp.Documents.Open(DrawingName)
        Call BringWindowToTop(tAcadApp.hwnd)
    End If
End Sub

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Me gusta