Announcement

Collapse
No announcement yet.

Create Scheduled Task via Command Line or in InnoSetup

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gary Beene
    replied
    Howdy, MCM!

    Here in the Dallas area, we have over a dozen Senior Citizen Centers. I've no plans to offer their members free software, but I did offer making general presentations to their members - showing them what low vision technology options are available to them, everything from simple magnifiers to electronic systems and software, such as EZReader. But our Centers do not allow commercial organizations to come into the facilities for fear of having their members taken advantage of. The closest to an "open" door they have are yearly symposiums where various technology companies can demonstrate their wares. But with COVID, those symposiums have generally been put on hold.

    I have given such presentations to commercial Retirement Centers, bringing along a local optometrist to discuss eye diseases.

    It all goes to show that you're correct in saying that a software business "includes a LOT of things other than ..."

    Leave a comment:


  • Michael Mattias
    replied
    It's hard to give away free stuff!
    Maybe not...

    Notwithstanding the results of your own efforts at outreach, I just joined the Port Washington Senior Center. I'll ask the director about "visual reading assistance" for some of our other members.

    That said, I know trying to run an actual software business is not easy and includes a LOT of things other than creating code and I won't go too far without getting in touch "off line."

    Leave a comment:


  • Gary Beene
    replied
    Howdy, MCM!

    Yep - the "un-retired" thing was kind of thrust upon me. My 96 year old mother-in-law developed macular degeneration. It's a disease that destroys your eyesight, but stops short of complete blindness. I was able to develop software that enabled her to read or listen to books on the computer, including books from Kindle. She was thrilled with that option and read books continuously until she passed away a few years later.

    My family suggested that I not let the software die with her, so that's how my "un-retired" status came about. I've since added dozens of of apps to create a suite called EZReader. One of those apps deals with cameras for reading printed materials. My cameras posts are driven in part by that capability. The suite also includes an email client, calendar, games, and other apps that my low vision users need to get the most from their computers. My low-vision users find that touch-screen computers are extremely useful. All of this has driven many of my comments on ease-of-use in various posts.

    Yes, it is a business but not one whose income is necessary for me. I've offered EZReader for free to individual forum members whose eyesight, or that of their spouses, warrants the use of EZReader applications. If there's anyone on the forums that I've not made the offer to, please email me and I'll make the same offer.

    Interestingly, I went to a couple of local churches and made the offer of free software to low vision church members, with the stipulation that normally sighted church members would be the first line of "tech support" for the folks that got the free software. Somewhat surprisingly, I didn't get any takers on the offer. That was all pre-covid stuff, so I wonder if I'd get the same response today.

    I also went to the company "Computers for the Blind" - a Dallas non-profit organization that refurbishes PC and makes them available to folks with eye issues. I offered to provide free EZReader software on every PC they ship (about 50 per month) under the same conditions and they turned me down! They distribute trial copies of commercial software and were worried that my EZReader software, which competes in some areas with the commercial stuff, would cause them to lose access to the trial copies.

    It's hard to give away free stuff!

    On a humorous note, when I worked at Raytheon, I had accumulated a lot of change. I put a box on my door and dumped the coins in it, along with a sign "Free Money! Take some!". After a month, there was more money in the box than when I put the box there in the first place! It really is hard to give away free stuff!





    Leave a comment:


  • Michael Mattias
    replied
    Surely you don't create DLLs for every one-line of code that is used in multiple applications?
    Not 'one line of code,' but in fairness... in this application I already had a DLL with some other functions in it (see that posting of the Inno Setup script using functions from a DLL) so adding another function to those already there would frankly be pretty convenient. (As well as satisfy my personal biases against loss of control),

    Leave a comment:


  • Michael Mattias
    replied
    I'm not using CMD in the installation program. InnoSetup calls the window application schtasks.exe, with the parameters I provide on one line in InnoSetup.
    I mentioned CMD version of your program , not an explicit command shell. In your case the command version of your program is "schtasks.exe"

    So....
    In this case.... I don't like yielding control of the install to the 'black box' which is 'schtasks.exe' so I would use my own code and package it in a DLL. For this there is no rational reason; it's one hundred percent pure gut feel and preexisting bias.

    That's a good enough reason, isn't it? At least if I freely admit it?

    I think it was Eric Pearson who contributed a piece here titled "Who's Afraid of the Big Bad DLL?" or something like that. It was basically telling you DLLs are code, too. Might be worth a re-read on your part, especially since it seems certain you un-retired whilst I was away for a year or two.

    MCM

    Leave a comment:


  • Gary Beene
    replied
    MCM,
    Thanks for the comments, but I don't think you understand the approach. I'm not using CMD in the installation program. InnoSetup calls the window application schtasks.exe, with the parameters I provide on one line in InnoSetup.

    Surely you don't create DLLs for every one-line of code that is used in multiple applications? The concept of a DLL is a good one, but I must say I've never heard of anyone creating a DLL for just a single line of code. Having that many DLLs seems like a true maintainability nighmare, better solved with just a few comment lines in the InnoSetup script.

    Leave a comment:


  • Michael Mattias
    replied
    Once I had the CMD version working...,
    I think I have previously indicated I have a bias against using CMD if I don't have to.

    It seems like an extra effort to create a DLL,
    Depends on how your CMD version of the program is structured. I often write stuff where I can code something like..

    Code:
    #IF DEF(%PB_EXE)
        FUNCTION WinMain ( params
          parse command like for options
    #EL:SE
        FUNCTION LIBMAIN (params)
           get options maybe from params
    #ENDIF
    
      ' common to both EXE and DLL compilation:
          CALL Mainprocedure (params)
    
     END FUNCTION
    It works here.

    For another application I created a function which did a lot...and I stored it in a DLL. Then I created a command-line version of a program which basically did nothing but parse the command line to get the user options and then called that function in the DLL. Another program (the one with a GUI), ALSO had an option which called that same function in that same DLL except it got its options from an interactive screen.

    Why did I do this? It was a new application. Maintenance was inevitable. And in addition to having an almost paranoid aversion to putting the same code in multiple places (which of course can be avoided with an #INCLUDE file), I did not want to have to change and retest TWO programs when all I had to do was change ONE DLL. Your Mileage May Vary.

    (I think I have also made clear over the years the weight I put on :"maintainability" in software design. )

    MCM






    Leave a comment:


  • Gary Beene
    replied
    Based on the CMD example I gave in #5, this line in my InnoSetup script does the job nicely

    Filename: "schtasks.exe"; Parameters: "/Create /RL Highest /F /TN MyApp /TR {app}\myapp.exe /EC Application /SC OnEvent /MO *[System/EventID=777]" ; Description: "MyApp"; Flags: runhidden
    MCM,
    It seems like an extra effort to create a DLL, when I can include the line above directly in the InnoSetup script. I mentioned this approach in the OP. But I used CMD examples because it allowed anyone watching the thread to test it out themselves without having to go through InnoSetup. Once I had the CMD version working, I just transferred it into a line in an InnoSetup script. That approach (line in the InnoSetup script) was suggested in some of the links I gave in the OP.

    Leave a comment:


  • Stuart McLachlan
    replied
    Originally posted by Michael Mattias View Post
    One problem may be there is now an embedded "Left square bracket, CODE, right square bracket" within the Inno Setup Script... which of course IS a vBulletin "magic header" and may be messing up all kinds of stuff.
    There are actaully several of them. And yes that will mess up the formatting.


    Leave a comment:


  • Michael Mattias
    replied
    Check Adam's post.
    I will play with that formatting tip, Rodney (and Adam's linked post) .

    Hmm... not working (yet) ?

    One problem may be there is now an embedded "Left square bracket, CODE, right square bracket" within the Inno Setup Script... which of course IS a vBulletin "magic header" and may be messing up all kinds of stuff.

    I think I shall use the test forum.. and then see if I can move the post to where I want it. I think I get a day or two to edit it.




    Leave a comment:


  • Rodney Hicks
    replied
    getting "paste" to keep the indents in the formatting was a dog... So I attached the file 'as is' except for the suffix.
    Check Adam's post.
    https://forum.powerbasic.com/forum/a...ion-formatting

    Leave a comment:


  • Michael Mattias
    replied
    Worth a read, methinks...

    https://docs.microsoft.com/en-us/win...task-scheduler

    Where you will find...

    This section contains code examples that illustrate how the Task Scheduler API is used and XML examples that show how tasks are defined in the Task Scheduler schema. Most of these examples are stand-alone code that can be run independently, or pasted into a larger application and modified to the requirements of the application.
    Now, how does this address your limitation in the title, " Create Scheduled Task via Command Line or in InnoSetup???"

    Well, you write your own command line program.

    However, if you are planning on using this as part of an install procedure using Inno Setup. I'd write it as a FUNCTION and export it from a Dynamic Link Library so you can call it right from your Inno Script as demonstrated here....

    Inno Setup:Commented Installation Script June 8 2003

    Let me check if that shows calling an external function ... no, it does not. Phooey.

    OK, let me be nice guy and add a script which does do that to that source code posting......

    Ok, I added another script which has the call of the external.....BUT.. getting "paste" to keep the indents in the formatting was a dog... So I attached the file 'as is' except for the suffix.

    That script shows the required Inno Setup "[FILES]" entries as well as the Pascal source code you need to get your function(s) called during the setup.

    MCM

    Leave a comment:


  • Gary Beene
    replied
    Howdy, Mike!
    This is for a first time install.

    For updates, I have built in API/TCP procedures to get new files or to update existing files. I don't do automatic updates. Users must initiate an update within my apps. I use the same technique for all of my gbApps.


    Leave a comment:


  • Mike Doty
    replied
    Just food for thought.
    Files can be sent back and forth in the background using the SQLitening service (see slGetFile,slPutFile.)
    The SQLitening service includes source code in PowerBASIC.

    Leave a comment:


  • Mike Doty
    replied
    I see things have changed. There used to be a setting in Internet options.

    https://www.howtogeek.com/75356/how-...-in-windows-8/

    I did some more reading on InnoSetup and I can't get rid of the final screen because the author requires at least 1-screen.

    I am curious if you already have software on the users machines or if this is for a first-time install.
    If you have software on the machine already would definitely make it easier bypassing the browser.
    Then again, not sure since I haven't done any of this without a user being able to click something.

    You might be interested in a service so nothing ever needs to be clicked for transferring files.

    Leave a comment:


  • Gary Beene
    replied
    Howdy Mike!

    Maybe you can turn off Smart Screen for your users
    I was looking at the SmartScreen and apparently it only applies to downloads through Edge or from the Windows App Store. Is that your understanding as well?

    My users download from garybeene.com and typically use Chrome. I don't recall seeing any "Smart Screen" nomenclature on popup windows.

    Leave a comment:


  • Stuart McLachlan
    replied
    Looks like 777 is a pretty safe event to trigger, it's usually an Information Event after an application crash dump.
    A couple of references to Event 777:

    Event 777
    This event is logged when Application image succesfully dumped.
    Resolution
    This is a normal condition. No further action is required.


    Source
    COM+
    Level
    Information

    Description
    Application image successfully dumped. <dump file>
    Server Application ID: <ID>
    Server Application Instance ID: <ID>
    Server Application Name: <name>

    Leave a comment:


  • Mike Doty
    replied
    Maybe you can turn off Smart Screen for your users
    https://www.howtogeek.com/75356/how-...-in-windows-8/


    or a registry entry
    https://www.winhelponline.com/blog/bypass-smartscreen-even-if-its-enabled-through-group-policy/


    Is it possible to do a silent install without using the /SILENT or /VERYSILENT command-line parameters?
    No, nor is such a feature planned (it would be abused). If it is your intention to keep user interaction to a minimum, use the Disable* [Setup] section directives.

    Code signing doesn't seem like an option due to cost and some have said a reputation has to be established

    Leave a comment:


  • Mike Doty
    replied
    Thanks,
    I am trying to get rid of "Ready to Install" page.
    I may switch to your method.

    Leave a comment:


  • Gary Beene
    replied
    Howdy, Stuart!
    I take it to mean that a "777" is a fake event? That the person who responded in the article.knew it was fake and would never occur, leaving the task available for on-demand usage. I don't want to create the event, I just want to put a shortcut on the desktop and let my user click the shortcut whenever they want. The 777 just creates a place holder task for my app, which otherwise would be blocked by the UAC.

    And, Howdy, Mike!
    With InnoSetup, I see not the UAC Y/N but rather another popup saying that the downloaded setup EXE is risk and asks the user what to do. But one of the EXEs I install is a TeamViewer remote control EXE and it always gets a UAC Y/N ... unless I use Task Scheduler to create a task with "Highest Privileges". The Task Scheduler task allows my folks to bypass the UAC Y/N when running the TeamViewer remote control EXE that my setup app installs.

    Leave a comment:

Working...
X