Need Help: AutoLISP Script Fails When Scheduled

Need Help: AutoLISP Script Fails When Scheduled

giulio_beziza
Observer Observer
548 Views
6 Replies
Message 1 of 7

Need Help: AutoLISP Script Fails When Scheduled

giulio_beziza
Observer
Observer

Hello everyone,

 

I need help with a problem I've encountered while trying to schedule my script.

 

I have a custom AutoLISP code that needs to run daily. This code launches a couple of batch files through the shell, opens some DWG files, edits them, purges them, and saves them in another format.

 

Everything works fine when I manually launch the script in AutoCAD. However, when I schedule it as a task on my virtual machine (Windows 10 + AutoCAD 2023), it fails to work correctly.

 

I've set the permissions for the "Program Files" folder to "Everyone" and have also registered the script in the AUTOLOAD startup suite.

 

The scheduled task is supposed to launch a batch file every day using the following command:

"C:\Program Files\Autodesk\AutoCAD 2023\acad.exe" /B "{path/to}/task.scr"

 

The task.scr file contains a single line, which is the command to run the application I've registered in the startup suite:

_CODAGRR

 

I can't understand why it doesn't work. Any suggestions?
0 Likes
549 Views
6 Replies
Replies (6)
Message 2 of 7

paullimapa
Mentor
Mentor

Does it work when you manually launch the batch file that contains this line

"C:\Program Files\Autodesk\AutoCAD 2023\acad.exe" /B "{path/to}/task.scr"
 

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 7

giulio_beziza
Observer
Observer

Hello, thank you for your reply.

 

When I initiate that batch, I notice a new process, acad.exe, in Task Manager. I see it utilizing CPU and memory, but I don't receive any feedback from the AutoCAD interface; it doesn't start (no GUI).

I left the task running for hours, but it seems the script isn't running.

 

Perhaps my syntax is incorrect, or there might be a cleaner way to schedule an AutoLISP script.

 

Otherwise, if I start AutoCAD and manually input the command, I receive feedback that all commands are running correctly by observing the AutoCAD interface.

0 Likes
Message 4 of 7

paullimapa
Mentor
Mentor

Since running that batch file manually does not launch AutoCAD window on the screen I would start the trouble shooting there. What if you simplified it to just this

"C:\Program Files\Autodesk\AutoCAD 2023\acad.exe"

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 7

giulio_beziza
Observer
Observer

It seems I found the problem.

 

I cannot execute an AutoLISP command until I open a file.

 

So, I scheduled the opening of a fake empty file before executing the command.

It seems to work now.

 

I'll add some logging in AutoLISP to verify the correct execution.

 

I really appreciate your support.

Thanks for your support.

0 Likes
Message 6 of 7

paullimapa
Mentor
Mentor

Glad you figured it out…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

Have you looked at Accoreconsole ? Its more useful in a Bat situation processing multiple files and as it works directly on the dwg file does not have a graphic interface, it is also very fast.

0 Likes