v1 -> v2 Script Converter

Post your working scripts, libraries and tools.
User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 09 Apr 2024, 09:36

I see that this project is being updated several times a week on github, most recent in last 12 hours.

Just fyi... It looks like it will take some time for me to learn the process for submitting changes, etc on Github. So it will be awhile before the changes I have made make it to that site. I started reading about the process, but may need to watch a couple videos to speed up the learning curve.

You mentioned creating a fork. Do the changes made to forks ever make their way back to the main project, or is a fork intended to be a separate project that is disconnected from the original? If they are meant to remain isolated, it seems (to me) counter-productive to the overall goal of multiple contributors working towards improving the original. Or am I misunderstanding something? I just checked and it appears that there are currently more than 30 forks from this project.

I'm sure the answer to this type of question will become more clear as I learn the process further.

guest3456
Posts: 3477
Joined: 09 Oct 2013, 10:31

Re: v1 -> v2 Script Converter

Post by guest3456 » 09 Apr 2024, 11:30

andymbody wrote:
09 Apr 2024, 09:36
I see that this project is being updated several times a week on github, most recent in last 12 hours.

Just fyi... It looks like it will take some time for me to learn the process for submitting changes, etc on Github. So it will be awhile before the changes I have made make it to that site. I started reading about the process, but may need to watch a couple videos to speed up the learning curve.

You mentioned creating a fork. Do the changes made to forks ever make their way back to the main project, or is a fork intended to be a separate project that is disconnected from the original? If they are meant to remain isolated, it seems (to me) counter-productive to the overall goal of multiple contributors working towards improving the original. Or am I misunderstanding something? I just checked and it appears that there are currently more than 30 forks from this project.

I'm sure the answer to this type of question will become more clear as I learn the process further.
forks are cheap and easy. anyone can create a fork simply as a backup and then the whole repository gets mirrored into their account.

the collaboration process usually looks like this:

1. fork the project into your own account.
2. keep the 'master' branch of your fork clean, so that you can pull in updates from the main repository as they happen
3. branch off your master branch in your fork to make your proposed changes. this keeps your changes isolated into a branch and doesnt mess up your master branch which should always try to mirror the main repo
4. when your feature is ready, create a Pull Request into the main repo, requesting to pull in the changes from your feature branch from your repo
5. maintainers of the main repo will review your changes and merge them in if they are acceptable


User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 09 Apr 2024, 11:38

guest3456 wrote:
09 Apr 2024, 11:30
the collaboration process usually looks like this:
Thank you! This birds-eye view is helpful to get my education started. I will look into these details.

User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 10 Apr 2024, 01:00

Making progress getting on board with Github... sent a fake/test pull-request. I was not able to delete it, and the tutorials show that this can only be done using the command line interface, which I do not have yet.

I have made a lot of changes/corrections for ConvertFuncs.ahk with more to come. The thing is, some of the changes involve new functions that have been added to support larger changes yet to come, which (IMO) require more than band-aid code. I'm not sure whether these changes will be welcome in the project or not, because some involve a redesign of the current workflow. The main loop works for many things, but restricts other things. I guess I will submit the changes and see whether they are welcome within this project or not.

I will need to go back to the master branch and start again with the changes so that each can be submitted independently (as requested). I'm unsure whether I will need to wait for each pull-request to be approved before submitting another. But some changes build upon each other. Submitting each change as a separate pull-request will be tedious, but I understand the need for this process. I'm still trying to understand branches and wonder if each change requires a new branch or not.

Please let me know whether I will need to wait for approval of one pull-request before submitting another. And any other thoughts you may have.

Thanks!
Andy

User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 10 Apr 2024, 10:22

Submitted my first real pull request. It might have affected the Unicode characters by mistake within ConvertFuncs.ahk. Let me know whether I need to fix this. Also the new global variable may need to be added to other .ahk files, like v2converter.ahk.

guest3456
Posts: 3477
Joined: 09 Oct 2013, 10:31

Re: v1 -> v2 Script Converter

Post by guest3456 » 10 Apr 2024, 17:48

andymbody wrote:
10 Apr 2024, 01:00
Making progress getting on board with Github... sent a fake/test pull-request. I was not able to delete it, and the tutorials show that this can only be done using the command line interface, which I do not have yet.

I have made a lot of changes/corrections for ConvertFuncs.ahk with more to come. The thing is, some of the changes involve new functions that have been added to support larger changes yet to come, which (IMO) require more than band-aid code. I'm not sure whether these changes will be welcome in the project or not, because some involve a redesign of the current workflow. The main loop works for many things, but restricts other things. I guess I will submit the changes and see whether they are welcome within this project or not.

I will need to go back to the master branch and start again with the changes so that each can be submitted independently (as requested). I'm unsure whether I will need to wait for each pull-request to be approved before submitting another. But some changes build upon each other. Submitting each change as a separate pull-request will be tedious, but I understand the need for this process. I'm still trying to understand branches and wonder if each change requires a new branch or not.

Please let me know whether I will need to wait for approval of one pull-request before submitting another. And any other thoughts you may have.

Thanks!
Andy
you do not need to wait for approval of one PR before submitting another. you can submit as many as you want simultaneously. given this, it is imperative to keep each feature in a separate branch, so that each individual PR is clean. if different PRs build on top of each other, you should note that in the PR comments that that specific PR depends upon another.

it is certainly tedious if you've never used git before, to keep your repository clean and remember to branch off for different features, and also to even keep your individual commits small and contained. as you learn more about git from reading and watching videos, you will see many people stress the importance of this. as a beginner to git you will find yourself spending more time editing your code and organizing your repository commit wise and branch wise. as you get more familiar with the process, you will just think differently from the start, and end up writing the initial code in a more compact way, and committing the changes more often and frequently, to preempt all the manual editing later. you can (and should) always edit your history locally before pushing any changes publicly. you can do this with tools like git rebase which is a command line tool allowing you to go back in commit history and revise commits and edit changes and drop changes. branches are cheap and easy to create and delete so you should get familiar with that process as you will be doing that constantly.

right now all of this will seem meaningless but as you get more experienced with collaborative development you will see the benefit. even if you started using git for your own personal project you will see the benefit of having a clean history when you need to go back and see how/why you made a change and/or why something might have broken. learning git is an investment but very worthwhile for any serious developer. you can browse the commit history of our project to see how each commit is usually a single defined change, with associated test files updated. or if its a refactor sometimes the commit is larger but thats not usually recommended. you can browse other proejcts to see how the commits try to stay small and clean as much as possible. and then PRs are simply a group of small commits (sometimes even just one commit) that create a logical new feature of bug fix etc


User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 10 Apr 2024, 19:15

guest3456 wrote:
10 Apr 2024, 17:48
Thank you very much for taking the time to explain some of this to me. It's very helpful with this new journey. I will get more familiar with this over time, of course, but right now it completely new. I have no other comparable workflows to draw similar knowledge/experience from.

Thank you!

kiwichick
Posts: 189
Joined: 21 Jan 2014, 22:03

Re: v1 -> v2 Script Converter

Post by kiwichick » 02 Jun 2024, 20:55

I find this to be such a handy tool even if how successful it is, is a little bit hit and miss. Maybe it's the way I'm using them but these don't get converted correctly:

1) This in v1:

Code: Select all

Menu, Tray, Icon, path-to-icon\icon.ico
gets converted to this:

Code: Select all

Tray.SetIcon("path-to-icon\icon.ico")
but only works when used like this:

Code: Select all

TraySetIcon("path-to-icon\icon.ico")
2) This in v1:

Code: Select all

Menu, Tray, Tip, tool tip goes here
gets converted to this:

Code: Select all

Tray.Tip("tool tip goes here")
but only works when used like this:

Code: Select all

A_IconTip := "tool tip goes here"

guest3456
Posts: 3477
Joined: 09 Oct 2013, 10:31

Re: v1 -> v2 Script Converter

Post by guest3456 » 02 Jun 2024, 21:54

kiwichick wrote:
02 Jun 2024, 20:55
these don't get converted correctly:
thank you, you can track progress here:
https://github.com/mmikeww/AHK-v2-script-converter/issues/179


Banaanae
Posts: 34
Joined: 19 Feb 2024, 04:08
Contact:

Re: v1 -> v2 Script Converter

Post by Banaanae » 03 Jun 2024, 05:43

kiwichick wrote:
02 Jun 2024, 20:55
I find this to be such a handy tool even if how successful it is, is a little bit hit and miss. Maybe it's the way I'm using them but these don't get converted correctly:

1) This in v1:

Code: Select all

Menu, Tray, Icon, path-to-icon\icon.ico
gets converted to this:

Code: Select all

Tray.SetIcon("path-to-icon\icon.ico")
but only works when used like this:

Code: Select all

TraySetIcon("path-to-icon\icon.ico")
2) This in v1:

Code: Select all

Menu, Tray, Tip, tool tip goes here
gets converted to this:

Code: Select all

Tray.Tip("tool tip goes here")
but only works when used like this:

Code: Select all

A_IconTip := "tool tip goes here"
This code is converted correctly (as singular lines), but I am aware of it not converting under some conditions (which I'm yet to figure out). Could you send your script? Either here or on the issue tracker

User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 03 Jun 2024, 05:55

For those who may need v2 support for MinIndex() and MaxIndex() after conversion. Check here. (Link removed and will be updated when available again).
Last edited by andymbody on 11 Jun 2024, 00:23, edited 1 time in total.

kiwichick
Posts: 189
Joined: 21 Jan 2014, 22:03

Re: v1 -> v2 Script Converter

Post by kiwichick » 04 Jun 2024, 21:38

Banaanae wrote:
03 Jun 2024, 05:43
Could you send your script? Either here or on the issue tracker
I sure can but which version of it do you want? The original v1 script?

User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 05 Jun 2024, 05:31

kiwichick wrote:
04 Jun 2024, 21:38
I sure can but which version of it do you want? The original v1 script?
I think v1, so it can be inspected and used to test

kiwichick
Posts: 189
Joined: 21 Jan 2014, 22:03

Re: v1 -> v2 Script Converter

Post by kiwichick » 05 Jun 2024, 05:50

andymbody wrote:
05 Jun 2024, 05:31
I think v1, so it can be inspected and used to test
Here's a link to the v1 script. It's part of a group of scripts but if it's only the conversion you need to check, then you probably don't need the other scripts but I'm happy to provide those, too, if you'd like them.

https://mega.nz/file/qEk3AIzY#qkWLs-meXq6YWVdhoQJv_CiAdgCdWjufaNZdIGMPnms

@Banaanae

User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 07 Jun 2024, 06:05

kiwichick wrote:
05 Jun 2024, 05:50
Here's a link to the v1 script.
This is what I see... (regarding the Icon)

The script you posted shows this on line 25 (example line)
Menu, Tray, Icon, %A_ScriptDir%\WallpaperLauncher\screen.ico ;Add tray icon

The v1 documentation show this as the command required
Menu, MenuName, Icon, MenuItemName, FileName , IconNumber, IconWidth

Notice that your code has a FileName/path where MenuItemName should be.

So... MenuItemName is pulling the path since that is what is found in that position. And MenuItemName is missing in your code.

So, this does not seem to be a conversion issue, but instead a problem with the source code itself. I suspect that v1 is silently ignoring this line since it is not formatted correctly (but does not produce any error, as is common with v1). I have not (yet) run the v1 version to see what happens.



I have not looked at the tooltip yet, but I do see some errors that the converter made regarding placement of braces. I will try to look at the rest of your inquiry later... have to get to work now...

Andy

just me
Posts: 9763
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: v1 -> v2 Script Converter

Post by just me » 07 Jun 2024, 06:51

v1: Setting the tray icon
Menu, Tray, Icon [, FileName, IconNumber, Freeze]
It must actually be converted to TraySetIcon(...).

User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 07 Jun 2024, 07:03

just me wrote:
07 Jun 2024, 06:51
v1: Setting the tray icon
Menu, Tray, Icon [, FileName, IconNumber, Freeze]
It must actually be converted to TraySetIcon(...).
Ok... my mistake...

@kiwichick... Submitted a proposed fix for both issues (to github)... will need to be approved by @Banaanae

The braces issue:
The closing brace is not being applied to the converted Reload label (function) correctly because there is no 'return' after the Reload command in the original v1 script and currently the script does not look for Reload to trigger a closing brace. I will submit a fix for this separately.

Update: The menu commands have been fixed and are live in the latest update on GitHub. Please test. The braces fix has been submitted for approval, and will probably go live soon. Might want to wait for that before testing.

kiwichick
Posts: 189
Joined: 21 Jan 2014, 22:03

Re: v1 -> v2 Script Converter

Post by kiwichick » 08 Jun 2024, 21:13

andymbody wrote:
07 Jun 2024, 07:03
@kiwichick... Submitted a proposed fix for both issues (to github)... will need to be approved by @Banaanae
Thanks, partial success. It has converted the tray menu icon correctly but now it also converts the menu item icons to the same code which is doesn't seem to be correct.

In my v1 script, line 25:

Code: Select all

Menu, Tray, Icon, %A_ScriptDir%\WallpaperLauncher\screen.ico   ;Add tray icon
Is converted correctly to this:

Code: Select all

TraySetIcon(A_ScriptDir . "\WallpaperLauncher\screen.ico")
However, the code on lines 30, 34 and 38 have been converted the same as above but should be converted to:

Code: Select all

myTrayMenu.SetIcon("Change Wallpaper", A_ScriptDir . "\WallpaperLauncher\screen.ico")
Is the converter having trouble distinguishing between tray icon and menu item icon?

User avatar
andymbody
Posts: 1034
Joined: 02 Jul 2017, 23:47

Re: v1 -> v2 Script Converter

Post by andymbody » 08 Jun 2024, 22:07

kiwichick wrote:
08 Jun 2024, 21:13
Is the converter having trouble distinguishing between tray icon and menu item icon?
Thank you for testing...

yes, it is currently having a little trouble. I made an adjustment that looks like it fixed this recent find. I have submitted the fix, but it has to be approved by the admin. Please check back to see when it is applied. Once it goes live, please test again.

kiwichick
Posts: 189
Joined: 21 Jan 2014, 22:03

Re: v1 -> v2 Script Converter

Post by kiwichick » 09 Jun 2024, 18:04

andymbody wrote:
08 Jun 2024, 22:07
Thank you for testing...
You're welcome. I don't know if it's how my v1 codes are written but I've rarely had a script convert correctly. There are pretty much always errors and generally the same ones. This is such a handy tool so, hopefully, the errors will get sorted in the future.
yes, it is currently having a little trouble. I made an adjustment that looks like it fixed this recent find. I have submitted the fix, but it has to be approved by the admin. Please check back to see when it is applied. Once it goes live, please test again.
Thanks, I'll keep an eye on it.

Post Reply

Return to “Scripts and Functions (v2)”