Thursday 6 October 2011

Data selection–List of values–speed entry!

Ever had a huge list of tables or programs or something that you wanted to automatically enter into a UBE’s data selection?  I know that I have many times.  Say I run the R9898711 and then want to run the R98403 to create all of the missing tables?  Well, I have a time saving suite for you.

step 1: Run the UBE to create CSV, so it’s easy to get a list of values that you want to enter into data selection.

step 2: use this formulae to create the appropriate “sendkeys” functions:  =+CONCATENATE("objshell.sendkeys """,A3, "~","""")

step 3.  populate column 1 of a spreadsheet with the list of items, and column 2 with the formula above

image

step 4. create a file called “Dataselection.vbs” on your computer and edit that file

step 5. paste in the following header

for B9

set objShell = wscript.createobject("WScript.Shell")

Do until success = True
  Success = objshell.AppActivate("List Of Values")
  'Success = objshell.AppActivate("something.txt - notepad")
  wscript.sleep 1000
Loop

wscript.sleep 100
wscript.echo "Start data pump"
wscript.sleep 100
Success = objshell.AppActivate("List Of Values")
objshell.sendkeys "+{tab}+{tab}"

For XE

set objShell = wscript.createobject("WScript.Shell")

Do until success = True
  Success = objshell.AppActivate("List Of Values")
  wscript.sleep 1000
Loop
wscript.sleep 100

step 6. paste column B from above underneath this header

objshell.sendkeys "F00021~"

objshell.sendkeys "F0010T~"

objshell.sendkeys "F0095~"

objshell.sendkeys "F01161DW~"

step 7.  save the file and get a command window

step 8. run “wscript.exe //e:vbscript Dataselection.vbs”

step 9.  Activeate the data selection, list of values screen that you want to add your values to

step 10.  The script will fire when the window is active and will populate the list!

 

Enjoy!

No comments: