Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


SendKey Issue. Thank you.

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,35709
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> SendKey Issue. Thank you.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 SendKey Issue. Thank you. - 6/22/2006 7:53:25 PM   
  racerrunner

 

Posts: 6
Score: 0
Joined: 6/21/2006
Status: offline
is it possible to write a vbscript to automate task ?
WHat i mean is how to record the keystroke.
Can it be done? can someone please guide me?  THank you.

I.E

1.Starts Application,
2.Click on combox,
3.enter date in(dd/mm/yyyy) in a textbox and
4.click on the command button

Thanks

< Message edited by racerrunner -- 6/29/2006 12:56:02 PM >
 
 
Post #: 1
 
 RE: automate task using vbscript? Thank you. - 6/23/2006 12:17:00 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
You can automate a task with VBScript...sort of. There is a method called .Sendkeys that allows this. It is difficult to use and works sporadically at best. The best thing is to find out if the application exposes an API. If it does then that will allow you to take total control of the app. What application are you trying to automate? You can also check into an automation suite called AutoIt that you can use through VBScript.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to racerrunner)
 
 
Post #: 2
 
 RE: automate task using vbscript? Thank you. - 6/28/2006 4:22:14 PM   
  racerrunner

 

Posts: 6
Score: 0
Joined: 6/21/2006
Status: offline
Thank you ebgreen.  Everyday, I've to clean record from Vantive Peoplesoft 8.20 and the steps are repetition.

Therefore, I intended to write a script to capture the step(keystroke).  However, really have no ideas how to

go about doing that.




(in reply to ebgreen)
 
 
Post #: 3
 
 RE: automate task using vbscript? Thank you. - 6/29/2006 12:10:13 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
Search this site for "Sendkeys" and "AutoIt". You should find plenty to get you started then post back when you have problems.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to racerrunner)
 
 
Post #: 4
 
 RE: automate task using vbscript? Thank you. - 6/29/2006 1:03:13 PM   
  racerrunner

 

Posts: 6
Score: 0
Joined: 6/21/2006
Status: offline
Thank You ebgreen.

I manage to come up with this code

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "vantiv32.exe"
Do Until Success = True
   Success = objShell.AppActivate("vantiv32.exe")
   Wscript.Sleep 1000
Loop

after I execute it, the PeopleSoft CRM System Login screen pop out(ask me for password)


Since normally, i would enter the password, follows by a "tab" and "Enter" keys to log onto the system.  Therefore, I added another piece of code into the script

objShell.sendkeys"p"
objShell.sendkeys"a"
objShell.sendkeys"s"
objShell.sendkeys"s"
objShell.sendkeys"w"
objShell.sendkeys"o"
objShell.sendkeys"r"
objShell.sendkeys"d"
objShell.sendkeys"{TAB}"
objShell.SendKeys "{ENTER}"

For instance, my password is "password".  However, it couldnt work.  I mean the PeopleSoft CRM System Login screen stays where it was, waiting for me to enter the password by hand.  Can anyone please advise.  Thank you.

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: automate task using vbscript? Thank you. - 6/29/2006 4:25:44 PM   
  ehvbs

 

Posts: 2220
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi racerunner,

as ebgreen said, the SendKeys method is reliable. Using AutoIt or a commandline/com
interface to the slave application is a better approach. But sometimes jobs must be done
quick and dirty and one further experiment could consist of adding some "WScript.Sleep"s
to your script as shown in the example for SendKeys in the VBScript Docs.

Good luck - especially if you try to use other strategies to tame vantiv32.exe!

(in reply to racerrunner)
 
 
Post #: 6
 
 RE: automate task using vbscript? Thank you. - 6/29/2006 5:34:32 PM   
  racerrunner

 

Posts: 6
Score: 0
Joined: 6/21/2006
Status: offline
Thank you  ehvbs for your reply.  What does this mean "especially if you try to use other strategies to tame vantiv32.exe!". 

Does that mean it is not possible to automate tasks from Vantive32?

I'm a novice and not really into programming.  Please bear with me.

Thank you

(in reply to ehvbs)
 
 
Post #: 7
 
 RE: automate task using vbscript? Thank you. - 6/29/2006 7:07:10 PM   
  ehvbs

 

Posts: 2220
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi racerunner,

sorry for being not clear. What I meant:

(1) If you look at the SendKeys sample in the VBScript Docs you'll see:

         ...
         set WshShell = WScript.CreateObject("WScript.Shell")
         WshShell.Run "calc"
         WScript.Sleep 100
         WshShell.AppActivate "Calculator"
         WScript.Sleep 100
         WshShell.SendKeys "1{+}"
         WScript.Sleep 500
         ...

      So follow this pattern and sprinkle some WScript.Sleep in your script. If you are
      lucky, it will work.

(2)  If not, follow ebgreen's advice and look at AutoIt. If you are lucky, you'll find
       some sample code in the documentation, that can easily adapted for your problem.

(3)  If AutoIt can't be installed or doesn't work, check the Vantive Docs for

          (a) a commandline interface - can you call it from the commandline like

                  vantive.exe -u racerunner -p password -c CleanRecords

          (b) a COM/Automation interface - can you do something like

                   Dim oVantive : Set oVantive = CreateObject( "PeopleSoft.Vantive.App" )
                   oVantive.doWhatIWant ...

       If you are lucky, you'll find something.

Luck is what a programmer needs in the first place - all knowledge and skill is in vain
if you are out of it - that's why I wished you lots of good luck.


      

(in reply to racerrunner)
 
 
Post #: 8
 
 RE: automate task using vbscript? Thank you. - 6/29/2006 8:02:52 PM   
  racerrunner

 

Posts: 6
Score: 0
Joined: 6/21/2006
Status: offline
Okay.  Thank You ehvbs.

(in reply to ehvbs)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> SendKey Issue. Thank you. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts