Sign in to follow this  
Followers 0
Jon

JP's v2 to v3 converter

11 posts in this topic




I tried this out a bit, I guess my v2 code has a large over use of the goto commands.

Good points:

It converted \\ to \ in all my run statements.

most send statements came through perfectly.

Most simple function statements come through nicely.

Most of the example scripts seem to convert perfectly. ( although the v3 code isn't pretty)

Bad points:

goto and loops seem to be impossible to convert automatically. Even very simple ones don't fair well.

If you want examples, or code that bugs it, I would be happy to provide all you need, unfortunatly I have very little in the way of solutions.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Hello scriptkitty,

Thanks for your comments

can you comments more on the "( although the v3 code isn't pretty)"

is it related to the __err( ...) stuff?

If you want examples, or code that bugs it, I would be happy to provide all you need, unfortunatly I have very little in the way of solutions.

Just email me I will see if I can improve to 90% translation and definitly clerical bugs

to day I have already a 1.01 version correcting the following :

- Support "," in Send

- Fixed string starting with special variable

- Fixed WinMinimize with empty Text

WinMaximize

WinRestore

WinShow

WinHide

- Fixed SplashTextOff

Share this post


Link to post
Share on other sites

I took a portion of a V2 script that is quite complicated anyway and tried doing small bits as a test. It seems to do a good job with the following exceptions.

1) it does not handle MsgBox very well and I suspect it is a matter of not converting \n to @LF or better yet to @CRLF

2) what is with the Prologue and Epilogue in each instance?

Here is an example of what was returned for a message box section (it was poorly written in the origional anyway and needed re-writing).

*** INTERNAL ERROR Impossible to Translate : MsgBox,51,Process Incomplete,CAUTION !!!\nGEODisk has detected that there may be an incomplete installation or other process in progress.  It is recommended that you restart your computer in order that the process may complete and then rerun GEODisk.\n\nIf this message appears again after the restart, choose not to restart and continue with GEODisk.\nPressing "CANCEL" will stop GEODisk\n\nWould you like to restart your system?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I took a portion of a V2 script that is quite complicated anyway and tried doing small bits as a test.  It seems to do a good job with the following exceptions.

1) it does not handle MsgBox very well and I suspect it is a matter of not converting \n to @LF or better yet to @CRLF

2) what is with the Prologue and Epilogue in each instance?

Here is an example of what was returned for a message box section (it was poorly written in the origional anyway and needed re-writing).

1) it does not handle MsgBox very well and I suspect it is a matter of not converting \n to @LF or better yet to @CRLF

It is supposed to hancle \n correctly Please isolate the error or send me the script I will do my best to correct

2) what is with the Prologue and Epilogue in each instance?

That french word for showing you what is needed to make initialisation (Prologue) and the corresponding needed functions in (Epilogue)

]*** INTERNAL ERROR Impossible to Translate

In 1.0.1 version you get a correct handling of comma but still the following error

ERROR at line : 1

Too Many parameters : choose not to restart and continue with GEODisk.\nPressing "CANCEL" will stop GEODisk\n\nWould you like to restart your system?

I am investigating . Answer tomorrow I am going to bed

Thanks for your testing

Share this post


Link to post
Share on other sites

can you comments more on the "( although the v3 code isn't pretty)"

is it related to the __err( ...) stuff?

What is that code for? Is this some kind of error-handling which is necessary at any rate? I converted some of my (very simple) scripts and they run with and without that err-code-portion.

Share this post


Link to post
Share on other sites

What is that code for? Is this some kind of error-handling which is necessary at any rate? I converted some of my (very simple) scripts and they run with and without that err-code-portion.

Definitly the " __err(...)" stuff is designed to handke the change in AutoItv3 of setting the ERRORLEVEL/@ERROR

I can agree so I implement a /E option to avoid generation in 1.0.1

Thanks for your feedback.

1.0.1 should be available today with a almost perfect handling of string that terminate a V2 statement with comma inside as in "msgbox". I am still fighting with the same problem in "setenv".

Share this post


Link to post
Share on other sites

I like the new one a lot more. Also commenting the epilog sections looks much better.

Now if you can use an array for the %variables so that they change in scripts. (Dream?)

change %1% to $CmdLine[1]

change %COMSPEC% to @ComSpec or "& @ComSpec &" ???

I realise it isn't so simple, but many folks will have these in thier scripts.

example from AutoIt2 examples

MsgBox, 4, AutoIt Example, Uses \%COMSPEC\% to pipe text to a file.  Run?
IfMsgBox, NO, Goto, denied

Run, %COMSPEC% /C Echo Hello > C:\\Hello.txt

denied:
Exit

I was going to just PM ya again, but I just wanted to say nice job in public. :whistle:


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

I like the new one a lot more.  Also commenting the epilog sections looks much better.

Now if you can use an array for the %variables so that they change in scripts. (Dream?)

change %1% to $CmdLine[1]

change %COMSPEC% to @ComSpec  or "& @ComSpec &"  ???

I realise it isn't so simple, but many folks will have these in thier scripts.

example from AutoIt2 examples

MsgBox, 4, AutoIt Example, Uses \%COMSPEC\% to pipe text to a file.  Run?
IfMsgBox, NO, Goto, denied

Run, %COMSPEC% /C Echo Hello > C:\\Hello.txt

denied:
Exit

I was going to just PM ya again, but I just wanted to say nice job in public.  :whistle:

Thanks for your feedback.

BTW it was already corrected for 1.02 (not kitting B) )

both cmdline and comspec.

I am looking now to EnvGet("PROGRAMFILES") on variable which are in the Dos Environment. That will be optional suggested by /R for the second run if you do it

For the array I don't understand how I can do it?

Just put the Way you think I can generate

Share this post


Link to post
Share on other sites

As for the array, I was thinking you were using some sort of search and replace type action. I thought an array might be a good way to do it. Then you could just #include the array in the final.

The array would keep count of its members, and every odd element is a change, and the following even is its replacement.

Anyway just an idea, I don't know how you are making all the changes.

;replace array
$replacement="%1%,$CmdLine[1],%COMSPEC%,@ComSpec"
$replacearray=StringSplit( $replacement, "," ) 
msgbox(1,$replacearray[0],$replacearray[1]& " changes to "& $replacearray[2]& @crlf & $replacearray[3]& " changes to "& $replacearray[4]); just to show idea

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

As for the array, I was thinking you were using some sort of search and replace type action. I thought an array might be a good way to do it.  Then you could just #include the array in the final.

The array would keep count of its members, and every odd element is a change, and the following even is its replacement.

Anyway just an idea, I don't know how you are making all the changes.

;replace array
$replacement="%1%,$CmdLine[1],%COMSPEC%,@ComSpec"
$replacearray=StringSplit( $replacement, "," ) 
msgbox(1,$replacearray[0],$replacearray[1]& " changes to "& $replacearray[2]& @crlf & $replacearray[3]& " changes to "& $replacearray[4]); just to show idea
Thanks I will think about

BTW I found out a new bug in 1.01 suppression of blanks that follow variables

so

%comspec% /c ...

will generate

@comspec & "/c ..."

notice no blank before /c

What a pity. But solved for 1.02

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0