Jump to content

Interaction with Desktop when not logged in


Recommended Posts

Hello all,

I tried to automate some of my standard work that will takes a while to complete. The end point is I would like to compile a .CHM file at the end of the script.

To do this, i need to use Microsoft Excel, Microsoft Word and a CHM compiler.

The script is complete (well almost, but now i have a big issue)..

The logic:

It checks on a certain Inbox folder for an excel file. Once found, it start up the Excel and run its VBA script to convert the information from incoming excel file into a new created Microsoft word file. Once done, AutoIT script, will close the excel file and start the CHM Compiler, enter the required parameter and compile the Word document into CHM. Once done, clean up the inbox folder and wait for another excel file.

The script works flawlessly when I am "watching" it. However, I want to run this without anyone logging in and as you can see, it's heavily "desktop interactive" and it failed when no user is logging into the system.

How do you suggest the workaround for this?

thanks a bunch.

Link to comment
Share on other sites

I've seen other people on this forum say that scripts requiring GUI interaction need a user to be logged on. Maybe someone else knows more, but the only "workaround" might be to have the computer logged on always.

Alex

Link to comment
Share on other sites

I've seen other people on this forum say that scripts requiring GUI interaction need a user to be logged on. Maybe someone else knows more, but the only "workaround" might be to have the computer logged on always.

Alex

Thanks Alex.

I tried to logged in as a user and then leave the workstation as "locked". That did not seem to work either.

i'm studying the script right now and make changes from WinWaitActive to just WinWait; perhaps that would work better.

I will come back if that solves my issue here.

Link to comment
Share on other sites

Do you mean you want it to work on the welcome screen? If so then I don't think there is a way to do it without doing a lot of fiddling with windows.... :D

else, try looking at running the script as a service, http://www.autoitscript.com/forum/index.php?showtopic=17581 has one by ptrex. this allows you to log out + log in and the script will still be running.

check it out, it has a neat example that will probably explain it better than i can.

MDiesel

Link to comment
Share on other sites

Do you mean you want it to work on the welcome screen? If so then I don't think there is a way to do it without doing a lot of fiddling with windows.... :D

else, try looking at running the script as a service, http://www.autoitscript.com/forum/index.php?showtopic=17581 has one by ptrex. this allows you to log out + log in and the script will still be running.

check it out, it has a neat example that will probably explain it better than i can.

MDiesel

I sort of run through that once and probably it would be a nice "upgrade" at later stage. But even running as a service, can it run interactively in Desktop?

But as of right now, even when there is user logged in but has the workstation as "locked" - that script (or the compiled version) still failed to run.

Link to comment
Share on other sites

More details on the problem:

1. run excel file with macro in it

2. a "Security window" appear asking you to enable or disable macro

3. Autoit, should send a "Alt-E" button, which means Enable macro

step (3), failed if the workstation is "locked".

Here's the part of the script that run this

CODE
ShellExecute($excelScriptfile)

WinWait("Security Warning")

If Not WinActive("Security Warning") Then WinActivate("Security Warning")

WinActivate("Security Warning")

Send("{tab}")

send("{Enter}")

I even tried to "Winactivate" twice, but once you're workstation is "locked" although there is user logged in, the script won't press the "Enable macro" button.

I can "sign" the macro and make it save, but this is not the only "button" that I need to press in the script.

Ideas?

Edited by poundesville
Link to comment
Share on other sites

have you looked at the excel udf? Also I'm not sure about having the system locked, but maybe controlsend would work instead of send?

excel udf is not helping for this particular problem (but it has potential for other uses later on). The UDFs allows me to open, save, save as the excel file; but not clicking on the 'button'.

The controlsend seems to be a good idea, but it can only send a "text" string. I tried to send {tab} and {enter} but that didn't work. What's worse, there are not that many "information" on this Security Warning Control. The only thing I can capture is the class name and the handle.

it's got to be a way to do this. i've google this for the past few days, but probably I search the wrong keyword.

Link to comment
Share on other sites

As with many UDFs you don't really press a button, you mimic the function that is called when the button is pressed. I don't know which function it is here in particular but there is many documentation available on the subject.

As far as ControlSend, you don't send {tab} and {enter} commands to it, because ControlSend sends text to a control as opposed to a window. Seeing as you are sending tab and enter, you probably want to click on the Done button or similar. Use ControlClick for that purpose.

Link to comment
Share on other sites

As with many UDFs you don't really press a button, you mimic the function that is called when the button is pressed. I don't know which function it is here in particular but there is many documentation available on the subject.

As far as ControlSend, you don't send {tab} and {enter} commands to it, because ControlSend sends text to a control as opposed to a window. Seeing as you are sending tab and enter, you probably want to click on the Done button or similar. Use ControlClick for that purpose.

I am beginning to become more and more discomfort here.

Bear with me guys -- controlclick won't work here, since, i can't just click it. I need to change the active button from "disable macros" to "enable macros" before I can send the controlclick.

What's worse, the "Security warning" window here does not have much "Windows Info"; it only has the class name and handle information. That is all.

Link to comment
Share on other sites

I am beginning to become more and more discomfort here.

Bear with me guys -- controlclick won't work here, since, i can't just click it. I need to change the active button from "disable macros" to "enable macros" before I can send the controlclick.

What's worse, the "Security warning" window here does not have much "Windows Info"; it only has the class name and handle information. That is all.

Manadar,

There's another tiny ray of hope with the UDF on GuiButtonmanagement, will try some that makes sense later. But the UDF on excel does not have any that connects to mimick-ing click of a button. It mostly work with Files, Workbooks, and Worksheets.

I get around to do all that from excel, by creating the VBA script directly in excel.

So, Autoit, just need to open that Excel with VBA.

Remember: my biggest problem here is: how do i make autoit to interact with desktop when the workstation is locked out. This allows me to run the whole conversation process from Excel -> to Words -> to CHM without any interaction from me.

So, even if we pass through the security window problem in Excel, there are other buttons to press (but they may have better Windows Info, so I might be successful using ControlClick there)

Link to comment
Share on other sites

Found this

When a NT/2K/XP system is locked, the console windowstation "winsta0" no longer has its "default" desktop associated with the keyboard, mouse & monitor. Instead, there is some other secured desktop [i forget the exact name of it] that is associated with the keyboard, monitor & mouse. IIRC, when a different desktop other than "default" is being used, functions like WinWaitExist() and WinExist() only see the names of windows that are on the same desktop as the script that is calling those functions.

here:

http://techsupt.winbatch.com/TS/T000001048F24.html

this dash all my hopes. I need to change all the scripting so that it requires no clicking or no keyboard send.

This is troubling me now. ControlClick or ControlSend won't work.

but at least, i know what the "enemy" is and can focus on that.

Link to comment
Share on other sites

Found this

here:

http://techsupt.winbatch.com/TS/T000001048F24.html

this dash all my hopes. I need to change all the scripting so that it requires no clicking or no keyboard send.

This is troubling me now. ControlClick or ControlSend won't work.

but at least, i know what the "enemy" is and can focus on that.

"clean up" my script and now , there are no buttons to click, no text to send. It works fine when workstation is locked but user is in there.

Next move: make it run as a service , without any user logged in.

Meantime -- thread is closed.

Thanks everyone.

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...