Solved

Automated Workaround for programs lacking Switches

Posted on 2010-11-29
11
350 Views
Last Modified: 2012-05-10
I have a windows program that lacks the ability to send agrument to the exe file on launch.
Is there a way around this?
Like a program that create a path of your mouse clicks to perform once the program is opened.
0
Comment
Question by:swedishmotors
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 11

Accepted Solution

by:
TheGorby earned 500 total points
ID: 34231306
AutoIT is perfect for this; the help file that comes with it is pretty in-depth but I'd be glad to give you some help with setting up a script:

http://www.autoitscript.com/autoit3/index.shtml
0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34257391
Here is a screen cast of what I have so far.

Launch program, wait for the window I want to be active.

I cannot figure out how to select the list view item I want and select the "Process button"

I can do it using mouse click locations, but I am setting this up for many different user on different PC's so the position of the window is not always the same.  I need to use ControlListView to find the item.  Then ControlClick to click the Process button.

Could you advise?
swedishmotors-375639.flv
0
 
LVL 11

Expert Comment

by:TheGorby
ID: 34257430
Could you post your actual code? Also I am unable to view the video, if necessary could you post screen shots instead? Or a YouTube link would work I could view that.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 11

Expert Comment

by:TheGorby
ID: 34257492
Nevermind, I'm suddenly able to see the video. Delete line 6 of your code, and replace it with what I've posted below. This will display a message box with the index number needed for the "Select" command.
$result=ControlListView("Service Writer Login","","ListView20WndClass1","FindItem","ADAM")

Msgbox(0,"Result",$result)

Open in new window

0
 
LVL 11

Expert Comment

by:TheGorby
ID: 34257573
In fact, you could use this in the final script; all that needs to be added at the end is the ControlClick function for the Process button.
Run("C:\ACR\PROG\BMX.exe /LIVE")

WinWaitActive("Service Writer Login")

$result=ControlListView("Service Writer Login","","ListView20WndClass1","FindItem","ADAM")

ControlListView("Service Writer Login","","ListView20WndClass1","Select",$result)

Open in new window

0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34257708
My code so far, and the result.

Does not seem to be selecting the list view item.  Also can you double check the controlclick code?

Thank you! swedishmotors-375660.flv
Run("C:\ACR\PROG\BMX.exe /LIVE")

WinWaitActive("Service Writer Login")

$result=ControlListView("Service Writer Login","","ListView20WndClass1","FindItem","JOSH")
Msgbox(0,"Result",$result)
 

ControlListView("Service Writer Login","","ListView20WndClass1","Select",$result)
 
ControlClick ( "Service Writer Login", "", 3 , "left" , 1 , 8 , 240)

Open in new window

0
 
LVL 11

Expert Comment

by:TheGorby
ID: 34257841
We need to find out the exact text to look for on the list, 'JOSH' wasn't found and that's why the message box had a -1 in it. The code below will give you the name of each item on the list, as AutoIT sees it. The names that it gives you is the exact text to use for the 'FindItem' command.
Run("C:\ACR\PROG\BMX.exe /LIVE")  
  
WinWaitActive("Service Writer Login")  
  
$loop=0
While $loop<7
	$name=ControlListView("Service Writer Login","","ListView20WndClass1","GetText",$loop)
	MsgBox(0,"Item " & $loop+1 & " of 7","The text for item " & $loop+1 & " (index " & $loop & ") on the list is: " & $name)
	$loop=$loop+1
WEnd

Open in new window

0
 
LVL 11

Expert Comment

by:TheGorby
ID: 34257871
Your ControlClick function should be more like this:
ControlClick("Service Writer Login","","ThunderRT6CommandButton2")

Open in new window

0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34258864
Looks like the problem is there is no text.  The program contains lots of poor programming practices...

I guess I need to select it by the item it is on the list.

Name1
Name2
Name3
Name4

If I want to select item 3 in the list "Name3" is this possible?

I believe I use:
ControlListView ( "title", "text", controlID, "command" [, option1 [, option2]] )
so:
ControlListView ( "Service Writer Login", "", ListView20WndClass1, select, 3, "" )
I'm not sure how to send the argument of the item in the list - 3?

0
 
LVL 11

Expert Comment

by:TheGorby
ID: 34259622
When I saw the way the window looks, I was afraid it might not be programmed in the 'Windows-friendly' way. There's a chance that the ControlListView function may not work at all on it; if that's the case you should be able to use the Send function to send keystrokes to the program.

For ListView controls, the items are numbered sequentially starting with 0. So the 3rd item on the list (from the top) is actually number 2. For AutoIT functions, optional paramters can be left out if they're at the end of the statement so it would look like this:

ControlListView("Service Writer Login", "", "ListView20WndClass1", "Select", 2)

Make sure you include all the quotes as I have them. If that doesn't work and you want to use the Send function, it would be something like this:

Send("{DOWN}")
Send("{DOWN}")
Send("{ENTER}")

Those 3 lines would press the down arrow twice, and then the Enter key. Of course you'll have to figure out exactly what keystrokes are needed. Also, usually you can still use ControlClick even in programs where ControlListView doesn't work.
0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34260534
I really appreciate your help, this has been a great learning experience.
Works awesome!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question