*UPDATED 3/1/19* Layer Shortcuts tool

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Thanks for the info. It's helpful to hear you're not seeing this issue on your computer. Knowing that Layer Shortcuts should work fine with Moho 13 narrows the source of the problem.

Re: Permissions for Moho 13, I'm not too surprised if that's it because I'm actually still running the last Moho 13 beta. I should remove this version and perform a clean install of the final release. Will let you know if that clears the problem for Layer Shortcuts.

I'll send you the 'problem' file if I'm still seeing a problem after the clean install.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Darn it, that wasn't it. I completely removed 13 and installed the latest, and when I click the Layer Shortcuts button the first time, the error still pops up. Then the error continues to pop up almost anytime I click a layer.

Tried a few different installation configurations but still getting the error with 13. Not seeing this error with 12.5 though.

It's late, going to turn in. May look further into this tomorrow if I have the time. When I get a chance, I'll also try it on another computer.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

A quick survey: Is anybody else seeing the error I described when using Layer Shortcuts in Moho 13? I'm trying to determine if this is a new Moho 13 issue (since it doesn't happen in 12.5) or if it's something wrong in my laptop. Thanks in advance for any helpful info.
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by hayasidist »

yeah - 64bit win 10 version 2.6 of the tool ..

in 13.0 (build 544) line 527 index error on pFile (nil value)

12.5 (build 22438) line 544 index error on 'file' (nil value)

===
update:

12.5 diagnostics:

2 issues I think (and apologies in advance if this ain't the case!)

scope of the variable "path" -- changing the name of local variable path to be Lpath gets past the first problem.

then the scan of the user settings file finds the "KeyBindingsFileName" tag, but the value is a zero length string - so the io.open using the global self.path (line 542) fails - it's just the directory without a bindings file name - and so the attempt to loop through the lines fails (lua line 544) because there's no open file (i.e. local file is nil because io.open(self.path) didn't have a filename)

hope that helps!
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Whoops, I must have posted the wrong screen cap since I posted a screen cap with 'line 544 index error on 'file' (nil value)' cited. Curiously, I must have briefly gotten the error in 12.5 but I'm not seeing the error with 12.5 now, only in 13. Anyway, thanks for looking into this Paul.

[Text deleted. Obsolete info.]
Last edited by Greenlaw on Sun Jul 21, 2019 7:46 am, edited 1 time in total.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

hayasidist wrote: Sat Jul 20, 2019 6:11 pm yeah - 64bit win 10 version 2.6 of the tool ..

in 13.0 (build 544) line 527 index error on pFile (nil value)

12.5 (build 22438) line 544 index error on 'file' (nil value)
The v12.5 error happens because v13 tries to update your shortcuts file and appends "_Obsolete.txt" to its file name...which my script isn't expecting. So when it tries to open the file Moho says it's still using for shortcuts, there is no longer a .json file with that name.

The v13 error happens because you don't have a custom keyboard shortcuts file chosen, and there's no default file to reference. I guess most people who tried this with v12 already had custom shortcuts setup, so that's some error checking I could add when I find the time.
===
update:

12.5 diagnostics:

2 issues I think (and apologies in advance if this ain't the case!)

scope of the variable "path" -- changing the name of local variable path to be Lpath gets past the first problem.

then the scan of the user settings file finds the "KeyBindingsFileName" tag, but the value is a zero length string - so the io.open using the global self.path (line 542) fails - it's just the directory without a bindings file name - and so the attempt to loop through the lines fails (lua line 544) because there's no open file (i.e. local file is nil because io.open(self.path) didn't have a filename)

hope that helps!
No, path and self.path already separate the scopes. The problem is that the "binding" file that Moho reports to the script has had its file name changed.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

The problem with fixing this is that it won't really get around bugging the user. It either needs to user to fix their shortcuts "updated" by v13 or remind them that keyboard shortcuts for this tool won't work with default shortcuts. I could have it do this only once per session, but then some users, who keep Moho running a long time, might forget and think there's a bug.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

The easiest fix is to have v12 and v13 use different custom content folders. Next easiest is to make sure v13 does not update any v12 shortcuts and create a new custom shortcuts file for v13.

If you've already updated old shortcuts, you'll need to manually remove the "_Obsolete.txt" from the v12 file name.



If you're still have errors after that, I need to see a screenshot of your Keyboard Shortcuts folder and need to know the "Version" (at the top of the file when opened in a text editor) of all the shortcuts you are using in v12 and v13.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Thanks for your help Wes!

I imagine others will stumble into this issue after switching to Moho 13 so I'll update the video with the additional info as soon as I can.

For anybody just joining us, here are some troubleshooting tips for using Layer Shortcuts in Moho 13 (some of which may also apply to Moho 12):

1. Don't use the same Custom Content Folder for 13 that you used for 12.

2. Layer Shortcuts can't work with Moho the Default settings selected so, before using Layer Shortcuts, make sure you have selected a custom keyboard shortcuts setting in Edit Keyboard Shortcuts. If you wish to use Moho's default keyboard shortcuts, Click New to create a duplicate of the default settings and select the duplicate. (You can name this duplicate whatever you want.)

3. After upgrading from Moho 12, when you select an existing keyboard shortcuts setting in Moho 13, the program may ask you to Update the file. When you do this, Moho will create a copy of the keyboard shortcut settings with '_obsolete.txt' appended to its name. Layer Shortcuts cannot work properly when the '_Obsolete.txt' file is present so you need to delete it. If it exists, you'll find the file in the Keyboard Shortcuts folder in your Custom Content Folder (File > Open Custom Content Folder).
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

Greenlaw wrote: Sun Jul 21, 2019 7:39 am 1. Don't use the same Custom Content Folder for 13 that you used for 12.
Not absolutely necessary, as users may not want to duplicate their entire custom content folder to run multiple versions of Moho, and have to install scripts/update libraries in each separately. That's the easiest way to avoid v13 upgrade issues with this script, but not the most practical.
2. Before using Layer Shortcuts, make sure you have selected a custom shortcuts setting in Edit Keyboard Shortcuts. If you wish to use Moho's default keyboard settings, Click New to create a duplicate of the default settings and select that.
Good tip.
3. After upgrading from Moho 12, when you select an existing keyboard shortcuts setting in Moho 13, it may ask you to update the file. When you do this, Moho will create a copy of the settings with '_obsolete.txt' appended to it's name. Layer Shortcuts cannot work properly when this file is present so you need to delete it.
I don't think it makes a copy, as the script would still be able to find the original if it did. I think it just renames the existing file, so you may not want to just delete it.

Personally, I name my shortcut files by version, and maybe task as well, like "12.5" or "12.5 testing". So if I were installing v13 for the first time, I'd probably do this:
1. Open v13 and tell it not to update my shortcuts (use the defaults) if it asks.
2. Create a new keyboard shortcuts for v13, even if only a copy of the defaults.
3. Make sure I never select/update v12 shortcuts in v13 or vice versa.


When I have time, I'll see if I can make this script's transition to a new version of Moho any less painful.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Thanks for the additional info! That's good to know. Here's a little more:

Re: using an existing custom keyboard shortcuts setting, here's what happened on my laptop after re-installing Moho 13 to the default location.

I have a custom keyboard shortcut setting in my Custom Content folder called 'MQC13'. When I select it, Moho 13 asks me to Update these settings.

Image

If I choose Cancel, Moho doesn't update the settings file but this also means the custom shortcuts is not selected.

If I choose Update, Moho updates the settings and it then selects the updated settings. At this time, an 'MQC13.json_Obsolete.txt' file appears in addition to the original 'MQC13.json' file.

Image

Judging from the file dates, I guess Moho is creating a new MQC13 file and renaming the old one but the result is the same. The copy called 'MQC13.json_Obsolete.txt' is the one I delete.

BTW, the updated version of my MQC13 settings works as intended. This is probably because the file had already been edited for Moho 13 compatibility before I let Moho update it.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

Greenlaw wrote: Sun Jul 21, 2019 9:08 am Judging from the file dates, I guess Moho is creating a new MQC13 file and renaming the old one but the result is the same. The copy called 'MQC13.json_Obsolete.txt' is the one I delete.

BTW, the updated version of my MQC13 settings works as intended. This is probably because the file had already been edited for Moho 13 compatibility before I let Moho update it.
From what I remember installing v13, if you update a shortcut (that hasn't already been edited in v13), the duplicate is just the default shortcuts. I think.
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by hayasidist »

couple of extra pieces of information that might be relevant here.

as a matter of course I keep the user directories separate for versions and beta; I haven't used custom shortcuts.

the settings file for beta versions seems to be e.g. "Moho Pro13 beta.user.settings" - so if Dennis is on build 544 that might explain the pFile error at 527
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

hayasidist wrote: Sun Jul 21, 2019 10:14 am the settings file for beta versions seems to be e.g. "Moho Pro13 beta.user.settings" - so if Dennis is on build 544 that might explain the pFile error at 527
Good catch, Paul! While I do share my custom content folder for different versions, I always have a separate one for beta builds...because I might be using modded LM tools when I should be using stock tools for beta testing.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Ah, thanks! That explains the changing error messages since this started happening. One more thing that was throwing me off.

My setup is probably closer now to a 'normal' user setup and I think I'll keep it that way. :)
Last edited by Greenlaw on Tue Jul 23, 2019 7:17 pm, edited 1 time in total.
Post Reply