[SOLVED] Mblock Setup.py

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
agatoi
Messages: 23
Registration: Apr 05, 2017 - 12:03

April 5, 2017 - 12:12

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')
    
Last edited by agatoi on 23 Apr 2019 - 15:00, edited 1 time.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

April 10, 2017 - 10:21 PM

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
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

November 7, 2017 - 2:35 PM

Is there a way to force the French language to be used when installing mblock?
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

November 7, 2017 - 7:55 PM

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.
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

November 8, 2017 - 4:36 PM

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.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

November 8, 2017 - 9:59 PM

You need to include %appdata% in the scan loop with regshot
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

November 9, 2017 - 11:58 AM

That doesn't work either, oh well.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

November 10, 2017 - 00:08

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
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

November 10, 2017 - 09:21

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.
forget-me-nots
Messages: 5
Registered: December 26, 2017 - 4:34 PM

December 26, 2017 - 5:29 PM

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.
Locked