Author Topic: Script Layout Reactor Upon Open  (Read 2370 times)

0 Members and 1 Guest are viewing this topic.

bmossman

  • Guest
Script Layout Reactor Upon Open
« on: January 15, 2007, 01:25:17 PM »
Is there a way to have a reactor that will identify the current layout tab upon opening & automatically run a corresponding script file who's name matches the layout name?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Script Layout Reactor Upon Open
« Reply #1 on: January 15, 2007, 01:37:50 PM »
Don't think so since you can't use command calls in reactors, and I don't know of any way to use a script without a call to the 'script' command.  If you can figure out a way to issue the script without the command, then yes.

With that said, you might not need a reactor.  You maybe just want to use the 's:startup'.  You will want to use this as it fires after Acad loads all it's stuff, that way you can use a command in the call backs.  All you need to do is test the variable 'ctab' and then issue the right script call.  I don't use the 's:startup' so I'm not sure how one would go about using it, but I have seen this stated as a way to do stuff like this.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Script Layout Reactor Upon Open
« Reply #2 on: January 15, 2007, 01:50:09 PM »
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.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Script Layout Reactor Upon Open
« Reply #3 on: January 15, 2007, 01:53:29 PM »
Sure .. but it doesn't really need to be a reactor ...

Write a lisp that executes the script as needed when you run it. Make it fully functional.
Load it in every drawing when the drawing opens by placing it in the acad.lsp or acaddoc.lsp and call it there
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

bmossman

  • Guest
Re: Script Layout Reactor Upon Open
« Reply #4 on: January 15, 2007, 08:57:48 PM »
Sure .. but it doesn't really need to be a reactor ...

Write a lisp that executes the script as needed when you run it. Make it fully functional.
Load it in every drawing when the drawing opens by placing it in the acad.lsp or acaddoc.lsp and call it there

Thanks for the tip!

HofCAD

  • Guest
Re: Script Layout Reactor Upon Open
« Reply #5 on: January 16, 2007, 09:11:32 AM »
Write a lisp that executes the script as needed when you run it. Make it fully functional.
Then You can load AutoLISP files into a CUI file using the Customize tab of the Customize
User Interface editor.
It is loaded it in every drawing when the drawing opens.

HofCAD CSI

GDF

  • Water Moccasin
  • Posts: 2081
Re: Script Layout Reactor Upon Open
« Reply #6 on: April 21, 2018, 10:54:43 AM »
This what I got to work:
 (strcat (getvar "dwgprefix") (getvar "ctab"))

Code: [Select]
(defun C:PMPDF  ()
  (command
    ".-plot"
    "Y"
    (getvar "ctab")
    "DWG To PDF.pc3"
    "Arch full bleed D (36.00 x 24.00 Inches)"
    "Inches"
    "Landscape"
    "N"
    "layout"
    "1:1"
    ""
    "Y"
    "PM (FULL SIZE).CTB"
    "Y"
    "Y"
    "N"
    "N"
    (strcat (getvar "dwgprefix") (getvar "ctab"))
    "N"
    "Y")
  (princ))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64