Page 1 of 2

[SOLVED] Mblock Setup.py

Published: April 5, 2017 - 12:12 PM
by agatoi
Hello everyone,

Below is the setup.py file for the Mblock software. Based on Scratch, Mblock is a programming software for Mbots. The Mbots modules themselves are built around Arduino boards.

Note that after installation, on the first run it will ask you to define a network access.

And there's also the installation of Arduino drivers and other components to do. If anyone feels like adding that to the list...

Download link for the .exe file: http://www.mblock.cc/

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

uninstallkey = []

#uninstallkey = ['{1E9DFEBB-4088-4693-A521-C755318BD492}_is1']
#uninstallstring=""C:\Program Files\mBlock\unins000.exe" /SILENT"

#def install():
#    print('installing aiz-mblock')
#    run(r'"mBlock_win_V3.4.6.exe" /VERYSILENT')

def install():

    versionpaquet = control['version'].split('-',1)[0]

    print('installing aiz-mblock')
    install_exe_if_needed("mBlock_win_V"+versionpaquet+".exe",
                        silentflags="/VERYSILENT",
                        key="{1E9DFEBB-4088-4693-A521-C755318BD492}_is1",
                        min_version=versionpaquet,
                        killbefore="mBlock.exe")

    #suppression de la clé de désinstallation pour pouvoir faire une désinstallation silencieuse. Voir def uninstall():
    uninstallkey.remove("{1E9DFEBB-4088-4693-A521-C755318BD492}_is1")

    #suppression du raccourci bureau
    remove_desktop_shortcut('mBlock')

#Pour une désinstallation silencieuse.
def uninstall():
    print('uninstalling aiz-mblock')
    run(r'"C:\Program Files\mBlock\unins000.exe" /VERYSILENT')
    

Re: Mblock Setup.py

Published: April 10, 2017 - 10:21 PM
by sfonteneau
To install a driver with Windows:

Example:

Code: Select all

run(r'C:\Windows\System32\pnputil.exe -i -a %s\esaousb.inf' % os.path.dirname(os.path.realpath(__file__)))

For a driver whose driver signature displays a Windows warning:

First, go to regedit and check the keys present in "certificates"
Install the driver manually (you must agree to install the driver)

Next, you will go to the following path to find your certificate key (it has been added):
→ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\TrustedPublisher\Certificates

You simply need to add the key before adding the driver information.

If the driver is not signed at all, you will have to sign it yourself

Re: Mblock Setup.py

Published: November 7, 2017 - 2:35 PM
by gaelds
Is there a way to force the French language to be used when installing mblock?

Re: Mblock Setup.py

Published: November 7, 2017 - 7:55 PM
by sfonteneau
I recommend running a regshot and comparing the values ​​before and after the language change to see where the language is being changed.

You may then be able to modify the value in session_setup.

Re: Mblock Setup.py

Published: November 8, 2017 - 4:36 PM
by gaelds
I just tried it but I don't think the solution is in the results file...
http://www.domsortais.fr/wapt/res0000.txt

And despite the installation of the Arduino drivers which should be included in the package, when you launch the Arduino robot, Windows asks to install its driver.

Re: Mblock Setup.py

Published: November 8, 2017 - 9:59 PM
by sfonteneau
You need to include %appdata% in the scan loop with regshot

Re: Mblock Setup.py

Published: November 9, 2017 - 11:58 AM
by gaelds
That doesn't work either, oh well.

Re: Mblock Setup.py

Published: November 10, 2017 - 00:08
by sfonteneau
For your information, the two folders that tell mBlock the selected language are:

%appdata%\com.makeblock.Scratch3.4.11\Local Store\mBlock\resource_version.xml and
%appdata%\com.makeblock.Scratch3.4.11\Local Store\mBlock\locale

Re: Mblock Setup.py

Published: November 10, 2017 - 09:21
by gaelds
Thanks! I'll try that. I ended up installing the extensions and driver manually because copying them to programfiles\mBlock\ext\libraries\ wasn't enough. The extensions appear as installed, but transferring them to the robot doesn't work. And we have to reinstall our own Arduino driver because the one in your package must not be compatible.

Re: Mblock Setup.py

Published: Dec 26, 2017 - 5:29 PM
by myosotis
Hello.

First of all, congratulations on all the work you've already accomplished!

Like gaelds, I'm also having a major problem setting the French language in mBlocks. This software definitely doesn't work in the usual way. It seems that switching the interface language is done by using a specific column in an .xlsx file! (locale.xlsx, column E)


@sfonteneau: I deployed mBlock v3.4.11 and I can't find any trace of the paths you indicated, namely

%appdata%\com.makeblock.Scratch3.4.11\Local Store\mBlock\resource_version.xml.
%appdata%\com.makeblock.Scratch3.4.11\Local Store\mBlock\locale

is indeed present in C:\Program Files (x86)\mBlock\assets
, and there is indeed a locale.xlsx file located under C:\Program Files (x86)\mBlock\locale and under %AppData%\Roaming\com.makeblock.Scratch3.4.11\Local Store\mBlock\locale.

However, that's not where the problem lies because (1) these files are not modified when switching languages, (2) we Even though I set the language (French) for user1 and copy these files to another user's profile, nothing changes. It boots in English or the language previously selected by user2 (so the language choice is indeed linked to the current_user).

...while writing this, the solution came to me: a quick regshot on the registry and on %AppData%\Roaming\ highlighted THE file needed to force French. It's makeblock.sol , located under %AppData%\Roaming\com.makeblock.Scratch3.4.11\Local Store\#SharedObjects\


... I suppose that, broadly speaking, I'll need to create %AppData%\Roaming\com.makeblock.Scratch3.4.11\Local Store\#SharedObjects\ first and then copy the makeblock.sol file there, which we'll include in the package. However, I'm afraid of making a mistake because I'm not very meticulous.

sfonteneau, to avoid wasting time and to do this properly, could you please help us with writing the session_setup?

PS: It seems the software also needs to access AppData%\Roaming\com.makeblock.Scratch3.4.11\Local Store\locale\locale.xlsx when changing languages. I also ran procmon during my audit, and I'm seeing read/write operations on this file after makeblock.sol is created. Sorry.