Jump to content

Problem With LISP Code on Corporate Machine vs Home Machine


Recommended Posts

Posted

I have a copy of Lee-Mac's Popup code which I tried at my office and all that happens is a quick blink on the mouse click but no popup window. I copied the same code on my home machine and it works great. I will double check the copy I have at the office later today but does anyone have a suggestion on what might be limiting it's running on a particular machine. The IT guys at this place have some policies but they gave my machine almost full-access because I'm doing development.

 

(defun c:test (/ x)
 (vl-load-com)

(LM:Popup "Title Text" "This is a test message." (+ 2 48 4096))

)

;;-------------------------=={ Popup }==----------------------;;
;;                                                            ;;
;;  Displays a pop-up message box prompting the user.         ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url]       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  title - Text to be displayed in the pop-up title bar      ;;
;;  msg   - Text content of the pop-up message box            ;;
;;  flags - Integer indicating icon & button appearance       ;;
;;------------------------------------------------------------;;
;;  Returns:  Integer indicating the button pressed to exit   ;;
;;------------------------------------------------------------;;
(defun LM:Popup ( title msg flags / wsh res )
 (vl-catch-all-apply
   (function
     (lambda nil
       (setq wsh (vlax-create-object "WScript.Shell"))
       (setq res (vlax-invoke-method wsh 'popup msg 0 title flags))
     )
   )
 )
 (if wsh (vlax-release-object wsh))
 res
)

Posted

Are the two computers exactly the same in terms of OS, software (AutoCAD) and hardware?

 

What do you mean "almost full access"? Either you got full access or you don't. You want full admin rights. Tell IT to go pound sand for awhile and stop getting in the way of you doing your job.

Posted

It may be from the version of Windows that are you using - please try to run this line in console:

(vlax-invoke-method (vlax-create-object "WScript.Shell") 'popup "TEST" 0 "X" 2)

Posted

MSasu,

 

I made sure that (vl-load-com) had been executed and then ran the command above from the console and got this message:

 

; error: bad argument type: VLA-OBJECT nil

 

I did the same thing on one of another machine running XP with 2013 and it worked without error.

 

I have double checked with two other computers (XP with AC 2009) in this office and Lee-Mac's code is rock solid on those, runs perfectly. I also double checked that wscript.exe is on this machine and that windows scripting is enabled, affirmative to both. I cold booted this machine this morning just in case. No matter how many times I try it on my corporate computer it only returns nil on the command line. The IT guys are not in yet, but believe me, as educated as these guys are on networking they will quickly become deer in the headlights on this kind of issue. I know what I would do with this machine and that would be to reformat the hard drive and reinstall everything...but IT will never allow me to do that, unless I bribe them. :x

 

Remark,

 

Tell IT to go pound sand for awhile and stop getting in the way of you doing your job.

 

Amen brother...but that and $4 US will get me a latte at Starbucks.

Posted

Try without the 4096 bit-code, i.e.:

 

(LM:Popup "Title Text" "This is a test message." (+ 2 48))

Posted

Tried leaving off the 4096 but the results were still the same. Only nil came back on the command line and no popup window whatsoever. It is isolated to just this machine. Every other machine in this office will run the code just fine. Since I'm able to work with Remote Desktop to another machine which is running the code correctly, I'm just going to chaulk this one up to this machine having something wrong with it and move on for now.

Posted

A simple pop up if you only want a simple message no title etc but grabs your attention

 

(setq ans "this is a popup")
(alert ans)
or
(alert "this is a popup")

Posted

Not sure if this is an acceptable option or not, but DOSLib actually has some great interface (dialogs, HTML, popup, balloon, etc) LispFunction Methods. Really nice for folks like me that don't require custom dialogs, never learned DCL, and/or don't have time for all that's needed for Windows Forms, or WPF User Controls. :thumbsup:

Posted

Thanks. The one-liner that MSasu posted is a real killer piece of code. Simple, to the point and it works....on every machine I have tested except this POS they gave me to develop on. That's one of the nice things about being a developer. Once you get your code debugged, you don't have to run it anymore. :)

Posted
The one-liner that MSasu posted is a real killer piece of code. Simple, to the point and it works....on every machine I have tested except this POS they gave me to develop on.

 

That one liner also doesn't release the WSH Object from memory. :roll:

Posted

@Bill Tillman: I just created that from Lee's code in order to allow you to see the error that is issued; I didn't had in mind any kind of optimization. Please don't ignore that Lee paid attention to other elements - clean behavior and memory garbage clean-up.

For sure my excerpt it will not compare in terms of simplicity and effectiveness with the equivalent line below (presuming you have Lee's routine loaded at start-up from a utility library):

 

(LM:Popup "X" "TEST" 2)

Posted
MSasu,

 

I made sure that (vl-load-com) had been executed and then ran the command above from the console and got this message:

 

; error: bad argument type: VLA-OBJECT nil...

Tell's me your WSH is not setup correctly. There might have been an issue while installing which didn't register your scripting host as a COM server.

 

Perhaps try re-installing it from here: http://support.microsoft.com/kb/188135

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...