superf4 icon indicating copy to clipboard operation
superf4 copied to clipboard

[Suggestion] Change autostart from regkey to taskschd

Open pointydev opened this issue 7 years ago • 1 comments

Heya,

Just a lil suggestion, how about instead of making a registry key in order to autostart, you create a task in Task Scheduler, that way if the "Elevate on autostart" option is selected, there is no UAC prompt when the task is run (provided the task is set to run in "Hidden" mode with highest privileges). Possibly add user account name to the task name to handle multiple users?

Here's an example of the task:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2017-12-29T11:13:21.5989706</Date>
    <Author>POINTYPC\Pointy</Author>
    <URI>\SuperF4 Startup</URI>
  </RegistrationInfo>
  <Triggers>
    <LogonTrigger>
      <Enabled>true</Enabled>
    </LogonTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-381785761-2547864021-1518221547-1001</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <AllowHardTerminate>false</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>true</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
    <Priority>7</Priority>
    <RestartOnFailure>
      <Interval>PT1M</Interval>
      <Count>10</Count>
    </RestartOnFailure>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>"C:\Users\Pointy\AppData\Roaming\SuperF4\SuperF4.exe"</Command>
    </Exec>
  </Actions>
</Task>

SuperF4 Startup Example Image

Thanks, Elliott

pointydev avatar May 24 '18 12:05 pointydev

Hi Elliott,

Thanks for the suggestion. I did consider using this before, but it didn't work as reliably as the current method. So I decided not to use it in the app, but feel free to use it if it works well for you.

I did not know that you could export the task to an xml file. That might make it easier to make a Howto or similar to set this up. Could be nice to put in the docs.

Anyhow, that is how I reasoned back then. Maybe it would work better now in Windows 10.

stefansundin avatar May 24 '18 14:05 stefansundin