Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Auto start presentation

Tue Jan 31, 2017 4:06 pm

Hi having a really hard time here. Setting up a b+ model to display a presentation on start.

I know to play the presentation I need to run...

Code: Select all

sudo libreoffice -show /home/pi/documents/ file name 
In this case file name is presentation. Ods.

That works fine in the terminal but I don't seem to be able to make the auto start programme. I've read it's a #!/bin/bash job but I am stuck.

This is my first jump into coding so I litterally have very little knowledge.

Any help is greatly appreciated.

Thanks
John

User avatar
DougieLawson
Posts: 41901
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Auto start presentation

Tue Jan 31, 2017 10:27 pm

You don't need sudo.

You do need quotes or aposts round a filename with spaces. Or you have to turn file name with space to file\ name\ with\ space (escaping the spaces with back slashes).
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Auto start presentation

Tue Jan 31, 2017 11:16 pm

Thanks.
Stupid question but how do I create the .sh file? Is that what I need? I know what I want, I am just missing the one thing to achieve it... that and the knowledge to fix it :?:

User avatar
DougieLawson
Posts: 41901
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Auto start presentation

Wed Feb 01, 2017 12:27 am

nano /home/pi/somefile.sh
or
vi /home/pi/somefile.sh
or
Use leafpad (which is part of the GUI and probably easier than either nano or vi)
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Auto start presentation

Thu Feb 02, 2017 10:34 am

Perfect. I get this now.. i think
What does the text editor file need to have in it to auto start and show a libretto office presentation?

I am defiantly doing something wrong because I am more or less copying other answers and getting no where.

I am really sorry to ask to be spoon fed but I am just starting out and have been lumbered with this by work. They think I can just download the solution from e-bay.... their exact words.

So far i'very set up an autostart file and if I place the impress desk top file in there it opens,though sometimes I get an error "/home/pi/%u does not exist" but not every time?

Opening the programme isn't what I want it's opening and playing the specific slide show from the start.

I can do it manually from the terminal once the Pi is booted but I want to be able to plug it in, startx and have the Pi play the presentation. I know this has been done but I don't think i'm understanding the solution.

The forum in general has been a massive help with other issue. Hats off to the Gurus and other peoples here.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Auto start presentation

Thu Feb 02, 2017 2:26 pm

looks like it is not a easy thing,
when i play with it always impress tried to start and locked the file until i was able to recover it.

i think a startup delay is required for impress.
that is what i tested:
-a- there is a
/home/pi/Documents/mypresentation.odp
that is the one you want to show
pls check if there is a *lock* file in that directory

extra for this test i work from /HDMI/Desktop not remote, so my wife angry because no TV.

-b- above there are questions about filename and editor so
i suggest you only work from desktop, using the file manager. ([start][accessories][file manager]
and for later work you need to enable /view/show hidden
go down /Documents/ and find your presentation.

-c- instead of thinking auto start we first make only a start script
context menu {right mouse click}/create new/empty file/mypresentation.sh/OK
then find that new file and point mouse on it and
context menu {right mouse click}/text editor
the editor what opens the file is leafpad
now you copy following script into

Code: Select all

#!/bin/bash
env sleep 30s
/usr/bin/libreoffice --show /home/pi/Documents/mypresentation.odp
/file/save/
so this script makes a delay ( can reduce it as raspberry pi starts much faster as other computer )
it starts "libreoffice --show" NO SUDO
using full path info for application and files

context menu {right mouse click}/Properties/Permissions/
EXECUTE (select ANYONE) [OK]

now with a double click you can test that start delay already

-d- now we make a second file, a .desktop like for the desktop icons.
context menu {right mouse click}/create new/empty file/mypresentation.desktop/OK
then find that new file and point mouse on it and
context menu {right mouse click}/text editor

Code: Select all

[Desktop Entry]
Type=Application
Name=mypresentation
Exec=/home/pi/Documents/mypresentation.sh
Icon=libreoffice-impress
Comment=show on boot / login pi
Terminal=true
X-KeepTerminal=false
your start delay script needs also full path.
this we also make executable
context menu {right mouse click}/Properties/Permissions/
EXECUTE (select ANYONE) [OK]

now with a double click you can test that desktop file also

-e- for a autostart we copy that desktop file to
/home/pi/.config/autostart/
pls open a second file manager window and go to (/home/pi) /.config/autostart/
now go back to the first file manager window and DRAG DROP the desktop file to the second window.
pls hold [CTRL] key to do a copy and not a move ( see + sign near mouse pointer )

reboot
Last edited by KLL on Thu Feb 02, 2017 4:30 pm, edited 1 time in total.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Auto start presentation

Thu Feb 02, 2017 3:42 pm

@KLL
Thank you so much this is great but when I attempt to execute the .desktop file it says invalid desktop entry file:/home/pi

What could I be doing wrong?

Your explanation was amazing I just lost you on that last step.

Also my deepest apologies to your wife. Hope your not in too much trouble :)

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Auto start presentation

Thu Feb 02, 2017 4:01 pm

Kingcanon002 wrote:execute the .desktop file it says invalid desktop entry file:/home/pi
check the files again:
.desktop contains
Exec=/home/pi/Documents/mypresentation.sh
in one line! no blanks
and check the
.sh file is in that path.
Last edited by KLL on Fri Feb 03, 2017 9:09 am, edited 1 time in total.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Auto start presentation

Thu Feb 02, 2017 5:21 pm

I'very had to finish for today but I will let you know as soon as I try this.

I am very very gratefull for all the help. I owe a few drinks to the helpers here at any rate :lol:

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Auto start presentation

Fri Feb 03, 2017 9:50 am

I double checked the .desktop file and it's exactly like what you put above (save for the correct file path of the .sh file)

I get the error
"Invalid desktop entry file:'/home/pi/.config/autostart/presentation.desktop'

The .sh file works on its own fine though. What might I be doing wrong?

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Auto start presentation

Fri Feb 03, 2017 11:37 am

Kingcanon002 wrote:error
"Invalid desktop entry file:'/home/pi/.config/autostart/presentation.desktop'
i checked from here and
-a- independent from the location of the presentation.desktop file ( reasonable would be /Desktop )
-b- even it is not made executable
with a double click on it the lx-terminal opens first.
http://kll.engineering-news.org/kllfusi ... mpress.jpg
Last edited by KLL on Sat Feb 04, 2017 12:25 am, edited 1 time in total.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Auto start presentation

Fri Feb 03, 2017 11:44 am

:roll:
The other option is I didn't pay attention to what I was typing.

This has worked.
Thank you so much!! This is perfect.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Auto start presentation

Fri Feb 03, 2017 12:28 pm

Kingcanon002 wrote:what I was typing
ahm: if your RPI is not offline i not see what you have to type,
i made the procedure detailed, stating filenames and code windows
both i expected you to copy / paste ( from browser [here] to file manager / editor )
( same when you work remote ssh putty / nano editor ... no typing required, see also my BLOG what usually expects to work in terminal remote or desktop)
you will find that you can get incredible fast using copy / paste as old style [ctrl][c] / [ctrl][v] or mouse context menu.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Auto start presentation

Fri Feb 03, 2017 4:19 pm

My pi is offline and I had to key the details across. This piece will never have network access as won't need it ever.

Thanks again this all works perfectly now.

Return to “Beginners”