Author Topic: Problem with (command "open") (must be Monday)  (Read 3803 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Problem with (command "open") (must be Monday)
« on: June 13, 2005, 12:09:09 PM »
Just tested my new menu out, works great.  Loaded it on a ACAD2004 machine, and it flops.  Here are a bunch of different attempts:
Code: [Select]
[Basement]^C^C^C^P_open;"C:/Rockford Building Maintanence/Basement.dwg";
**BRINGS UP FILEDIALOG BOX, I CLICK CANCEL**
Unknown command ""C:/ROCKFORD BUILDING MAINTANENCE/SECOND FLOOR.DWG"".  Press
F1 for help.

Code: [Select]

Command: (command "open" "C:/Rockford Building Maintanence/Basement.dwg")
open
Command: C:/Rockford Building Maintanence/Basement.dwg Unknown command
"C:/ROCKFORD BUILDING MAINTANENCE/BASEMENT.DWG".  Press F1 for help.

Command: nil


Code: [Select]
[Basement]^C^C^C(setq fdia (getvar "filedia"));(setvar "filedia" 0);open;"C:/Rockford Building Maintanence/Basement.dwg");(setvar "filedia" 0);
Command: (setq fdia (getvar "filedia"))
1

Command: (setvar "filedia" 0)
0

Command: open
Enter name of drawing to open <.>: ***I HAVE TO HIT ESC***
Command: "C:/Rockford Building Maintanence/Basement.dwg")
Unknown command ""C:/ROCKFORD BUILDING MAINTANENCE/BASEMENT.DWG")".  Press F1
for help.

Command: (setvar "filedia" 0)
0

Code: [Select]

[Basement]^C^C^C(setq fdia (getvar "filedia"));(setvar "filedia" 0);(setq file "C:/Rockford Building Maintanence/Basement.dwg");(command "open" file);(setvar "filedia" 0);
Command: (setq fdia (getvar "filedia"))
0

Command: (setvar "filedia" 0)
0

Command: (setq file "C:/Rockford Building Maintanence/Basement.dwg")
"C:/Rockford Building Maintanence/Basement.dwg"

Command: (command "open" file)
open
Command: C:/Rockford Building Maintanence/Basement.dwg Unknown command
"C:/ROCKFORD BUILDING MAINTANENCE/BASEMENT.DWG".  Press F1 for help.

Command: nil

Command: (setvar "filedia" 0)
0

Code: [Select]

[Basement]^C^C^C(setq fdia (getvar "filedia"));(setvar "filedia" 0);(setq file "C:/Rockford Building Maintanence/Basement.dwg");open;!file;(setvar "filedia" 0);
Command: (setq fdia (getvar "filedia"))
0

Command: (setvar "filedia" 0)
0

Command: (setq file "C:/Rockford Building Maintanence/Basement.dwg")
"C:/Rockford Building Maintanence/Basement.dwg"

Command: open
Enter name of drawing to open <.>: ***I HAVE TO HIT ESC***
Command: !file
"C:/Rockford Building Maintanence/Basement.dwg"

Command: (setvar "filedia" 0)
0

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Problem with (command "open") (must be Monday)
« Reply #1 on: June 13, 2005, 12:48:56 PM »
What did it work on before 2004?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Problem with (command "open") (must be Monday)
« Reply #2 on: June 13, 2005, 12:54:53 PM »
Quote from: CmdrDuh
What did it work on before 2004?

I have 2005 on my machine...sorry...shoulda mentioned that...my sig is kinda small

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Problem with (command "open") (must be Monday)
« Reply #3 on: June 13, 2005, 01:46:15 PM »
Actually I should open my eyes.

OK , so what is different about 2005 than 4?  do you have SDI = 0 on both? Any other custom settings you use that the average user wouldn't have?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Problem with (command "open") (must be Monday)
« Reply #4 on: June 13, 2005, 01:59:51 PM »
I've got custom settings up the butt on mine, but the 2004 system is raw AutoCAD.  Thing is, I'm not using anything custom in my macro.  Just your standard open command.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Problem with (command "open") (must be Monday)
« Reply #5 on: June 13, 2005, 02:01:03 PM »
yes, but there could be a sysver that neither of us is thinking of that is preventing your "plain" macro from working
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Problem with (command "open") (must be Monday)
« Reply #6 on: June 13, 2005, 02:50:39 PM »
Have you tried
Code: [Select]
[Basement]^C^C^C^P_open;"C:\\Rockford Building Maintanence\\Basement.dwg";

Another Option
Code: [Select]
;;; SOPEN.LSP
;;; Open command that works for all cases
;;; Works for SDI=0 or SDI=1

;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;; 1999-09-12 - First release
;;; 2002-05-14 - Bug fixed
;;; Written for AutoCAD 2000+
;;; Ex: (sopen "c:\\drawing1.dwg")
;;; Note that QAFLAGS might not be restored to 0 so you might want to add (setvar "qaflags" 0) to acaddoc.lsp or any other startup lisp.

;;; opens and activates a file as Read-Only
(defun openRO (fna)
  (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) fna :VLAX-TRUE))
)

(defun sopen (fna / n)
  (if (= 0 (getvar "SDI"))
    (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) fna))
    (progn
      (if (not (equal 2 (logand 2 (getvar "qaflags"))))
        (setvar "qaflags" (+ (getvar "qaflags") 2))
      )
      (if (not (equal 4 (logand 4 (getvar "qaflags"))))
       (setvar "qaflags" (+ (getvar "qaflags") 4))
      )
      (command "_.open")
      (if (not (equal 0 (getvar "dbmod")))
        (command "_y")
      )
      (command fna)  
      (setq n 0)
      (while (and (< n 4)
                  (wcmatch (getvar "cmdnames") "*OPEN*")
             )
          (T
            (command "")
          )
        (setq n (+ n 1))
      )
      (setvar "qaflags" 0)
    )
  )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Problem with (command "open") (must be Monday)
« Reply #7 on: June 13, 2005, 04:34:37 PM »
Quote from: CmdrDuh
yes, but there could be a sysver that neither of us is thinking of that is preventing your "plain" macro from working


Yeah...there is...SDI

Set it to "1" on the 2004 machine and it worked fine.  SO!  Now that I know it's the SDI mode that's causing this, does anyone know a work around for that?  I'm developing this menu system for client, and I would like it to be able to work with both SDI on and off.