Thursday 15 September 2011

Scheduled Powershell task can't interact with browser -


Revised description:

Using the suggestions below, I can create the most basic code that I made Can i Note that I am using the PowerSheer Community Extension with "Start-Up". I do not know if it does affect or not.

I have the following functions

  function populate-notepad {[System.Reflection.Assembly] :: LoadWithPartialName ('Microsoft Visual Basic') Start-process Notepad [ Microsoft. Visualbasic Interaction] :: App activated ("unchecked") [system. Windows: FormSendKeys]: Send Vite ("Blblblah") returns}   

works fine.

I have a function called Pars, which asks a POP account, and if there is a message - take an action, the action in question is as follows ($ helptext is defined and it works properly {$ Text = $ helptext} "note" {populate-notepad} default {$ msg} = $ Msg + "Invalid command: $ command` n "}}

This does not not fire notepad if I look at the task manager, it can never Pop Yulet happens. My guess is that if this can be solved - then the problem below may be.


I have a power script that invokes firefox and fires a bunch of SendKeys on Firefox (this is a long story, but trying to use the web inventions Was problematic.) It works properly, but when a scheduled task runs a power-shell script that calls the above mentioned powerships script ...

Firefox runs ... but this interaction Finance have not (so powershell is running and the script is firing.) In other words, I never do not see Firefox window. I'm not sure whether this is important or not, but there's always a Firefox in my Task Manager window. Exe However, my script always hangs, complains that it can not find the Firefox window.

Like I said, it works interactive; This Task Manager uses the same credentials as a regular interactive script (this box has only 1 user except the administrator); It's not hidden, and I have not tried to "run it with the highest privileges".

Any thoughts?

I had some problems in trying to do something like this, the parsechle script is running in another session / reference (As I've read).

So you can not use it.

My solution was to use this

  (new-object -com wscript.shell). Run ("http: // localhost /", 3)   

This opens a local website, focuses on full screen and default web browser. After this, you can use sendkeys.

As a side-note, if I want to use an app activate, then I will start getting it that this is actually the process that I have started, rather than that.

This will not resolve the problem,

No comments:

Post a Comment