Jump to content

Application installation when running AutoIt as a Service


wellknown
 Share

Recommended Posts

I have tried to configure an AutoIt script to run as a Windows service to

install application in the background automatically. But I found that AutoIt

script cannot detect the presence of the application's GUI or the GUI cannot

be output when starting from a service. May be it can work if the service is

allowed to interact with the active desktop. But this is not what I want as there

is no guarantee there is a logged on user. Also, it is no good to interfere with

the current logged on user. Any suggestion or workaround? Thank you.

Link to comment
Share on other sites

Dear Volly,

Actually I am using xyNTservice to start a batch program as a service and use

the batch program to run a simple AutoIt script to test whether it can interact

with other GUI program for installation. The testing script is trying to invoke a

notepad.exe, type some words on it and saving it as a file. The script is :

Opt("WinTitleMatchMode", 2)

Run("notepad.exe test.txt")

WinWaitActive("Notepad")

Send("This is some text.")

sleep(3000)

WinClose("Notepad")

WinWaitActive("Notepad")

Send("!y")

It can work if the batch program is configured to interact with UserInterface in xyNTservice

when a user is logged on. For other cases (no user is logged on or the batch program is

configured not to interact with UserInterface in xyNTservice), it won't work and the testing

script seems not able to detect the presence of the Notepad window and keeps waiting

forever. Thank you.

Link to comment
Share on other sites

when no user is logged in, no explorer.exe is loaded, meaning no userprofile, so nothing to interact with.

this doesn't mean that you can't let a script run as system service, you just have to make it a silent script that doesn't do any gui interactions..

(you can access the filesystem, registry, ..)

forget your simple notepad script. write a script using fileopen() and filewriteline() etc. to create a textfile,

then schedule it using taskscheduler (standard in windows since ages). since this is allways launched using the NT Authority system account, everything it launches will launch as system service(logic I hope). this has one cool advantage.. write a script that waits for let's say 10 minutes using sleep()

make sure you see the script running (active window not hidden) then schedule it using taskscheduler, when it is launched, log out, and log back in.. the script will still be running..

I hope this helps you a bit in user profile interaction

Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...