#1
|
|||
|
|||
Me_home
Hi, I would like to write a macro that sets ME_HOME to 'u:/' if that disc is available. Otherwise ME_HOME should be set to 'p:/' and, if that's not available to %USERPROFILE%.
Is this possible in ME10 macro language? Hans-Göran Gustavsson |
#2
|
|||
|
|||
I don't think , it's possible in me10 macro , but you can make this with a batch script.
exemple : @ echo off IF EXIST u:\ goto dir_u_ok IF EXIST p:\ goto dir_p_ok :no_dir set ME_HOME=%USERPROFILE% goto launch_me10 :dir_u_ok set ME_HOME=u:\ goto launch_me10 :dir_p_ok set ME_HOME=p:\ goto launch_me10 :launch_me10 rem Your ME10 Line command "C:\Program Files\CoCreate\OSD_Drafting_12.00\me10.exe" Regards |
#3
|
||||
|
||||
What is ME_HOME?
What is this ME_HOME you are trying to set? I searched the install directory for Drafting version 12, but could not find any mention of it. I did find the command ME_HOME_DIRECTORY, which returns the "current ME10 home directory" setting, but nothing about an environment variable.
__________________
John Scheffel |
#4
|
||||
|
||||
Hi
The answer to your question is no, there is no such macro call. But you can write your own load module using C or C++. I have written such a function a while ago. If you are interested in having a copy, let me know and I try to dig it up somewhere.
__________________
High performance CAD workstations Please visit us at https://www.cadware.nl |
#5
|
|||
|
|||
I just wrote this macro. It is used to make sure that ME10 has a suitable start directory. On the windows platform we aren't certain that the network disks are there. The only problem at the moment is that the DISPLAY function is behaving strangely. Most of the time it says "Enter item to display". At the moment i comment out the DISPLAY lines.
Hans-Göran Gustavsson DEFINE Go_home INQ_ENV 10 LET Awm_os (INQ 4) IF ((Awm_os=3) OR (Awm_os=6) OR (Awm_os=7) OR (Awm_os=8)) TRAP_ERROR CURRENT_DIRECTORY 'U:\' IF (CHECK_ERROR) TRAP_ERROR CURRENT_DIRECTORY 'P:\' IF (CHECK_ERROR) LET USERPROFILE (GETENV 'USERPROFILE') CURRENT_DIRECTORY USERPROFILE DISPLAY ('Current directory set to USERPROFILE.') ELSE DISPLAY ('Current directory set to P disk.') END_IF END_IF ELSE LET Me_home (GETENV 'HOME') CURRENT_DIRECTORY Me_home END_IF END_DEFINE |
#6
|
||||
|
||||
Quote:
Code:
DEFINE Go_home INQ_ENV 10 LET Awm_os (INQ 4) IF ((Awm_os=3) OR (Awm_os=6) OR (Awm_os=7) OR (Awm_os=8)) TRAP_ERROR CURRENT_DIRECTORY 'U:\' IF (CHECK_ERROR) TRAP_ERROR CURRENT_DIRECTORY 'P:\' IF (CHECK_ERROR) LET USERPROFILE (GETENV 'USERPROFILE') CURRENT_DIRECTORY USERPROFILE DISPLAY ('Current directory set to USERPROFILE.') ELSE DISPLAY ('Current directory set to P disk.') END_IF END_IF ELSE LET Me_home (GETENV 'HOME') CURRENT_DIRECTORY Me_home END_IF END_DEFINE I'm not sure why you are having problems with DISPLAY, but it's normally not necessary to enclose the quoted string in parenthesis unless you are performing a string operation, such as: ('Current directory is set to ' + Userprofile) However, it should work even if not needed. One thing I don't understand about the logic. If it finds a drive U:, it does nothing since there is no ELSE on the first IF (CHECK_ERROR). Is this what you wanted?
__________________
John Scheffel |
#7
|
|||
|
|||
The users used to have hpux machines and ME10 was being started in their home directory. The U disk points to their unix home directory. I thought that it might be nice to warn people when ME10 didnt start in the usual disk. When it does, the warning would just be a waste of time. The parenthesis was just one of the things I tested when I found that the DISPLAY sentence works only sometimes. If there are goblins in the computer, why not try to use some magic to get rid of them?
The code works every time if I run it after ME10 has started. My collegue says that macros often behaves strange when run in the start sequence of both ME10 and WorkManager. Maybe I should try a WAIT before each DISPLAY. Hans-Göran Gustavsson |
#8
|
||||
|
||||
If you are using INPUT to load and run this macro from a file, that might be the source of the problem. We have run into a lot of odd problems because macro files loaded by INPUT were not executing the macros in the order expected. I have never really understood how Drafting handles INPUT files, but it does not necessarily finish loading and running the INPUT file before proceeding to the next command in the file that executed the INPUT command. The problem is most confusing if you have nested INPUT calls, where the main startup file INPUTs a file, which INPUTs another file, etc.
You might try using the PROMPT_LIST and TRACE commands to view the file loading and command order. See the online Help for details on using these commands.
__________________
John Scheffel |
#9
|
||||
|
||||
Hi,
You can use INPUT IMMEDIATE 'filename' IMMEDIATE inputs and executes commands immediately instead of appending them at the end of the queue.
__________________
High performance CAD workstations Please visit us at https://www.cadware.nl |
#10
|
||||
|
||||
Quote:
Quote:
INPUT IMMEDIATE (My_folder + '/my_file.m') will result in an " Enter 'input_filename' " message at startup. This means that you must place the file somewhere in the current search path and call it by name only, or use a hard coded full path. I have always thought this was an odd restriction. I can't think of any reason that this would not be allowed. This makes it difficult to use this option in transportable code.
__________________
John Scheffel |
#11
|
||||
|
||||
One of the things that I found when wanting to run a macro after it has been INPUT is to just call the macro right after the END_DEFINE statement of that macro.
Example: DEFINE My_macro Your code goes here.... END_DEFINE My_Macro {Run the macro} This seems to take care of the when it is run in comparision to when the macro is loaded into Drafting. Just make sure to keep your dependencies correct in case one macro sets up information for another one to use. Also I have had very little problems with running macros that are loaded from the customize file. Cheers Thom |
#12
|
|||
|
|||
I change the original code of this thread to make it more universal.
It is now a part of my personal 'goodies' Code:
DEFINE check_drive PARAMETER drive_name {check IF drivename excists} {INPUT : drivename, "c:"} {OUTPUT: RETURN_VAL , 0 = drive not found} { : , 1 = drive found} TRAP_ERROR CURRENT_DIRECTORY drive_name IF (CHECK_ERROR) LET RETURN_VAL 0 ELSE LET RETURN_VAL 1 END_IF END END_DEFINE |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|