Author Topic: Find & Replace Script - Quick Question  (Read 16984 times)

0 Members and 1 Guest are viewing this topic.

M-dub

  • Guest
Re: Find & Replace Script - Quick Question
« Reply #30 on: February 19, 2007, 12:41:51 PM »
I'm not getting it.

I must be missing something, which would also be par for the course.

Code: [Select]
Command: ad APPLOAD textreplace.LSP successfully loaded.


Command:
Text Replace Loaded, enter TextReplace to run.
Command:
Command: TextReplaceDBX
Unknown command "TEXTREPLACEDBX".  Press F1 for help.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #31 on: February 19, 2007, 12:49:30 PM »
How about TextReplace

Quote
Command:
Text Replace Loaded, enter TextReplace to run.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

M-dub

  • Guest
Re: Find & Replace Script - Quick Question
« Reply #32 on: February 19, 2007, 01:01:21 PM »
How about TextReplace

Quote
Command:
Text Replace Loaded, enter TextReplace to run.


That was the first one I tried and got

"Error: Automation Error. Problem in loading application"

I have to do a bunch of other stuff to these drawings as well, so I MAY end up just doing EVERYTHING with a script.  I would really hate for all of your help to be in vain, believe me!  I really hate the fact that A)  It's taken me this long to get to this issue, and B)  I can't contribute to the actual creation and troubleshooting of the code.  Just know that I truly do appreciate everyone's efforts just the same.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #33 on: February 19, 2007, 01:20:12 PM »
TextReplace is the correct command.

Which Acad version are you using ?

Try pasting this at the command line

(atoi (substr (getvar "acadver") 1 2))
« Last Edit: February 19, 2007, 01:24:09 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

M-dub

  • Guest
Re: Find & Replace Script - Quick Question
« Reply #34 on: February 19, 2007, 01:29:11 PM »
Which Acad version are you using ?
AutoCAD 2002

Try pasting this at the command line

(atoi (substr (getvar "acadver") 1 2))
15

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #35 on: February 19, 2007, 01:38:20 PM »
and this ?
Code: [Select]
      (setq *acad (vlax-get-acad-object))

      (setq odbx (if (< (atoi (substr (getvar "acadver") 1 2)) 16)
                   (vla-getinterfaceobject *acad "ObjectDBX.AxDbDocument")
                   (vla-getinterfaceobject *acad "ObjectDBX.AxDbDocument.16")
                 )
      )

« Last Edit: February 19, 2007, 01:49:13 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

M-dub

  • Guest
Re: Find & Replace Script - Quick Question
« Reply #36 on: February 19, 2007, 01:41:32 PM »
and this ?
Code: [Select]
      (setq odbx (if (< (atoi (substr (getvar "acadver") 1 2)) 16)
                   (vla-getinterfaceobject *acad "ObjectDBX.AxDbDocument")
                   (vla-getinterfaceobject *acad "ObjectDBX.AxDbDocument.16")
                 )
      )



Error: Automation Error. Problem in loading application

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #37 on: February 19, 2007, 01:42:55 PM »
OK .. in 2002 DBX isn't automatically registered.

Try this as a once off ..
Code: [Select]
(STARTAPP "regsvr32.exe"
          (STRCAT "/s \"" (FINDFILE "axdb15.dll") "\"")
)



added:
...
then try the previous again.
*** make sure to run this first
Code: [Select]
(setq *acad (vlax-get-acad-object))
« Last Edit: February 19, 2007, 01:48:25 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

M-dub

  • Guest
Re: Find & Replace Script - Quick Question
« Reply #38 on: February 19, 2007, 01:45:37 PM »
OK .. in 2002 DBX isn't automatically registered.

Try this as a once off ..
Code: [Select]
(STARTAPP "regsvr32.exe"
          (STRCAT "/s \"" (FINDFILE "axdb15.dll") "\"")
)



added:
...
then try the previous again.

Not sure if this is what you were looking for, but


33

M-dub

  • Guest
Re: Find & Replace Script - Quick Question
« Reply #39 on: February 19, 2007, 01:48:47 PM »
Oops... just saw your update, so I tried it...

Code: [Select]
Command: (STARTAPP "regsvr32.exe"
(_>           (STRCAT "/s \"" (FINDFILE "axdb15.dll") "\"")
(_> )
33

Command: (setq odbx (if (< (atoi (substr (getvar "acadver") 1 2)) 16)
((_>                    (vla-getinterfaceobject *acad "ObjectDBX.AxDbDocument")
((_>                    (vla-getinterfaceobject *acad
"ObjectDBX.AxDbDocument.16")
((_>                  )
(_>       )
#<VLA-OBJECT IAxDbDocument 037247a8>

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #40 on: February 19, 2007, 01:49:40 PM »
Whhhheeeeee ... !!!
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #41 on: February 19, 2007, 01:55:43 PM »
Alan may change the test to something like :
Code: [Select]
(SETQ *acad (VLAX-GET-ACAD-OBJECT)
      odbx  (IF (< (SETQ acadvers (SUBSTR (GETVAR "acadver") 1 2)) "16")
              (PROGN
                (IF
                  (NOT (VL-REGISTRY-READ
                         "HKEY_CLASSES_ROOT\\ObjectDBX.AxDbDocument\\CLSID"
                       )
                  )
                   (STARTAPP "regsvr32.exe"
                             (STRCAT "/s \"" (FINDFILE "axdb15.dll") "\"")
                   )
                )
                (VLA-GETINTERFACEOBJECT *acad "ObjectDBX.AxDbDocument")
              )
              (VLA-GETINTERFACEOBJECT
                *acad
                (STRCAT "ObjectDBX.AxDbDocument" acadvers)
              )
            )
)
« Last Edit: February 19, 2007, 01:57:58 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #42 on: February 19, 2007, 01:56:45 PM »
Whhhheeeeee ... !!!

Translates to :
Try the original routine now Mike.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

M-dub

  • Guest
Re: Find & Replace Script - Quick Question
« Reply #43 on: February 19, 2007, 01:59:57 PM »
Many Thanks, Kerry!

:)

I think I have to have all of the dwg's closed for it to work right.

I'm just about at a good spot to break, then I'll try it.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Find & Replace Script - Quick Question
« Reply #44 on: February 19, 2007, 02:02:54 PM »
I HAVE had issues running DBX when drawings are open, so play safe for now ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.