Restarting application when computer restarts

  1. 4 weeks ago

    Paul R

    Aug 24 Pre-Release Testers, Xojo Pro Kirkland, WA

    I have been requested to add an option to my application that will automatically start the application when the computer is restarted and/or the user logs in. I suspect that this is either not possible to set up from within the application, or would require elevated privileges, etc. Any suggestions? I need this for macOS and Windows (and bonus points for Linux).

  2. Louis D

    Aug 24 Pre-Release Testers, Xojo Pro Montreal, QC, Canada

    On Windows, you can add a link to your application in the startup folder, or set the application up as a service with an automatic start. The user could also do it himself using the Task Manager. (in the startup tab, find the application and right click the mouse. Then, select "Activate".)

  3. Alberto D

    Aug 24 Pre-Release Testers, Xojo Pro
    Edited 4 weeks ago

    On mac there is login items option:
    System Preferences - Users & Groups - Login Items.

    Don't know if Linux distros use the same /etc/rc.d directory or /etc/rc.local file to execute scripts when the machine starts. I don't use Linux on desktop only little server experience.

  4. Sam R

    Aug 24 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    On the Mac it's doable, but it's a slightly complicated procedure. Go to this page and scroll down to my first post from 1st June 2017.

    https://forum.xojo.com/40988-add-app-at-login-items-mas

  5. Emile S

    Aug 24 Europe (France, Strasbourg)

    When you shutdown MacOS, all actually open applications are restarted on reboot excepted Xojo (the IDE). And this is probable from before El Capitan (3 OS major versions away ?). I am quite sure that Windows 10 already have this set of features. Linux ? (I do not know).

    Better: the opened documents (and the unsaved documents) are re-opened and displayed… Go figure…

    That is far beyond what Paul ask (but it can be what the user(s) are asking).

    I was asking that in last March. I do not answer to that, but smiled thinking (“Hey man, did you ask similar kind of question to Microsoft for the Word software you are using everyday ?”). After that, I discovers that the guy have very little knowledge on the computer industry and as end user ;)

  6. Christian S

    Aug 25 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    Please check LSSharedFileListMBS class inn MBS Xojo Plugin for adding login item on Mac.
    Or better the ServiceManagementModuleMBS module as this example shows.

  7. Greg O

    Aug 25 Xojo Inc Somewhere near Raleigh, NC

    Another possibility on macOS is to use launch services. User specific ones don’t need elevated privileges to install, but ones that start before a user logs in certainly do.

    If you’re curious what such a script looks like in layman’s terms, I suggest downloading the demo of LaunchControl and looking at the ones already on your machine. They can get really sophisticated, but the plist allows for many powerful features as well.

    http://www.soma-zone.com/LaunchControl/

  8. Paul R

    Aug 25 Pre-Release Testers, Xojo Pro Kirkland, WA

    Thanks everyone. Some excellent paths to explore.

  9. last week
    Edited last week

    For Linux.... This is my first project in Xojo, AND first time working with Linux so forgive my lack of lingo.

    Here are the instructions I now have for myself where "myapp" is the name of my Xojo project and it is in the "share" folder. I put a shortcut on the desktop, then launch it on startup.

    Shortcut on desktop
    right click on the desktop and create new file with “desktop” extension, e.g. MyApp.desktop. Edit as below
    [Desktop Entry]
    Name=Stats
    Comment=Stats
    Icon=/share/myapp/GreenBucket.ico
    Exec=/share/myapp/ myapp
    Type=Application
    Encoding=UTF-8
    Terminal=false

    To autostart app on bootup:
    Go to home folder then CTRL + H to show hidden files
    Go to /home/pi/.config/autostart folder
    Create a file here called myapp.Desktop
    Edit file to have this text in it
    [Desktop Entry]
    Type=Application]
    Name=myapp
    Exec=sudo /share/myapp/myapp

  10. Paul R

    Sep 14 Pre-Release Testers, Xojo Pro Kirkland, WA

    @Dawn M Here are the instructions I now have for myself where "myapp" is the name of my Xojo project and it is in the "share" folder. I put a shortcut on the desktop, then launch it on startup.

    Thanks. That helped a lot. It's now working on Linux.

or Sign Up to reply!