Need to make my tool work automatically without any button - c#

I have one window's application in c# which generates mail by retrieving the data from the database on a button click and generate mails in outlook.
Now, I need to make my application to work automatically therefore, on every Monday it will start sending the mail by itself.
Please suggest me some idea and code which can resolve my issue.

Change the application to accept a command line argument to make it send the email when the application starts and shut down after. Then create a windows "scheduled task" to launch the app with the correct commandline argument.

Try to make Window Service and schedule it.
Basically you can put your code call on button click in a Console Program (output will be an .exe) and then schedule it with windows scheduler every Monday.
Hope it help you !

Related

How do I run a process in a UWP before displaying app

I've completed a winform project that handles a uri scheme (TEL:)
I'm now trying to do the same in UWP. I've successfully got the app launching on TEL activation.
How do I stop the app showing when its run with arguments? Run silent.
The app runs a task and closes. There is no need for the UI unless the user hasn't done the first time set up or there is an error.
I've been looking into prelaunch but before painting myself into a corner I wanted to ask a more experienced user what the best practice is as I would like to publish this application and follow best practice.
I've checked similar questions but they were after a background service.
Thank you.
Answer thanks to Nico Zhu.
Can not launch an app without displaying UI but it is possible to use 'FullTrustProcessLauncher' to run an exe instead.
More information on this can be found here

How to automate a windows form application without windows scheduler?

I need to make an application which automatically moves files from source folder to destination folder on specified "time"(2 different times in a day). Once entered, this app should run daily. I have made a form application which moves file perfectly on button click. I need to implement this without any button click interaction.
Scheduling using Windows Task Scheduler is not an option for me.
One way I have achieved exactly that by creating a windows service project and put all the button click logic in a class library.
For scheduling the service i used Quartz.Net so that it can triggers the job/service at given interval.
You can find more about Quarts.Net here.
Please do note that you need administrative access to install and run your windows service.

how to automate some actions on Windows form Application?

I have a working windows form desktop application that I have created. The application is doing some jobs on monthly basis. Every month I need to run the application and there is a connect button. which I click and then it loads up in a dropdown menu some lists and I choose one of them and click another button to do the job. So what I would like to do is automate this process and just let the application to do this job for me every month as a scheduled. I do not want to go inside to code and make it a console application and run the console application from tasks schedule. I am just wondering is there any way that I can create another small application and define the steps to take (similar Macros or test projects(codedUI Test)) to do the job for me?
May be you just need something like AutoHotkey? http://www.autohotkey.com/
It's already 'another small application' and you can 'define steps to take' with it :)
I recommend you Automa - Python tool/library for automating GUI applications. It's very easy to use and perfect for tasks you described:
click(Button("Connect"))
click(ComboBox("Drop Down Menu Name"), "Option 1")
press(ENTER)
You can save the commands in a text file with the .at extension and run it easily from command line whenever required:
> Automa.exe your_script.at
Disclaimer: I'm one of Automa's developers.

Automate a GUI Windows application with user inputs to run every week

I have a simple Windows application which has two text boxes and one button called "Run". Currently, I have to manually enter the values in text boxes and click on Run button every week. I want to automate this process, so that no user interaction should be required. Can I write a script to do this?
I assume you have the source of your Windows application as you've tagged your question with C#. If so, then it's fairly straightforward to pass your text box values on the command line via something like Windows Task Scheduler, parse the command line parameters in your application, and pass them on to whatever you call when Run is pressed.
Kicking it off at every X interval is one thing. I would suggest the Windows Task Scheduler. However, it sounds like you need to interact with the GUI application after it's been launched. For that, all I can do is point you in the right direction. The only thing that comes to mind is to use a third-party GUI testing suite. Check out this list. You can script any of these suites to interact with the GUI, that is, input some data and click on the Run button.

Using C# or PowerShell Automate Username and Password Entry in 'Connect to ServerName' dialog box

I have a webpage that requires users to enter their credentials in a 'Connect to "ServerName"' dialog box and click OK. I want to automate this login proccess using C# or PowerShell. Is this possible? If not, is there another way of automating this?
Looks like you are trying to execute the webpage automatically and that popup is blocking you from doing that, if that the case you can use SendKeys to type in the boxes
Also a macro recorder being fired by a scheduler task will do it.
you can also instead of trying to open the webpage make a WebRequest from a C# application passing the credentials , that will lead you to the same results...
regards
It is possible, but it is probably far easier to use AutoHotkey.
It can be scripted to watch for a window of a certain name and then send keystrokes to that window automatically. Alternatively, you can set up the script so that the user just has to press some key or series of keys in that window and it will be converted to a set of keystrokes.
The download also includes a compiler, so once you get your script right you can compile it to an .exe to distribute.

Categories