Author Topic: InputBox  (Read 6171 times)

0 Members and 1 Guest are viewing this topic.

Patrick_35

  • Guest
InputBox
« on: August 04, 2006, 04:10:40 AM »
Hello
Also my small contribute share on this fabulous site
To supplement what Gary Fowler did on this nice post http://www.theswamp.org/index.php?topic=9684.0 and in same logic, here the InputBox function

@+

Code: [Select]
(defun InputBox (Title Message Default XPos YPos / users1 value)
  (vl-load-com)
  (if (not Xpos)
    (setq XPos (* (/ (car (getvar "screensize")) 2) 10)))
  (if (not YPos)
    (setq YPos (* (/ (cadr (getvar "screensize")) 2) 10)))
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (setq users1 (getvar "users1"))
  (acad-push-dbmod)
  (vla-eval
    *acad*
    (strcat
      "ThisDrawing.SetVariable \"USERS1\","
      "InputBox (\""
      Message
      "\", \""
      Title
      "\", \""
      Default
      "\", \""
      (rtos XPos)
      "\", \""
      (rtos YPos)
      "\")"
    )
  )
  (setq value (getvar "users1"))
  (setvar "users1" users1)
  (acad-pop-dbmod)
  value
)

(InputBox "My title" "My Message" "Default" nil nil)
(InputBox "My title" "My Message" "Default" 150 200)

Didge

  • Bull Frog
  • Posts: 211
Re: InputBox
« Reply #1 on: August 04, 2006, 07:20:01 AM »
Nice One Patrick  :-)
Think Slow......

lispman21

  • Guest
Re: InputBox
« Reply #2 on: August 04, 2006, 08:24:56 AM »
Never used an input box like this.  What type of application would you use it in or for.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: InputBox
« Reply #3 on: August 04, 2006, 08:35:08 AM »
Patric I get this error using ACAD2000.

Code: [Select]
Command: (inputbox "My title" "My Message" "Default" nil nil)
; error: Automation Error. VBA expression evaluation failed
; reset after error
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.

Fatty

  • Guest
Re: InputBox
« Reply #4 on: August 04, 2006, 08:35:46 AM »
Hi, guys
You can play with this also: 8-)
Code: [Select]
(defun AnswerMe (TitleStr MsgStr  / IntPass StrPass)
(vl-load-com)  
(setq WshShell (vlax-create-object "WScript.Shell"))
(setq IntPass (vlax-invoke WshShell 'Popup
TitleStr  7
MsgStr  35)
      )

(setq StrPass
(cond ((= intPass 6) "Yes")
      ((= intPass 7) "No")
      ((= intPass 2) "Not sure about")))
(alert StrPass);for debug only
(vlax-release-object WshShell)
(princ)
)
; CaLL :
(AnswerMe "Do you want something?" "Answer My Question:" )

Fatty

~'J'~

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: InputBox
« Reply #5 on: August 04, 2006, 08:42:10 AM »
Patric I get this error using ACAD2000.

Code: [Select]
Command: (inputbox "My title" "My Message" "Default" nil nil)
; error: Automation Error. VBA expression evaluation failed
; reset after error

Perhaps include this in the initialization bit Alan --

Code: [Select]
(if (null (member "acvba.arx" (arx)))
    (arxload "acvba.arx")
)

Nice demonstration Patrick; you too Fatty.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: InputBox
« Reply #6 on: August 04, 2006, 08:54:04 AM »
Hummm.
Code: [Select]
Command: (arxload "acvba.arx")
; error: ARXLOAD failed
; reset after error

Search failed to find this.

Gotta go, so I'll look again later.
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: InputBox
« Reply #7 on: August 04, 2006, 09:03:46 AM »
What version of AutoCAD are you runnin' Alan? Maybe it'll have to perform a more intelligent | branched load on the arxname. I've only got 2006 here and don't know them off the top of my head.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: InputBox
« Reply #8 on: August 04, 2006, 11:53:34 AM »
I am using ACAD2000 to test & this one runs fine
http://www.theswamp.org/index.php?topic=9684.0

Must be an ACAD version problem so don't spend any time chasing it.

If I have time later I'll try it in 2006.
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.

LE

  • Guest
Re: InputBox
« Reply #9 on: August 04, 2006, 12:20:21 PM »
I tried too... and I got same error as Alan using A2005 - and having loaded "acvba.arx"

GDF

  • Water Moccasin
  • Posts: 2081
Re: InputBox
« Reply #10 on: August 04, 2006, 03:26:38 PM »
I tried too... and I got same error as Alan using A2005 - and having loaded "acvba.arx"


Same error using 2006

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Patrick_35

  • Guest
Re: InputBox
« Reply #11 on: August 04, 2006, 05:44:04 PM »
Quote
Never used an input box like this.  What type of application would you use it in or for.
If you need an input in your application, you can use it

Quote
Patric I get this error using ACAD2000.
After your message, i tested it in ACAD2000 and the code do it, not error

Quote
I tried too... and I got same error as Alan using A2005 - and having loaded "acvba.arx"
It's "acvba.arx" or "acadvba.arx" ?
In my french version of ACAD2000, i find "acadvba.arx", not "acvba.arx"

Thank's for you code Fatty, good job

@+

Serge J. Gianolla

  • Guest
Re: InputBox
« Reply #12 on: August 06, 2006, 04:32:12 PM »
Patrick, no problemo here on 2006. Ca marche au poil!
Fatty good work too.

Fatty

  • Guest
Re: InputBox
« Reply #13 on: August 06, 2006, 05:11:13 PM »
Thanks to all, guys
I am still learning  :-)

Fatty

~'J'~

Patrick_35

  • Guest
Re: InputBox
« Reply #14 on: August 07, 2006, 03:21:41 AM »
Thanks Serge
Your remark make me think that it will be necessary for me to find a new avatar  :-)
J'ai remarqué aussi qu'il va falloir grandement améliorer mon anglais et désolé pour les fautes   :|
Amicalement

Flatty
I see your code and i don't understand what the parameter number seven can be serve  :?

@+