Start Scratch controller and script together

scratch
brickpi3

#1

I made a simple Scratch script for the BrickPi3 and it runs fine, but I noticed the “Scratch Controller” Lxterminal has to be open for it to work. I’m using Raspian for Robots.

When I open my file (let’s say MyFile.sb), the scratch controller doesn’t automatically open, so my BrickPi does nothing. What I’ve ended up needing to do is start Scratch from Dexter’s executable which first runs a selection screen where I have to select my product and click “start programming,” then opens Scratch Controller and a new Scratch file. Then I have to close the new Scratch file and open MyFile.sb. It seems more cumbersome than should be possible.

  1. Is there a script I could write or a way to open MyFile.sb so that Scratch Controller starts automatically with it, so I can run my file without having to go through this circuitous route?

  2. One step further, but is there a script that would start either Scratch Cotroller or Scratch Controller and MyFile.sb on startup of Raspian?

I tried looking for a Scratch Controller executable to run individually but couldn’t find one.


#2

Hello @ravdawg3
Which version of Raspbian for Robots are you running?
There should already be something in place that lets you double click your own Scratch program so I need to know which version you’re using so I can debug the issue.

As for running the Scratch program at startup, it can only be done partially. There’s no way to force a click on the green flag for example.

Cleo


#3

Hi @cleoqc

I’m using “Raspian GNU/Linux 9 (stretch).” The version of Scratch is 1.4 (it seems like Scratch 2 may also be on the BrickPi3 as I came across it in my digging for the scratch controller, but the Scratch desktop shortcut that actually works opens 1.4).

Also, regarding running Scratch at startup, I’m fine with having to click the green flag or my sprite to run the Scratch script itself. I’m mostly looking for something that will actually open the Scratch Controller terminal and my Scratch .sb file at startup so I can run it without having to go through the circuitous route as mentioned above. Even if it just opens Scratch controller at startup so I just have to open my file manually, but avoid everything else, I’d be fine with it.


#4

Any luck looking into this?


#5

@ravdawg3 I’m looking into this today, and I can totally double click on my scratch file. It will open the controller and Scratch all at the same time.

What’s the “history” of your SD card? Is that a card you’ve had for a while and you ran DI Update on it and if so, how old is your card to start with?

Also, can you check what is the default program for opening a Scratch extension? See this GIF on how to assign it to Scratch for Robots


#6

@cleoqc

The SD card is a brand new one that I got with the BrickPi starter kit. I had initially installed the image for CINCH but overwrote it with Raspian for Robots after 1 use. I’ll try to set the default as you showed and get back to you.

Edit:
I checked the default for my .sb file; it was blank. I set it to Scratch for Robots as you showed, but now ONLY the Scratch Controller opens. The .sb file itself does not. I tried changing the default to “Scratch” instead of “Scratch for Robots,” and the .sb file opened in Scratch 1.4 again, but without the Scratch controller. I’m still not sure how to get both to open at the same time.


#7

When did you update your card to Raspbian for Robots? Is it possible it’s not the newest one?


#8

I wrote the image on 7/13/18, and the ZIP folder containing it is labeled “2018.06.27_Raspbian_For_Robots_by_Dexter_Industries-stretch” - is there a newer version than this one?

I can try re-writing the disc image if you think it’s worth a shot. Could you provide a link to the latest image, and is there anything special I should do to first wipe the current image from the SD card?