Zeus IDE Forum Index Zeus IDE
Use this forum to ask for help, submit a bug report or make a suggestion.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Macro-Recording Error

 
Post new topic   Reply to topic    Zeus IDE Forum Index -> Reporting a Bug
View previous topic :: View next topic  
Author Message
amix



Joined: 22 Aug 2007
Posts: 49

PostPosted: Wed Oct 03, 2007 12:55 am    Post subject: Macro-Recording Error Reply with quote

The macro I am trying to record creates following line:
Code:
<include name="XYZ/**" id="XYZ" />
from XYZ, which is the first and only word in the row.

Code:
Scripting Error :>  File: E:\zfw\zScript\Macro0.js (5:23) >>    zeus.MoveDocumentEndEx
Reason: '}' erwartet

Error parsing 'E:\zfw\zScript\Macro0.js' macro script.Macro script generated '2' Debug, Error and/or Warning message(s).


My default scripting-engine is JScript. If I do it with LUA as default it works flawlessly.
Back to top
View user's profile Send private message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Wed Oct 03, 2007 2:05 am    Post subject: Reply with quote

Hi Amix,

Can you post the macro script that creates this error message Question

When I record a macro to create this text it works fine for me Confused

Here is the macro I recorded:
Code:
function key_macro()
{
    zeus.screen_update_disable
    zeus.write("<include name=\"XYZ/**\" id=\"XYZ\" />\n")
    zeus.screen_update_enable
    zeus.screen_update
}

key_macro()   // run the macro

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
amix



Joined: 22 Aug 2007
Posts: 49

PostPosted: Wed Oct 03, 2007 2:43 am    Post subject: Reply with quote

This is yesterday's macro (the one I reported):

Code:
function key_macro()
{
   zeus.screen_update_disable
   zeus.write("<include name=\"")
   zeus.MoveDocumentEndEx   
   zeus.write("/**\"")
   zeus.MarkBlockSet   
   zeus.MoveWordPrevious   
   zeus.MoveWordPrevious   
   zeus.MoveWordNext   
   zeus.MoveWordNext   
   zeus.MarkBlockReset   
   zeus.none   
   zeus.MarkBlockSet   
   zeus.MoveWordNext   
   zeus.MarkBlockReset   
   zeus.MarkCopyEx   
   zeus.MoveDocumentEndEx   
   zeus.write(" id=\"")
   zeus.MarkPasteEx   
   zeus.BackspaceSmart   
   zeus.write("\" />")
   zeus.MoveLineDown   
   zeus.MoveLineHome   
   zeus.screen_update_enable
   zeus.screen_update
}

key_macro()   // run the macro


It has some more stuff (blurb) in it, since I did a mistake while recording but did not want to re-record.

I then re-recorded it with Lua set as default (and being a bit more intelligent about what I typed). This is it:
Code:
function key_macro()
    screen_update_disable()
    print("<include name=\"")
    MarkBlockSet()
    MoveWordNext()
    MarkBlockReset()
    MarkCopyEx()
    print("\"")
    MoveLineLeftEx()
    print("/**")
    MoveDocumentEndEx()
    print(" id=\"")
    MarkPasteEx()
    print("\" />")
    MoveLineDown()
    MoveLineHome()
    screen_update_enable()
    screen_update()
end

key_macro() -- run the macro


This one worked.

P.S. The JScript file seems to have some binary data in it (but one can easily chose view-as-text-only without garbage in TotalCommander's Viewer.exe)
Back to top
View user's profile Send private message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Thu Oct 04, 2007 12:22 am    Post subject: Reply with quote

That is very interesting. The macro contains the following Zeus function which is causing the problem:
Code:
zeus.none

I have never seen that before and I'm not even sure how you managed to record it Question

I suspect it was caused by using the mouse while recording the macro Confused

For example using the close document cross (i.e top right corner) while recording a macro will cause a similar sort of macro scripting error.

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
amix



Joined: 22 Aug 2007
Posts: 49

PostPosted: Sat Oct 13, 2007 5:22 pm    Post subject: Reply with quote

It just happened again:

Code:
function key_macro()
{
   zeus.screen_update_disable
   zeus.MoveWordNextEx   
   zeus.MoveLineLeftEx   
   zeus.MarkBlockSet   
   zeus.MoveWordNext   
   zeus.MoveWordNext   
   zeus.MarkBlockReset   
   zeus.MarkDeleteEx   
   zeus.write("var ")
   zeus.MoveWordNextEx   
   zeus.write("= ")
   zeus.MoveDocumentEndEx   
   zeus.write(";")
   zeus.MoveLineDown   
   zeus.MoveLineHome   
   zeus.screen_update_enable
   zeus.screen_update
}

key_macro()   // run the macro


It seems it happens each time I record a macro using the jscript scripting engine as default.

Code:
---------------------------------------------------------------------------
     Zeus for Windows Programmers Editor - Version 3.96j
     Copyright (c) Xidicone P/L 1993-2007.  All rights reserved.
---------------------------------------------------------------------------

Scripting Error :>  File: E:\zfw\zScript\Macro0.js (4:20) >>    zeus.MoveWordNextEx
Reason: '}' erwartet

Error parsing 'E:\zfw\zScript\Macro0.js' macro script.Macro script generated '2' Debug, Error and/or Warning message(s).


"erwartet" is german for "expected".

But I see no 'zeus.none' this time. Of course, this is no hassle, since I can easily switch on the LUA interpreter. I just thought you may be interesting in this.
Back to top
View user's profile Send private message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Sun Oct 14, 2007 11:38 pm    Post subject: Reply with quote

This is very strange. The macro looks just fine.

Quote:
Of course, this is no hassle, since I can easily switch on the LUA interpreter.

Did this happen after running Zeus constantly for a long while Question

My hunch is this is some sort of memory leak Confused

I did a search of the Web and did come across a few reports suggesting the WSH JScript does leak memory.

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
amix



Joined: 22 Aug 2007
Posts: 49

PostPosted: Mon Oct 15, 2007 4:01 pm    Post subject: Reply with quote

jussij wrote:
Did this happen after running Zeus constantly for a long while Question


Could be Wink
However, it happens each time I use it, so also after rebooting the machine, starting Zeus anew.
Quote:
I did a search of the Web and did come across a few reports suggesting the WSH JScript does leak memory.

At least it is well known to do so in IExplorer. So this may well be true.
Back to top
View user's profile Send private message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Mon Oct 15, 2007 11:33 pm    Post subject: Reply with quote

I can't be sure but I have a hunch this bug might be related to the mysterious abort bug Confused

http://www.zeusedit.com/forum/viewtopic.php?t=1230

The abort bug definitely caused by some sort of corruption in the memory manager and I'm hoping to have a fix for this shortly.

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Fri Oct 19, 2007 1:19 am    Post subject: Reply with quote

This bug may/may not have been fixed in the latest Zeus patch Confused

So any users experiencing this error should first make sure they are running Zeus Version 3.9k or higher which is found here:

http://www.zeusedit.com/forum/viewtopic.php?t=1274

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
amix



Joined: 22 Aug 2007
Posts: 49

PostPosted: Fri Oct 19, 2007 2:47 am    Post subject: Reply with quote

Code:
---------------------------------------------------------------------------
     Zeus for Windows Programmers Editor - Version 3.96k
     Copyright (c) Xidicone P/L 1993-2007.  All rights reserved.
---------------------------------------------------------------------------

Scripting Error :>  File: E:\zfw\zScript\Macro0.js (4:20) >>    zeus.MoveWordNextEx
Reason: '}' erwartet

Error parsing 'E:\zfw\zScript\Macro0.js' macro script.Macro script generated '2' Debug, Error and/or Warning message(s).


Code:
function key_macro()
{
   zeus.screen_update_disable
   zeus.MoveWordNextEx   
   zeus.MarkBlockSet   
   zeus.MoveWordPrevious   
   zeus.MoveWordPrevious   
   zeus.MarkBlockReset   
   zeus.MarkDeleteEx   
   zeus.MoveDocumentEndEx   
   zeus.MoveLineDown   
   zeus.MoveLineHome   
   zeus.screen_update_enable
   zeus.screen_update
}

key_macro()   // run the macro


Sorry to disapoint you , still there.

But...

I added ; at each line of the 'Macro0.js'. Then I saved the macro under a different name, loaded it and it worked!

First I had set back the engine to LUA, but I rechecked with the default scripting engine set to JS. In both cases it worked. JS does not require the ; at every place, but maybe you should try to add it ? I also noticed, that there is blanks behind each line, may be, that some invisible binary data got into the way (remember, last time I tried loading the 'Macro0.js' with my file-viewer, I got the hex-display due to binary chars), which got removed by my manual edit now, when I added the semicolon. Not sure, but maybe this helps ?

Code:
function key_macro()
{
   zeus.screen_update_disable;
   zeus.MoveWordNextEx;
   zeus.MarkBlockSet;
   zeus.MoveWordPrevious;
   zeus.MoveWordPrevious;
   zeus.MarkBlockReset;
   zeus.MarkDeleteEx;
   zeus.MoveDocumentEndEx;
   zeus.MoveLineDown;
   zeus.MoveLineHome;
   zeus.screen_update_enable;
   zeus.screen_update;
}

key_macro();   // run the macro
Back to top
View user's profile Send private message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Fri Oct 19, 2007 3:37 am    Post subject: Reply with quote

I'm a bit confused Confused

If I take you broken macro code:
Code:
function key_macro()
{
   zeus.screen_update_disable
   zeus.MoveWordNextEx   
   zeus.MarkBlockSet   
   zeus.MoveWordPrevious   
   zeus.MoveWordPrevious   
   zeus.MarkBlockReset   
   zeus.MarkDeleteEx   
   zeus.MoveDocumentEndEx   
   zeus.MoveLineDown   
   zeus.MoveLineHome   
   zeus.screen_update_enable
   zeus.screen_update
}

key_macro()   // run the macro
and save it to a c:\temp\test.js and the run it via the Macros, Execute Script menu I don't get any errors reported and the macro runs fine Question

If you do the same do you get the error message Question

If you do then that should be easy enough to fix, since it just means Zeus is writing JScript that is not syntactically valid (i.e. getting Zeus to add in these semi colons is very easy todo).

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
amix



Joined: 22 Aug 2007
Posts: 49

PostPosted: Fri Oct 19, 2007 10:32 am    Post subject: Reply with quote

Okay, I have played around a little. Here are the steps to reproduce:
    Set default scripting engine to jscript.
    Create new text-file, paste some text into it.
    Record a macro.
    Run it via F8. <- Boom! Macro breaks.
The last macro I recorded, which definitley breaks on my system is attached. I have zipped it. That means, it should be preserved as it is on my filesystem. The interesting thing (and the reason I zipped it), is, that it seems to contain binary-characters. It think so, because when I open it with the viewer utility of my file-manager it gets displayed in the hex-mode. That was the case the last time, too. It is not, however, the case with LUA macros (and those don't break). Since I am just a scripting, and you are a (very dynamic) hardcode guy (aka binary wizard), I hope you know how to discover it. Very Happy I only believe what I see, lol. Wink

P.S. Can't attach files to the forum so I'll send it as email.
P.P.S. We're going to get that little bastard and slap it into its face!
Back to top
View user's profile Send private message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Sat Oct 20, 2007 12:44 am    Post subject: Reply with quote

Hi amix,

You where spot on about the binary data Wink

Due to a small bug in the Zeus WSH scripting engine code, macros where getting recorded with unwanted binary information.

Luckily it should be easy enough to fix. I'll have a fix for this shortly Smile

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2161

PostPosted: Sat Oct 20, 2007 3:04 am    Post subject: Reply with quote

This bug should now be fixed Smile

I have updated the lastest Zeus patch with this fix. To fix this bug just re-apply the patch from this link:

http://www.zeusedit.com/forum/viewtopic.php?t=1274

NOTE: The version of Zeus shown in the about dialog should read: 3.96ka

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
amix



Joined: 22 Aug 2007
Posts: 49

PostPosted: Sun Oct 21, 2007 8:42 pm    Post subject: Reply with quote

Right on ! Smile

Installed 3.96ka and now it works. Congrats!

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Zeus IDE Forum Index -> Reporting a Bug All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group