Script not fully completing

Script not fully completing

gv6823otG42ZL
Enthusiast Enthusiast
434 Views
8 Replies
Message 1 of 9

Script not fully completing

gv6823otG42ZL
Enthusiast
Enthusiast

The issue I have is the following: When I run the GRE_IEMBED.scr script, the script works on drawings that have tiffs that previously, already share the same file location. But with drawings that previously didn't share the same file location, the script completes the repath command successfully, but when the iembed command is called upon, it won't embed the tiff into the drawing if the tiff link was previously broken before the repath command is ran and updates the path. Is there a potential fix for this? The workaround i found is to have another script run first which is called REPATHSCRIPT.scr and if i run this first, and then run the original script, this fixes the issue, but the end goal would be to just have one script do everything if that is possible. I have attached all my commands and scripts but I cant attach any drawings, due to the thread not allowing .TIF extensions to be attached, and all the dwg files have tiffs associated with them.

 

GRE_IEMBED.scr:

zoom
e
SwitchToModel
(repath)
qsave
check
IEMBED

 

REPATHSCRIPT.SCR:

SwitchToModel
(repath)
qsave

 

 

0 Likes
435 Views
8 Replies
Replies (8)
Message 2 of 9

paullimapa
Mentor
Mentor

have you tried using a master script which uses the SCRIPTCALL command?

https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-77FF5E24-4ECD-41D6-BD8A-9DD5AAD468EE


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

gv6823otG42ZL
Enthusiast
Enthusiast

I haven't. What would something like that look like. I'm not to familiar with the SCRIPTCALL command.

0 Likes
Message 4 of 9

paullimapa
Mentor
Mentor

try it exactly the way the help file states.  You can now have a single script file that references the other two:

MASTER-SCRIPT.scr:

SCRIPTCALL REPATHSCRIPT.SCR

SCRIPTCALL GRE_IEMBED.scr

 

Note: if the script files are not saved in a folder in one of OPTIONS>Files>Support File Search Path then you'll have to include the entire path ie:

SCRIPTCALL C:\Autodesk\REPATHSCRIPT.SCR

SCRIPTCALL "C:\My Location\GRE_IEMBED.scr"

 


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

gv6823otG42ZL
Enthusiast
Enthusiast

Unfortunately, I was able to try this out, but it is still doing the same thing as before. Thanks for the new command!

0 Likes
Message 6 of 9

paullimapa
Mentor
Mentor

So the problem seems to be with those tifs perhaps not found in the same location as the dwg file...

Are you sure it works when you manually run the repathscript file first before the other?


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

gv6823otG42ZL
Enthusiast
Enthusiast

yes, and i can explain why i know it works. So for this example, i have 10 drawings with .TIF extensions linked to them. If i go into auto script and attempt to just run GRE_IEMBED.scr, everything will appear to run successfully. This should mean that all tiffs have successfully been embedded into the dwg file. But when I go and delete the tiffs. certain drawings have a notification, that it cant fine the tiff and when i do an external references, it says the tiff isn't found (because it didnt embed correctly.) Other drawings did embed properly and these are the ones that originally shared the same file location. Now lets go through that whole example again, but this time i go into autoscript, and run the REPATHSCRIPT.SCR, and then once that's done, i go into auto script again and run GRE_IEMBED.scr. After these are ran separately on the same batch of drawings, I go in again and remove the tiffs, but this time when i open up each drawing, and do an external references, each tiff extension shows its been embedded and i can see the tiff in the drawing and don't get any notification that the tiff is missing anymore.

0 Likes
Message 8 of 9

paullimapa
Mentor
Mentor

Sounds like you have xref dwgs that contain tifs. So each dwg have to be done first. Then when you open each dwg again now you run the embed script it'll work. So you have no choice but to run the scripts separately.


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

Sea-Haven
Mentor
Mentor

You can look for a file and obviously if not found a variable will be nil. Maybe use (VL-FILE-SIZE "Your path & filename") it will return nil if no file exists. 

 

If your scripts are lisp based can skip steps, or use (exit) which does just that.

 

If you want to run multi scripts in sequence why not just add last line "script nextscript.scr"

0 Likes