Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Temporary working directory in mapkey

mekaneck

New member
I'd like to make a mapkey that would change my working directory to c:\temp, then do some things, and then change the working directory back to what it was originally. Any thoughts on how to do this?


Thanks!
 
hi mekaneck,


first you create map key and save as it into(newname)-config.pro, see the saved location, then you copy this file with config.win (for mapkey picture, saved inthis file) to your temporery directory.


create a new proe shortcut and edit the start point


check this out


thanks,


sreeni
 
Yes, but what I am trying to do is get a mapkey that will do the following:

  1. <LI>Change the working directory to c:\temp</LI>
    <LI>do some steps here (that I already have a mapkey for)</LI>
    <LI>Change back to whatever directoryI was in before I ran the mapkey.</LI>


The problem is the 3rd step. How do I get Pro/E to go back to whatever directory I started in?


I'm assuming there is no easy answer, so I may have to write a batch script to do it.
 
The problem is the 3rd step. How do I get Pro/E to go back to whatever directory I started in?


I'm assuming there is no easy answer, so I may have to write a batch script to do it.


check your PM
 
Here's the mapkey I made in case anyone needs to do the same thing:


Code:
mapkey ct @MAPKEY_LABELchange to temp dir;\
mapkey(continued) @SYSTEMstart p:\\utilities\\change_dir.bat "\%cd\%";\
mapkey(continued) ~ Activate `main_dlg_cur` `File.psh_working_dir`;\
mapkey(continued) ~ Activate `file_open` `Inputname` `C:\\temp\\trail_dir`;\
mapkey(continued) ~ Activate `file_open` `Open`;\
mapkey(continued) DO WHATEVER YOU WANT HERE
mapkey(continued) ~ Activate `main_dlg_cur` `Utilities.psh_util_trail_train`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist`1 \
mapkey(continued) `C:\\temp\\trail_dir\\~trail.txt`;


And here's the change_dir.bat file which the mapkey calls:


Code:
@echo off


set curdir=%~f1
set procurdir=%curdir:\=\\%
set trailpath=c:\temp\trail_dir
set trailfile=~trail.txt


cd /d "%trailpath%"


echo.^!trail file version No. 1301>"%trailfile%"
echo.~ Activate `main_dlg_cur` `File.psh_working_dir`>>"%trailfile%"
echo.~ Activate `file_open` `Inputname` \>>"%trailfile%"
echo. `%procurdir%`>>"%trailfile%"
echo.~ Activate `file_open` `Open`>>"%trailfile%"


exit


So here's how it works:

  1. <LI>The mapkey calls the batch file, and uses Pro/E's working directory as an input argument (that's the "\%cd\%" garbage in the mapkey)</LI>
    <LI>The batch file takes the working directory, puts two \'s wherever it sees one "\", and then creates a trail file that will make Pro/E change to that working directory.</LI>
    <LI>The mapkey changes the directory to "C:\\temp\\trail_dir"</LI>
    <LI>Then anything can be done here</LI>
    <LI>The mapkey opens up the trail file that was created earlier, and runs it (which changes the working directory back to what is was originally).</LI>
 

Sponsor

Articles From 3DCAD World

Back
Top