chobo2
chobo2

Reputation: 85845

Possible to use Powershell to select options from a gui?

I have to convert a manual build process to an automated build process. I am going through the process and have identified a couple areas that I am sure how to approach.

I am new to powershell so I can't really say off the bat if something can be done or not.

I have this vb6 form that pops up. It has a couple tabs and some dropdown lists, text fields and buttons.

A user would manually choose a choice from the dropdown list and fill in certain text fields and then hit a button to save.

Is it possible to still have this application run with the dialog appearing and then somehow have powershell fill out the required fields and then do a save?

I am sort of thinking maybe something like how in jquery for instance you could select fields by ids and then fill values into them.

If this is not possible would the application need to be modified to accept arguments in and then it would use it populate the values?

Or do I have to extract the code out that does it and somehow convert it(something I do not really want to do as I really don't understand fully how the application works) to powershell?

Upvotes: 0

Views: 3149

Answers (1)

Angshuman Agarwal
Angshuman Agarwal

Reputation: 4866

You have 2 choices -

  1. Automate your VB6 UI using Powershell like this - http://msdn.microsoft.com/en-us/magazine/cc163301.aspx

  2. Rewrite everything using Powershell including the GUI - http://blogs.technet.com/b/csps/archive/2011/12/07/guiapp.aspx

[UPDATE on Link 1]:

I downloaded the code provided in MSDN and ran it. It just works ! Here I will explain -

  1. I Unzipped the code in a location - F:\Angshuman\Code\PowershellUIAutomation\TestRun
  2. 2 folders are there - CustomUICmdletsLIb and TheAppToTest
  3. Remove readonly from all the .sln and .cs files first
  4. Open . the respective solutions and build
  5. Launch Windows Powershell (x86) [if you are on 64-bit]
  6. Open up the tow ps1 scrips - Microsoft.PowerShell_profile.ps1 and testScenario.ps1
  7. Make this change in the Microsoft*.ps1 script - i.e. the prper path to the DLL

    sl 'F:\Angshuman\Code\PowershellUIAutomation\TestRun\CustomUICmdletsLib\bin\Debug'

    set-location F:\Angshuman\Code\PowershellUIAutomation\TestRun

and execute it

  1. Make this change in the testScenario script - i.e. the path

invoke-item

'F:\Angshuman\Code\PowershellUIAutomation\TestRun\TheAppToTest\bin\Debug\TheAppToTest.exe'

Now execute the script. You will be prompted with a UI with full automation is display.

Hope this helps and you should be now able to achieve the same with your VB6 UI

Upvotes: 1

Related Questions