Script Editor Locks Script File While Opened

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
KTT
Newbie
Posts: 13
Joined: Thu Jul 02, 2009 10:26 pm

Script Editor Locks Script File While Opened

Post by KTT » Mon Jun 14, 2010 6:55 am

I'm using the latest Macro Scheduler 12.0.2 Script Editor to write a console app on Windows 7 x64.

While I have the script file opened in the Script Editor, I can "Save" changes, then "Create Exe" to compile and all is well.

However, if instead of using the Script Editor's "Create Exe" function, I run a command prompt to compile the script with the command:

Code: Select all

%PATH_TO_MS%\msrt.exe -COMPILE %SOURCE_FILE% %TARGET_FILE% -QUIET

msrt.exe crashes with:

Code: Select all

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	msrt.exe
  Application Version:	0.0.0.0
  Application Timestamp:	4c0cc57f
  Fault Module Name:	KERNELBASE.dll
  Fault Module Version:	6.1.7600.16385
  Fault Module Timestamp:	4a5bdbdf
  Exception Code:	0eedfade
  Exception Offset:	0000b727
  OS Version:	6.1.7600.2.0.0.256.1
  Locale ID:	1033
  Additional Information 1:	8909
  Additional Information 2:	8909162889776d0b4c0f7dc6c3d5fe32
  Additional Information 3:	0988
  Additional Information 4:	098873aaffe0ed2895e81993b7527378

and

Code: Select all

Exception EFOpenError in module msrt.exe at 0002FDC7.
Cannot open the file "(my path)test.scp".
The process cannot access the file because it is being used by another process.

Further investgation shows that no other process can read the opened script file:

Code: Select all

>type test.scp
The process cannot access the file because it is being used by another process.

If Script Editor is indeed locking the file preventing reads, it must be releasing it to compile when you invoke the compiler from its GUI.

This doesn't seem to happen with Macro Scheduler 11 that I can remember.

As to the reason behind my wish to compile externally, I just wanted to do the compile quietly. The Script Editor's "Create Exe" button required many mouse clicks for each of many many compiles. I would be thankful if there is away to make Script Editor's "Create Exe" happen with one click.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jun 14, 2010 9:14 am

This is designed functionality in v12. Since v12 scripts are locked exclusively when being edited. This is in order to facilitate safe collaboration/network sharing.

It was never envisaged that you would compile the script you are editing via the command line while it is open for editing. The designed functionality is that you would use the compile option in the editor.

But what you could do is export the script using File/Export and then compile that file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

KTT
Newbie
Posts: 13
Joined: Thu Jul 02, 2009 10:26 pm

Post by KTT » Mon Jun 14, 2010 8:44 pm

Thank you for the quick and informative response, Marcus.

I can understand the need to lock script files for data integrity in a networked/multi-user environment.

Is there any way you can reduce the scope of the lock? Perhaps a read lock, rather than an exclusive lock? Or if an exclusive lock is necessary for your implementation of collaborative work, allow the collaborative functionality to be selected in the Script Editor's preference; i.e. turn off collaboration to prevent exclusive locks on script files.

IMHO, it's unintuitive to have script files completely inaccessible while opened in the Script Editor. Allowing script files to be readable while opened in the Script Editor would open the editor to usage as a general language sensitive editor for Macro Scheduler scripts (at which it is unsurpassed), and not restrict it to being the only IDE solution allowed.

As a quick and dirty fix, is it possible to run the Macro Scheduler 11 Script Editor (to bypass exclusive locking for script files) in a Macro Scheduler 12 environment, or would this be asking for trouble?

KTT
Newbie
Posts: 13
Joined: Thu Jul 02, 2009 10:26 pm

Post by KTT » Tue Jun 15, 2010 12:03 pm

To effect an externally initiated compile with the file to be compiled opened in the Script Editor, I ended up create an Macro Scheduler file called qcompile.exe created from qcompile.exe as follows:

Code: Select all

// COMPILE_OPTS|C:\Users\Khoa\Desktop\InterfaceED Work\InterfaceED\qcompile.exe||CONSOLE=1|INCLUDES=1| /NOSYSTRAY /HIDE /LOGFILE=\dev\nul /NOSTOPKEY
// Quick Compile to EXE

Let>WIN_USEHANDLE=0
Let>WIN_REGEX=0
SetFocus>Editor*

Press>LCTRL
Press>F9
Release>LCTRL

Let>WIN_USEHANDLE=0
Let>WW_TIMEOUT=5
Let>WF_TYPE=3
WaitWindowOpen>Compile
Press>Enter

Let>WW_TIMEOUT=30
Let>WF_TYPE=3
WaitWindowOpen>Information
Press>Enter
Essentially, this script initiates a compile in the Script Editor and presses Enter a couple of times to dismiss messages. This works because no external read of the locked file is necessary.

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