Jump to content

Run applications silently in background


Recommended Posts

Hello Team, Greetings!

Is there any way to run any 3rd party application silently in background without the GUI getting in the front ?

I was implementing angry-ip scanner with autoit & wanted the angry-ip application to run in background quietly as I am copying its output to other file on completion. is there any way to achieve my query?

Below is code I tried: 

$range = "192.168.0.1 192.168.0.255"
ShellExecuteWait("C:\Windows\DDM\ipscan.exe","-f:range "&$iprange&" -q -o C:\temp\ScanResults.csv","","open",@SW_HIDE)

Thanks!

Link to comment
Share on other sites

When I do not want to see a window but I don't want it to be minimized or hidden, I simply move the window outside screen like this :

WinMove("Title or hWnd here", "", -2000, -2000)

The good think with this approach is that you can easily access the window to read/write info to it...

Link to comment
Share on other sites

32 minutes ago, Nine said:

When I do not want to see a window but I don't want it to be minimized or hidden, I simply move the window outside screen like this :

WinMove("Title or hWnd here", "", -2000, -2000)

The good think with this approach is that you can easily access the window to read/write info to it...

I can try this. Thanks!

Link to comment
Share on other sites

@Iraj:

$pid = "ipscan.exe"
$range = "192.168.0.1 192.168.0.255"
ShellExecute("C:\Windows\DDM\"&$pid,"-f:range "&$iprange&" -q -o C:\temp\ScanResults.csv","","open")
Sleep(100)
_SETPid($pid, @SW_HIDE)

Func _SETPid($pid, $STATE)
    $wins = WinList()
    For $i = 1 To UBound($wins) - 1
        If BitAND(WinGetState($wins[$i][1]), 8) And ProcessList($pid)[1][1] <> 0 Then
            WinSetState($wins[$i][1], "", $STATE)
        EndIf
    Next
EndFunc   ;==>_SETPid

 

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
Share on other sites

22 hours ago, Nine said:

When I do not want to see a window but I don't want it to be minimized or hidden, I simply move the window outside screen like this :

WinMove("Title or hWnd here", "", -2000, -2000)

The good think with this approach is that you can easily access the window to read/write info to it...

It didn’t work out. The window stayed on the screen until its task got completed 

Link to comment
Share on other sites

21 hours ago, ad777 said:

@Iraj:

$pid = "ipscan.exe"
$range = "192.168.0.1 192.168.0.255"
ShellExecute("C:\Windows\DDM\"&$pid,"-f:range "&$iprange&" -q -o C:\temp\ScanResults.csv","","open")
Sleep(100)
_SETPid($pid, @SW_HIDE)

Func _SETPid($pid, $STATE)
    $wins = WinList()
    For $i = 1 To UBound($wins) - 1
        If BitAND(WinGetState($wins[$i][1]), 8) And ProcessList($pid)[1][1] <> 0 Then
            WinSetState($wins[$i][1], "", $STATE)
        EndIf
    Next
EndFunc   ;==>_SETPid

 

It didn’t workout either. The window stayed on until process got completed 

Link to comment
Share on other sites

2 minutes ago, Iraj said:

It didn’t work out. The window stayed on the screen until its task got completed

You cannot use the ShellExecuteWait !!!  You need to use Run (my preference) or ShellExecute.

You should have add some error handling, you would have noticed that the WinMove was failing ;)

Link to comment
Share on other sites

  • 9 months later...

Due to running any executable (including but not limited to AutoIT) app in background I am using the following trick. Create vbs file
 

Quote

 

Set ws = CreateObject("Wscript.Shell")

ws.run "cmd /c C:\Windows\DDM\ipscan.exe input-param",vbhide

 

and then run that vbs file instead of the exe file.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...