Sign in to follow this  
Followers 0
weezypenguin

Help PLZ...

3 posts in this topic

I am just wondering if you could help at all with a situation I find myself in..

So the situation is this...

I need to create a script which runs a particular document/application.

It then captures a series of keystrokes.

And finally to kill the process/service that is running the document in step 1.

My problem is that this has to run whilst the machine is unattended. Preferably logged off.

The application i am trying to run is a scannng application, BUT to set it up unattended i still need to press the scan button.

And i am running into the problem that if the machine is logged off the keybaord does not work...

How could I do this with your application..

I really appreciate your help with this.

Share this post


Link to post
Share on other sites



Ok i am some way there after looking through the orum board.

I cam acroos this script (sorry forgot where so i cannot credit anyone in particular)

just wondered if anyone out there with experience of the application and scripting can help me out...

_UserLogonDlg ()

Func _UserLogonDlg ($sTitle = "", $sPrompt = "", $sDefUser = "", $sDefPassWord = "", $sDefDomain = "", $nConfirm = 1, $nDomain = 1, $nRet = 0, $hParent = 0)

Local $hGUI, $hBtn[2], $hInp[4]

If @OSVersion <> "WIN_2003" And @OSVersion <> "WIN_XP" And @OSVersion <> "WIN_2000" Then Return SetError(2, 0, 0); OS not compatible

If $sTitle = "" Then $sTitle = "Logon..."

If $sPrompt = "" Then $sPrompt = "Please enter a valid user name and password."

If $nRet < 0 Or $nRet > 1 Then $nRet = 0

If $sDefUser = -1 Then $sDefUser = @UserName

If $sDefDomain = -1 Then $sDefDomain = @LogonDomain

If $nConfirm <> 1 Then

$nConfirm = 22

Else

$nConfirm = 0

EndIf

If $nDomain <> 1 Then $nConfirm += 22

$hGUI = GuiCreate($sTitle, 326, 134 - $nConfirm, -1, -1, -1, -1, $hParent)

$hInp[0] = GuiCtrlCreateInput($sDefUser, 74, 24, 250, 20, -1, -1)

$hInp[1] = GuiCtrlCreateInput($sDefPassWord, 74, 46, 250, 20, 32, -1)

$hInp[2] = GuiCtrlCreateInput($sDefPassWord, 74, 68, 250, 20, 32, -1)

If $nConfirm <> 0 Then GUICtrlSetState (-1, 32)

$hInp[3] = GuiCtrlCreateInput($sDefDomain, 74, 90 - $nConfirm, 250, 20, 32, -1)

If $nDomain <> 1 Then GUICtrlSetState (-1, 32)

GuiCtrlCreateLabel($sPrompt, 2, 2, 400, 20, -1, -1)

GuiCtrlCreateLabel("User Name: ", 2, 26, 70, 20, 2, -1)

GuiCtrlCreateLabel("Password: ", 2, 48, 70, 20, 2, -1)

GuiCtrlCreateLabel("Confirm: ", 2, 70, 70, 20, 2, -1)

If $nConfirm <> 0 Then GUICtrlSetState (-1, 32)

GuiCtrlCreateLabel("Domain: ", 2, 92 - $nConfirm, 70, 20, 2, -1)

If $nDomain <> 1 Then GUICtrlSetState (-1, 32)

$hBtn[1] = GuiCtrlCreateButton("Cancel", 160, 112 - $nConfirm, 80, 20)

$hBtn[0] = GuiCtrlCreateButton("OK", 245, 112 - $nConfirm, 80, 20)

GuiSetState()

While 1

Switch GUIGetMsg ()

Case -3

ExitLoop

Case $hBtn[1]

ExitLoop

Case $hBtn[0]

If GUICtrlRead ($hInp[0]) = "rrr" Then ContinueLoop 1 + 0 * MsgBox (48, "Error", "Invalid Username." & @CRLF & "User cannot be blank.")

If Not (_UserIsValid (GUICtrlRead ($hInp[0]))) Then ContinueLoop 1 + 0 * MsgBox (48, "Error.", "Invalid Username." & @CRLF & _

GUICtrlRead ($hInp[0]) & " is not a valid username.")

If Not (GUICtrlRead ($hInp[1]) == GUICtrlRead ($hInp[2])) Then ContinueLoop 1 + 0 * MsgBox (48, "Error", "Invalid Password." & @CRLF & _

"Passwords do not match.")

If Not (_UserPasswordIsValid (GUICtrlRead ($hInp[0]), GUICtrlRead ($hInp[2]), ".", "")) Then ContinueLoop 1 + 0 * MsgBox (48, _

"Error", "Invalid Password." & @CRLF & "Password is not valid.")

If $nRet = 1 Then Return 1

_UserLogInToOtherDirect (GUICtrlRead ($hInp[0]), GUICtrlRead ($hInp[3]), GUICtrlRead ($hInp[2]))

EndSwitch

WEnd

Return 0

EndFunc ; ==> _UserLogonDlg

i need to be able to hard code in the user name, password and domain.

So when the executable runs it will just log straight in to the system.

sorry to beg, but can someone please, please help me out...

Many Thanks

logon.au3

Share this post


Link to post
Share on other sites

Hi.

1st of all: It's essential to choose a topic line describes your problem:

"Help PLZ ..." is NOT descriptive at all >_<

I need to create a script which runs a particular document/application.

It then captures a series of keystrokes.

And finally to kill the process/service that is running the document in step 1.

My problem is that this has to run whilst the machine is unattended. Preferably logged off.

If a Windows WS is logged off, there are NO keystrokes, you could catch with autoit.

If your intention is to create a keylogger: That's the #1 of the "Not-to-be-asked" questions in this forums here!

Perhaps you want to SEND keystrokes to an application?

The application i am trying to run is a scannng application,

What scanning application is that exactly? Why has it to run in logged off status? <suspect!>

... BUT to set it up unattended i still need to press the scan button.

Without logon your app won't have a GUI. No clue, if this is a situation, you could press a button, that physically doesn't exist? Maybe someone else want's to jump in here?

And i am running into the problem that if the machine is logged off the keybaord does not work...

WAD (Working as designed)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
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
Sign in to follow this  
Followers 0