Jump to content

Remote computer not running send keystrokes or mousemove


Recommended Posts

I have a computer in another location, unattended (windows 7). The only way that computer is accessed is through Remote Desktop Connection.

I setup a code on that computer which runs flawlessly when I am connected remotely.

#include <IE.au3>
;open IE
Local $oIE = _IECreate("https://fake-site.com",0,1,0)
sleep (5000)
;input login information
Send ("username")
send ("{TAB}")
send("password")
send ("{ENTER}")
Sleep(1000)
; more code here including mousemove

I exit the remote - not log out, just close the connection. The computer is still logged on with the same user, but not sure in what state it acctually remains - that causes the code not to execute completely.

The code is scheduled to run at certain time during the night.

All it does is it opens the web site, but doesn't input user and password... or anythingelse.

I suspect it's because monitor turns off during the night ?!?!?!

And if this is the problem, is there a way around it? (w/o changing power options on the computer - don't have admin rights)

Link to comment
Share on other sites

This link should give you the information you're asking about. When not remoted into the computer, it's not logged in so you can't use Send.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

This is a snippet of something similar that I did. I run this in a hidden IE window. There are some variables that I defined earlier.

Make sure to get and include IE.au3

 

You will need to get the html form "names" from the site you are using.

 

$oIE.navigate("https://www.sample.com/?pg=login")

    _IELoadWait($oIE)

    $oForm = _IEFormGetObjByName ($oIE, "form1")
    $oQuery1 = _IEFormElementGetObjByName($oForm, "Username")
    $oQuery2 = _IEFormElementGetObjByName($oForm, "Password")

    $oSubmit = _IEGetObjByName($oIE,"Login")

    _IEFormElementSetValue ($oQuery1, $accountnum)
    _IEFormElementSetValue ($oQuery2, $accountpass[1])

    _IEAction($oSubmit,"click")

    _IELoadWait($oIE)

    $oIE.navigate("https://www.sample.com/?pg=it")

    _IELoadWait($oIE)
Link to comment
Share on other sites

Thanks, That was my original aproach, but I stumbled into an issue I couldn't resolve.

It seams that on that computer (from some security option or something), nothing _IE related works besides _IECreate.

Not even _IEQuit... which is very annoying.

If you have a quick answer to this other issue, I would be very gratefull:

A simple code like this doesn't work... Just opens the link and it stops.

#include <IE.au3>
Local $oIE = _IECreate("https://fake-site.com",0,1,0)
_IEQuit($oIE)
Link to comment
Share on other sites

You need to perform logging, so you can actually see if:

A) the _IEQuit fails

B) the script is deadlocked, and the _IEQuit never initiates

B (aka the shades guy :)) can occur  sometimes if your window opens a dialog.

Good to log the output of _IECreate as well.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...