Compiled exe directory question

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
djs
Junior Coder
Posts: 47
Joined: Sun Apr 29, 2012 4:21 pm

Compiled exe directory question

Post by djs » Wed Aug 08, 2012 2:41 pm

Is it possible to set the compile options to have the script compile to the script directory?

I use the same core script for several projects, each in a separate directory (branches in svn), but when I compile, I have to change the compile directory to be the directory of the script. It won't work if I don't have a directory for the output.

So options like:
COMPILE_OPTS|c:\svn\myproj\branches\client1\MyMacro.exe
work just fine, but trying:
COMPILE_OPTS|MyMacro.exe
doesn't, it says destination folder doesn't exist.

And yes, I've tried:
COMPILE_OPTS|.\MyMacro.exe
which compiles it somewhere, but not to my script directory.

Thanks!
Dan

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Aug 09, 2012 10:26 pm

I don't know of any setting or option to do what I think you want to do. My first thought was to set the registry but after finding the last directory I used for compiling in a half dozen places in the registry, I decided I didn't know enough to go that route. So here is a method that I think will do what you are looking for.

This requires the Exit> function which was introduced in Macro Scheduler version 10

Paste the following into a new script created from the main menu then set up a hot key for the script

When you have entered a script via Windows Explorer and are ready to compile, use the hot key combination to run this.

Pressing the hot keys will place a block of script into your current script, Run that block of script, then remove that block of script.

What the block of script does is open a browse dialog with the initial directory set to the "Script_Dir" variable which should be the folder you are working in. The script then selects a file in that folder and closes. It doesn't do anything with the file so the file doesn't even have to exist. But the act of opening a file in the browse dialog sets the Script_Dir location to be the default Macro Scheduler directory location. Then when you compile, that is the default folder for the compile to leave the executable.

IF you have a compile line at the top of your script, the folder in the compile line will be the default for the compile no matter what the current default browse folder might be set to.

Hope I understood your question correctly and hope this works for you.


Code: Select all

Let>data=
Let>data=%data%////////////////  Start ////////////////%crlf%
Let>data=%data%////////////////////////////////////////%crlf%
Let>data=%data%////////////////////////////////////////%crlf%
Let>data=%data%%crlf%%crlf%%crlf%%crlf%%crlf%%crlf%
Let>data=%data%Dialog>SetBrowseFolder%crlf%
Let>data=%data%object SetBrowseFolder: TForm%crlf%
Let>data=%data%object msButton1: tMSButton BrowseStyle = fbOpen end%crlf%
Let>data=%data%  object Edit2: TEdit end%crlf%
Let>data=%data%end%crlf%
Let>data=%data%EndDialog>SetBrowseFolder%crlf%
Let>data=%data%SetDialogProperty>SetBrowseFolder,msButton1,InitialDir,script_dir%crlf%
Let>data=%data%SetDialogProperty>SetBrowseFolder,msButton1,DoBrowse,True%crlf%
Let>data=%data%Exit>0%crlf%
Let>data=%data%%crlf%%crlf%%crlf%%crlf%%crlf%%crlf%
Let>data=%data%////////////////////////////////////////%crlf%
Let>data=%data%////////////////////////////////////////%crlf%
Let>data=%data%////////////////  END  /////////////////%crlf%

PutClipBoard>%data%

Press ctrl
send>v
Release ctrl
Wait>0.3
Press up * 25
Wait>0.3
Press f8
Wait>0.3
Press f9
WaitWindowOpen>Open
Send>qwerty
Press Enter
WaitWindowClosed>Open
Press ctrl
Send>z
Release ctrl

//Remark the following three lines
//If you don't want to start compile
Press ctrl
Press f9
Release ctrl

djs
Junior Coder
Posts: 47
Joined: Sun Apr 29, 2012 4:21 pm

Post by djs » Thu Aug 09, 2012 10:46 pm

You understood pretty well!!!!

Interesting approach, but not sure it solves the problem of svn constantly versioning the file because of the update. I guess I wouldn't have to save the changes, so there would be no 'diff' caused by this.

The problem usually comes when I'm trying to roll changes back into the original core build. Its a diff that wants to be resolved :)

To be honest, its a minor annoyance. I wish I could say %SCRIPT_DIR% in the compile options on the first line, but that doesn't seem to work like I would expect. Maybe I just didn't do it right.

Dan

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts