Author Topic: Change Directory after SAVEAS  (Read 2534 times)

0 Members and 1 Guest are viewing this topic.

laidbacklarry

  • Guest
Change Directory after SAVEAS
« on: February 26, 2011, 01:34:47 PM »
Our application includes a "Project Manager" dialog used to quickly select a Project Folder and then a specific Drawing which is then Opened and set up - various settings are restored, sysvars set, etc.

Result is that the "current directory" remains the directory listed in the shortcut "Start in" setting. And this is critical to many functions loading and functioning correctly.

The SAVEAS command has a bad habit of changing the "current directory" to the directory where the current drawing is located - which is NOT the "Start in" folder. This doesn't happen often because we have a replacement command for SAVEAS which accomplishes the desired result without the bad effect. But sometimes a user is determined to use SAVEAS which destroys the linkage to all resource files.

Wondering if anyone has an idea how to force a change back to the "Start in" folder. Doslib's dos_chdir doesn't do the trick. And even if we SHELL out to DOS and use CHDIR, the change doesn't hold when we EXIT back to AutoCAD.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Change Directory after SAVEAS
« Reply #1 on: February 26, 2011, 08:29:56 PM »
I guess you have tried to redefine the SAVEAS command?

The next step is to use a command reactor.

Someone else may have a better idea.

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.

laidbacklarry

  • Guest
Re: Change Directory after SAVEAS
« Reply #2 on: February 27, 2011, 12:29:33 AM »
I guess you have tried to redefine the SAVEAS command?

The next step is to use a command reactor.

Someone else may have a better idea.



Yeah, but we had some user complaints so we removed the Redefine... we still have the replacement - "Save Copy As..." which does everything we want, but SAVEAS is such a commonly used function that it's hard to totally abandon it... and, there are some other Acad commands that result in the same problem - the "current directory" is changed to whatever appears in the GETFILED dialog. So, I'll give this a few days to see if any ideas come forward and then simply eliminate access to the screwy ACAD commands. I'm not totally above simply telling our users "Command Not Available in... ". Plus, I'm not sure a command reactor will cure this problem.

But, seriously, when the "current directory" is changed, it pretty much screws up everything that should happen downstream. At present, the only solution for a user is to Exit our program and start up again. But, thanks for taking a look.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
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.

laidbacklarry

  • Guest
Re: Change Directory after SAVEAS
« Reply #4 on: February 27, 2011, 02:15:17 PM »
Do either of these point the way for you?

http://msdn.microsoft.com/en-us/library/aa363806%28v=vs.85%29.aspx

http://www.pctools.com/forum/showthread.php?11393-Set-current-directory-when-using-run-method&p=34983#post34983

Thanks... both of these look promising, second one probably easiest to implement. Will let you know how it works out. Thanks again.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Change Directory after SAVEAS
« Reply #5 on: October 21, 2013, 03:55:54 PM »
I know this is an OLD post..
just want to answer..

SAVEAS = Save drawing and change the directory file
QSAVE = make a save without prompting and keep same dwg name.
SAVE = similar to SAVEAS, but still in to the actual directory so it make only a copy.

this is native AutoCAD command.
Keep smile...