The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Run macro after opj file opened direct from file

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
blank_name Posted - 02/06/2003 : 4:31:19 PM
Hi,

I have a number of different projects that require the use of different macros. If I run from the command line something like '..\origin60.exe -a Petesmacros.cnf Pete.OPJ' ,
I can then define endopen in Petemacros.cnf eg

def endopen {
run %Gmacros.cnf;
};

This is fine from the command line.

However the users would like to be able to doubleclick on an opj file and do the equivalent.
If an opj file is opened this way then the endopen macro does not apply so I can find no way to load macros depending on the name of the opj as above.

The best I have been able to do is to alter the folder options for opj files from the default open to :

\\ukapphres006\netapps_w$\origin60\origin60.exe /dde -i peteorigin.ini %1

where peteorigin refers to petemacros.cnf, and in petemacros.cnf I run/define all the required macros for the different applications. Crude, but macro names may conflict & other problems may occur.
I guess the problem boils down to the fact that I can't get any code to run after an opj file has been opened by doubleclick..

Have discussed this problem with Originlab a while back.

Any suggestions/help would be appreciated..

Cheers,

Pete
6   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 02/11/2003 : 10:44:50 AM
Hi Mike,

Thanks for your helpful reply! Your suggestion worked as you said and okay, so it's not quite double-clicking but pretty close! I presume the limitation in not being able to do this is a windows feature rather than origin limitation?

Anyway, thanks and FYI :

Example Bat File:

rem LoadOldOPJFiles.bat
@echo off
;C:
;cd C:\Origin60
start \\ukapphres006\netapps\origin60\Origin60.exe -p "C:\origin 6.0" -i azrorigin.ini -a LoadOldOPJFiles %1
cls
exit

LoadOldOPJFiles.cnf :

def endopen {

if(exist(projecttype)>0) %T=ProjectType[1]$;
if(exist(projectid)>0) %T=projectid[1]$;

If(%[%T,1:8]=="HTDR2001") run htdr2001macros.cnf;

If(%[%T,1:8]=="HTDR2000") run htdr2000macros.cnf;

}

You get the idea...it's actually very useful for all our networked applications, the user can select any old opj file and load all the required code so they can carry on where they left off.

Cheers,

Pete

peter.cook Posted - 02/11/2003 : 10:25:21 AM
Hi Laurie,

Thanks for reply. The approach isn't practical as I'm referring to previous opj files. The only 'record' as such of the macros required is in a string dataset eg ProjectType[1]$.

Nonetheless, I tried your idea but found that the code in the lable runs before the project is 'opened' or fully loaded ie if the code associated with the label is

type -b %G;

then the dialog always displays UNTITLED - is this expected?

Cheers,

Pete

Mike Buess Posted - 02/07/2003 : 11:12:21 AM
Hi Pete,

Please ignore the earlier version of this post if you read it. I don't think I understood what you wanted to do and might not still. Are you saying you would like to redefine the endopen macro when someone opens a project in explorer by double-clicking? And you would like to do that by loading a custom config file like you can do from the command line with the -a switch? If so, Window's SendTo feature might be a possible compromise. I've used it before to import data files and issue the proper commands to Origin at the same time. Here's an outline of the method.

1> Create a batch file in Origin's program folder (I'll use the path C:\Origin60 in this example.) Call it anything, say Pete.bat.

2> Edit the batch file to look like this...

rem Pete.bat
@echo off
C:
cd C:\Origin60
start Origin60.exe -a PetesMacros %1
cls
exit

(The last two commands merely close the DOS box in which the batch program runs and probably aren't necessary in any version of NT.)

3> Place a shortcut to the batch file in your profile's SendTo folder. I'll call the shortcut "Pete's Origin".

Now you can right-click on a project file and select SendTo->Pete's Origin. The path\name of the project is passed to the batch program and it opens in Origin after Petesmacros.cnf runs.

The technique doesn't quite do what you want but has been useful for me in the past.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/07/2003 11:13:10 AM

Edited by - Mike Buess on 02/07/2003 4:05:28 PM

Edited by - Mike Buess on 02/07/2003 5:43:33 PM
Laurie Posted - 02/07/2003 : 10:32:51 AM
What about having a window within the project that has a text label, associated with script, that is set to run on Window Create?

OriginLab Technical Support
peter.cook Posted - 02/07/2003 : 09:40:16 AM
HI Mike,

This isn't the problem. I do routinely add macros to the ini file such that when Origin is open we have customised menus and macros available. It is actually what I have done as per original note, only I have a customised ini file peteorigin.ini in the command line for 'folder options' for opj files but this only works by loading all macros required for all our different applications. What I would like to do is the equivalent of the command line eg '..\origin61\origin61.exe -i peteorigin.ini PetesProject.opj' only by double clicking in the 'explorer' hence altering the 'folder options' for opj files. The redfined endopen macro eg

def endopen {
type b %G;
}

is defined in petemacros.cnf, referred to in peteorigin.ini.

Cheers,

Pete



Mike Buess Posted - 02/06/2003 : 6:32:13 PM
Hi Pete,

You could add Petemacros.cnf to the configuration file list for the Full Menus in Origin.ini. For a standard installation the Config section of Origin.ini contains the following lines...

Title1=Full Menus
File1=Macros FullMenu

Just add Petemacros to the File1 line and your macros will always be available on startup.

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000