Jump to content

Run command when certain command has been given


Recommended Posts

Posted

Hello,

 

I would like to perform an certain action when a command is run.

 

We use a program called AutoTurn for vehicle checks. We have 1 seat network license for about 25 users. We don't use the program much but when it's used it keeps the license active untill AutoCAD is shut down completely.

 

We send out an office wide mail to see who uses the software.

I would like to set up something so people can tell who uses the program.

 

I think about using a lisp of some sort that goes to a webpage and saves the username so everyone can check that website to see if the license is in use.

 

i'm not able to edit the code of the program to add some line that does it for me so i would like to recognise the last command that is given when loading the Autoturn program.

 

The command name is 'CMD_AT_INITIALIZEDONE'.

I allready made an lisp with that command and some alert action to check if it loads, but i think the command is overwriten when the program loads.

 

Is there a way to check if a command has been ran and follow it with an action?

Posted

You would first need to ascertain whether running your command triggers evaluation of a Command Reactor callback function or a LISP Reactor callback function (or neither).

 

In order to test this, load the following code, and then try running your command:

(   (lambda nil (vl-load-com)
       (foreach grp (vlr-reactors :vlr-command-reactor :vlr-lisp-reactor)
           (foreach obj (cdr grp)
               (if (= "autoturn-test" (vlr-data obj))
                   (vlr-remove obj)
               )
           )
       )
       (vlr-command-reactor "autoturn-test" '((:vlr-commandwillstart . cmdcallback)))
       (vlr-lisp-reactor    "autoturn-test" '((:vlr-lispwillstart    . lspcallback)))
       (princ)
   )
)
(defun cmdcallback ( rtr arg )
   (princ (strcat "\nCMDCALLBACK EVALUATED FOR " (strcase (car arg)) " COMMAND."))
   (princ)
)
(defun lspcallback ( rtr arg )
   (princ (strcat "\nLSPCALLBACK EVALUATED FOR " (strcase (car arg)) " FUNCTION."))
   (princ)
)
(princ)

And then post the command-line output (if any).

Posted
Hello,

 

I would like to perform an certain action when a command is run.

 

We use a program called AutoTurn for vehicle checks. We have 1 seat network license for about 25 users. We don't use the program much but when it's used it keeps the license active untill AutoCAD is shut down completely.

 

We send out an office wide mail to see who uses the software.

I would like to set up something so people can tell who uses the program.

 

I think about using a lisp of some sort that goes to a webpage and saves the username so everyone can check that website to see if the license is in use.

 

i'm not able to edit the code of the program to add some line that does it for me so i would like to recognise the last command that is given when loading the Autoturn program.

 

The command name is 'CMD_AT_INITIALIZEDONE'.

I allready made an lisp with that command and some alert action to check if it loads, but i think the command is overwriten when the program loads.

 

Is there a way to check if a command has been ran and follow it with an action?

 

That command is run automatically no mater which AutoTURN command is run to manage the licenses. We share on license for our office since we only need it briefly on certain road jobs.

(member "at2015x64.arx" (arx))

for 2015 will let you know if it's loaded and using one of those licenses. We generally quit and reopen AutoCAD when we're through to make sure the license is free. You could modify AutoTURN's CUI or add an AutoTURN.mnl to include the lisp since it doesn't come with one.

 

What are you wanting to do?

Posted

The correct way you can via the license manager see who is actually using Autoturn this is ran from Outside Autocad as its part of the network license manager I know this because I manage it. A word of caution if you give everybody access to the management 1 they can kill anyone, 2 they can totally stuff up the network license. We use the same a Autoturn emailgroup if I get a message I normally check as a rule who is using, we have a pretty good response to the request for a user to release the software, they reply to group. You can unload the arx also to release and not close your Autocad. Appload, Loaded applications, at2013x64.arx

 

ScreenShot014.jpg

ScreenShot015.jpg

Posted
You would first need to ascertain whether running your command triggers evaluation of a Command Reactor callback function or a LISP Reactor callback function (or neither).

 

In order to test this, load the following code, and then try running your command:

(   (lambda nil (vl-load-com)
       (foreach grp (vlr-reactors :vlr-command-reactor :vlr-lisp-reactor)
           (foreach obj (cdr grp)
               (if (= "autoturn-test" (vlr-data obj))
                   (vlr-remove obj)
               )
           )
       )
       (vlr-command-reactor "autoturn-test" '((:vlr-commandwillstart . cmdcallback)))
       (vlr-lisp-reactor    "autoturn-test" '((:vlr-lispwillstart    . lspcallback)))
       (princ)
   )
)
(defun cmdcallback ( rtr arg )
   (princ (strcat "\nCMDCALLBACK EVALUATED FOR " (strcase (car arg)) " COMMAND."))
   (princ)
)
(defun lspcallback ( rtr arg )
   (princ (strcat "\nLSPCALLBACK EVALUATED FOR " (strcase (car arg)) " FUNCTION."))
   (princ)
)
(princ)

And then post the command-line output (if any).

 

This is what i get in return. Cadtutor.lsp is above code.

 

Command: APPLOAD
cadtutor.lsp successfully loaded.


Command:
LSPCALLBACK EVALUATED FOR (WRITE-LINE "") FUNCTION.

LSPCALLBACK EVALUATED FOR (PROMPT "COMMAND: ") FUNCTION.Command:
Command: *Cancel*

Command:
Command:
Command: CMD_AT_STEER
AutoTURN Pro 3D 9.0

(c) 2014 Transoft Solutions, Inc. All rights reserved.

Current vehicle is CROW Advieslijst LZV LZV Configuratie E

Forward minimum centerline turning radius = 12.73 meters (lock angle 25.1 deg.)

CMDCALLBACK EVALUATED FOR CMD_AT_STEER COMMAND.
Left click to place vehicle in start location

LSPCALLBACK EVALUATED FOR (COMMAND "_CMDECHO" "0" ) FUNCTION.
2D point or option keyword required.
; error: Function cancelled

LSPCALLBACK EVALUATED FOR (COMMAND "_FILEDIA" "0" ) FUNCTION.
2D point or option keyword required.
; error: Function cancelled

LSPCALLBACK EVALUATED FOR (COMMAND "_FILEDIA" "1" ) FUNCTION.
2D point or option keyword required.
; error: Function cancelled

LSPCALLBACK EVALUATED FOR (COMMAND "_CMDECHO" "0" ) FUNCTION.
2D point or option keyword required.
; error: Function cancelled

LSPCALLBACK EVALUATED FOR (COMMAND "CMD_AT_INITIALIZEDONE" ) FUNCTION.
2D point or option keyword required.
; error: Function cancelled

 

And thanks to the other peeps. I now atleast made a command that unloads the ARX.

 

However i am not able to check the license myself unless there should be a webbased interface. We have no control over the license server machine.

 

Sending out an e-mail is not very efficient. What if the person who uses the license is not reading the e-mail.

People should make an habbit of releasing the license, but that is not likely going to happen anytime soon :P.

 

I want to make it as easy as possible without the use of the right ways :P.

Posted

Management of a server is not just a global access you have immense control of who can do what, you could be given permission to use only that program to check who is using. You can hide, view, run, read, write all sorts of combos. Contact your IT admin.

 

It would be feasible to do a reactor to detect Autoturn has started and write to a file on the server, (getenv "username") this is the name of the user.

 

Will have a think about this. Maybe a simple (if (not "CMD_AT_*" blah blah

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...