Running .bat file before .exe automatically in Advanced Installer - batch-file

I'm new to Advanced Installer. After Installing the file setup, I need to run a ".bat" file before running my ".exe" file every time. I found to add it, setting it's attributes as (Hidden, Vital and System), but I need to run it every time before lunching the application.
Please help me, Thanks

If you're launching the application as a Finish Action from the Dialogs page, here are the steps:
go to Custom Actions page and add a Launch File custom action without sequence to launch the BAT file
enable the custom action's "When the system is being modified (deferred)" and "Run under the System account with full privileges (no impersonation)" options
go to Dialogs page, select the ExitDialog from First Time Install in the Install Sequence
select the Finish button then go to its Published Events tab and enable "Show all events" option
add an "Execute custom action" event passing in the "Launch file" created above as an argument
set the event's condition to the checkbox's name so the BAT doesn't execute unless the user selects the checkbox to launch your application
make sure the event is the first one in the Published Events list so it gets executed before the event that launches your application
There are a couple of articles to help you with other details:
How to launch a CMD or BAT file?
How to launch a file after an installation?
The main thing you need to consider is to run the event that executes the BAT custom action before the event that launches your application.
Also, I'm not sure you can do this from a Professional project type. You may need Enterprise or Architect.

Related

.NET Windows Form - Interact with a website's filedialog opened from webview2

I'm using webview2 in a .NET Framework Windows Forms application to automatically upload files to a website. The site only supports uploading one file at a time and we often have to upload hundreds of files. I used java script in the webview2 to execute the steps for the upload.
My problem is that to specify the file to upload I have to interact with a file dialog box that's opens on a button click from the website within the webview. I'm currently populating the path of the file to upload in the filedialog using SendKeys, which I think is a poor process.
Is there a way that I can interact with the filedialog that is created from the website through my Windows Forms application? If so how would I get started in figuring out how to do that?
Here's more detail on what I'm currently doing:
In the webview, to begin an upload you have to click a few checkboxes to choose upload options, which has to be done every time, so I run these commands first:
await webview2.ExecuteScriptAsync($"document.getElementById('SelectedTypeId').click();");
await webview2.ExecuteScriptAsync($"document.getElementById('AutoAcceptChkbox').click();");
Then, there's a command to click an upload button, which opens a file dialog:
await webview2.ExecuteScriptAsync($"document.getElementById('uploadFile').click();");
From here, I get the filedialog and use SendKeys.Send("Filepath to file") and SendKeys.Send("{ENTER}") to populate the file path and select the file.
Once the filedialog closes I have an additonal command to click the import button to begin the import.
The issue I have is with the filedialog. It's obviously not a great process to use SendKeys to populate the path to the file. Also, I have to make the application "wait" around the sendkeys actions so that the filedialog has time to come up and close out before moving forward, I'm betting at some point there will be errors if the application isn't waiting long enough.

Write logs to reach text box with serilog extensions

I saw this extension to Serilog that proides writing logs to text box on WinForms..
https://github.com/umairsyed613/Serilog.Sinks.WinForms
What I did not understand, is how I decide on the textbox that I want to write to.
Or there is another step to do that I didn't noticed?
I had the same issue. Here are the steps to use it:
download the library "Install-Package Serilog.Sinks.WinForms" or use NuGet. I used VS2019 package manager console to install mine.
This part i missed and it took me a while to get. You need to add "SeriLog Control" from the toolbox menu. So search toolbox menu and add the gidLog1 control.
Configure your logger (i did mine in the Form load event.)
Log.Logger = new LoggerConfiguration()
.WriteToGridView()
.CreateLogger();
Perform/trigger a log action, you can add to you form load event too eg. below.
Log.Information("Application Started");

Check_mk event triggered

I am using checK_mk 1.2.6p12 version I want to trigger an event on arrival of certain messages of crictical state.
But I am unable to find where to put my shell script so that it performs actions if something goes down.
please help me out am stuck on it.In my Global Settings no error console options is showing.
Not sure 1.2 is the same, maybe it helps for 1.4 version or you already solved it.
Go to Event Console, click in Settings.
Create an Action, and choose in the "Type of Action" choose "Execute via Shell Script" and write your own script.
Create a Rule Pack.
Create a Rule with "Match syslog priority" option to CRITICAL.
Send an event and see if it trigger your Action.

How to disable the "Confirmation" dialog when generating reports using script in PowerDesigner

I have a script to generate report which is invoked from the command line: "C:\Program Files\SAP\PowerDesigner 16\PdShell16.exe" -X pd-gen-reports.vbs
The report.GenerateHtml function shows a dialog with prompt "Do you want to open it with the default application now" after successfully generating the HTML report and I have to manually click the "No" button.
Is there a way to disable this dialog so the script can be executed in automated build process without human interactions?

How to make .exe file programmatically set to run as admin always in vista?

I have written a winform application in C#. When I run the program for some functionality it required admin permission. After Installation If I set the .exe file to run as admin manually (by clicking right mouse button on .exe file) then my program run perfectly.
Now I need user not to set the run as admin property after installation by clicking right mouse button. I need to set this programaticaly somewhere in the code that user no need to bother about this. This specific problem is only arise for Windows Vista. Can anyone help me out?
You need to add a manifest to the app that specifies it require admin privileges. Read more on MSDN.
Update: You can add a manifest to your project by right-clicking on the project and selecting Add / New Item / Application Manifest File. This will add a new file called app.manifest to your project and will reference it from the project properties, in the Manifest dropdown on the Application tab. The default manifest template even has a nice comments on how exactly to change the required UAC execution level.
You need to specify the requestedExecutionLevel in the manifest.
See here for a detailed explanation:
http://petesbloggerama.blogspot.com/2007/04/making-your-assembly-run-as.html

Resources