Author Topic: ? auto run program on startup...  (Read 3913 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
? auto run program on startup...
« on: January 01, 2021, 01:17:18 am »
Suppose I have a QB64 program (small and quick to run) called X.exe

How can I have X.exe run automatically

on start up
say at approximately 1 hour intervals
on shutdown

Rather not have a QB64 program running ALL the time and shelling out to start X.exe

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: ? auto run program on startup...
« Reply #1 on: January 01, 2021, 04:17:27 am »
Hi, Google says:

Add an app to run automatically at startup in Windows 10
1. Select the Start button and scroll to find the app you want to run at startup.  - in your case select X.exe
2. Right-click the app, select More, and then select Open file location....
3. With the file location open, press the Windows logo key + R, type shell:startup, then select OK.

In Windows 7 just copy exe file to StartUp folder in Windows.

If you want to run the main kernel every hour, you must still have one small program running in memory that monitors the time and status of the other program. I have not yet written such a construction of the program. But I wrote a simple construction that started and stopped immediately at system startup and it worked. In fact, it just triggered the introductory animation and sound...

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: ? auto run program on startup...
« Reply #2 on: January 01, 2021, 04:32:32 am »
For the app, I'd add MS.CONFIG, unless of course, I was running Linux... then, I'd just shoot myself.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: ? auto run program on startup...
« Reply #3 on: January 01, 2021, 05:18:19 am »
Lookup windows task scheduler. It allows you to run a program at regular intervals (and I believe even allows running a task at startup or login).

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: ? auto run program on startup...
« Reply #4 on: January 01, 2021, 01:53:46 pm »
The simplest way is like what Petr described.

1) Open Run
2) Type "shell:startup" (without quotes) and press enter
3) Paste a shortcut to the program you want to run on startup

That's it. I do it at my IT job all day to make our PCs run their remote desktop programs on startup.
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: ? auto run program on startup...
« Reply #5 on: January 01, 2021, 03:28:05 pm »
Windows has 2 startup folders.

The All Users Startup folder is found in the following path:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

The Current User Startup folder is located here:
C:\Users\[User Name]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

You can find the via the file explore, as long as you have “Show Hidden Files and Folders” checked on.  Just paste a shortcut (or the exe) to your program in whichever you want.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: ? auto run program on startup...
« Reply #6 on: January 05, 2021, 07:59:15 am »
@Petr
@Pete
@luke
@SpriggsySpriggs
@Steve

Thanks for replies - many different ways!

@luke 
I tried out the Task Scheduler for my program BEEP-BEEP-BEEP and the screenshots for my configuration of same is attached below. Maybe I have not configured it properly - get strange results (SOMETIMES works or not, does not appear to actually run at startup but say after 5 minutes with varying results)

@Steve
I tried via C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\ for my program BEEP-.exe. Get inconsistent results when running together with BEEP-BEEP-BEEP.exe. (Often BEEP-.exe is not working (i.e. single BEEP one minute apart)).

The purpose of the two programs running together is to test and understand what windows allows to be done - and so far appears to be inconsistent and unreliable. The configuration was monitored over several hours.

BEEP-BEEP-BEEP.bas
Code: QB64: [Select]
  1. 'on the 30 seconds mark (of a minute) BEEP BEEP BEEP
  2.  
  3.  
  4. _SCREENHIDE: BEEP: BEEP: BEEP: BEEP: BEEP: BEEP 'startup 6x BEEPs
  5.  
  6.     IF RIGHT$(TIME$, 3) = ":30" THEN ' eg TIME$ 18:40:23
  7.         BEEP: BEEP: BEEP
  8.         _DELAY 2
  9.     END IF
  10.  
  11.  


BEEP-.bas
Code: QB64: [Select]
  1. 'on the 0 seconds mark (of a minute) BEEP
  2.  
  3.  
  4. ' eg TIME$   18:40:23
  5.  
  6.     IF RIGHT$(TIME$, 3) = ":00" THEN
  7.         BEEP
  8.         _DELAY 2
  9.     END IF
  10.  
  11.  

I know my example sounds a bit silly (as written and applied) but it still does not appear to me that Windows is properly handling the example. In comparison 3rd party apps appear to work OK.

Any comments appreciated.

Offline wiggins

  • Newbie
  • Posts: 34
    • View Profile
Re: ? auto run program on startup...
« Reply #7 on: January 07, 2021, 05:15:25 pm »
The simplest way is like what Petr described.

1) Open Run
2) Type "shell:startup" (without quotes) and press enter
3) Paste a shortcut to the program you want to run on startup

That's it. I do it at my IT job all day to make our PCs run their remote desktop programs on startup.

Learned something new.

THANKS!