Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Interaction with Desktop when not logged in


  • Please log in to reply
13 replies to this topic

#1 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 03:49 PM

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.







#2 alexf

alexf

    Seeker

  • Active Members
  • 11 posts

Posted 23 March 2009 - 03:52 PM

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

#3 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 04:16 PM

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.

#4 Mat

Mat

    43 38 48 31 30 4E 34 4F 32

  • MVPs
  • 4,823 posts

Posted 23 March 2009 - 04:16 PM

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

{4d696768-744e-6f74-4265-556e69717565}

AutoIt Project Listing

#5 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 04:46 PM

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.

#6 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 05:03 PM

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, 23 March 2009 - 05:04 PM.


#7 youknowwho4eva

youknowwho4eva

    Giggity Giggity Goo

  • Active Members
  • PipPipPipPipPipPip
  • 710 posts

Posted 23 March 2009 - 05:15 PM

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?
Giggity

#8 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 06:13 PM

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.

#9 Manadar

Manadar

         

  • MVPs
  • 10,723 posts

Posted 23 March 2009 - 06:29 PM

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.

#10 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 06:46 PM

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.

#11 youknowwho4eva

youknowwho4eva

    Giggity Giggity Goo

  • Active Members
  • PipPipPipPipPipPip
  • 710 posts

Posted 23 March 2009 - 06:51 PM

What if you set your excel not to ask? Either by setting your security to low, or adding the Macros to the trusted list.
Giggity

#12 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 06:52 PM

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)

#13 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 08:29 PM

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.

#14 poundesville

poundesville

    Seeker

  • Active Members
  • 13 posts

Posted 23 March 2009 - 10:40 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users