Command to put results of View System Windows into Variables

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Command to put results of View System Windows into Variables

Post by pgriffin » Mon Aug 01, 2005 12:21 am

I am constantly (and slowly...) looking at View Systems Windows to find the class names and instances of the controls on a screen. Then I have to manually code each SetControlText, PushButton, etc....with all the details and (doublecheck for correct instance, class name, etc ...)

I have toyed with a bit of code to read all these for me, but it would be VERY nice to have a command/function in MSched to name a window, then have all the controls, their current values, instance numbers, etc... in variable names....

SkunkWorks

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Execellent Idea

Post by kpassaur » Sun Aug 13, 2006 9:42 pm

I go through the same, I have a utilty that I wrote where I put the Window name in and the Control name and let it run and it puts out a text file for review. However, it sure would be nice if there was a command that ran through everything like view system windows and showed what control text name and instance was.

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Nov 03, 2006 7:56 am

Hi kpassaur and SkunkWorks,

I noticed that in the v9 beta, in the Command Builder, if you click on a function like GetActiveWindow>, it lists titles of all windows currently open in the dropdown and you can just pick one i.e. you don't have to type it manually. I suppose that's a little bit of what you're asking for but certainly not all...
kpassaur wrote:I go through the same, I have a utility that I wrote where I put the Window name in and the Control name and let it run and it puts out a text file for review.

kpassaur, would that utility be written in Macro Scheduler? If so, would you be willing to post it here? If not, please post an example of a text file it wrote and we can see what you're looking for.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Utiliy in MS for Class and Instance

Post by kpassaur » Thu Apr 05, 2007 12:12 pm

Just saw this posting when looking for something else. Here is the code to determine class and instance that I use

Let>APP_TITLE=Test Class and Instance Utility

Dialog>Dialog1
Caption=Test Class and Instance Utility
Width=370
Height=363
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label=Test Capture Class and Instance Utility,94,59,true
Label=Enter Window Name,135,83,true
Label=Enter the Class Name,131,131,true
Label=(Leave Blank if using Drop Down),105,147,true
Image=C:\CaptureTesting\eDocFileBAckground2.bmp,0,0,361,57
Label=Copyright© eDocFile Inc. 2004-2005,98,307,true
Label=Test to Instance Number,159,220,true
Edit=Windowname,112,99,145,
Button=Exit,152,275,65,25,2
ComboBox=msComboBox1,112,187,145,Edit%CRLF%Tedit%CRLF%ComboBox%CRLF%Static%CRLF%RichEdit20WPT
Edit=WindowClass,112,163,145,
Button=Continue,88,275,65,25,1
Button=Help,216,275,65,25,3
Edit=InstanceNumber,112,216,41,
CheckBox=msCheckBox1,Confirm on Each Instance,112,248,177,False
EndDialog>Dialog1





Label>mainscreen
Show>Dialog1,r
If>r=2,EXIT
If>r=3,openhelp
If>r=1,RMacro
Goto>mainscreen

SRT>openhelp
ExecuteFile>C:\CaptureTesting\eshelp.pdf
End>openhelp

Label>RMacro
Let>IN=%Dialog1.InstanceNumber%
Let>Windowname=%Dialog1.Windowname%
Let>WindowClass=%Dialog1.WindowClass%
Len>%WindowClass%,wcp
If>%wcp%>1,classentered
Let>WindowClass=%Dialog1.msComboBox1%
Label>classentered

Len>Windowname,wnl
If>wnl>1,gotwindowname
MDL>No Window Name was Entered%CRLF% the utility will now exit
Goto>EXIT

Label>gotwindowname
Let>basewindowname=%Windowname%
Concat>%Windowname%,*
IfWindowOpen>%Windowname%,windowexixts,Notwindowexixts
Label>Notwindowexixts
MDL>Window %Windowname% Does not exist%CRLF%The Utility Will now Exit
Goto>EXIT
Label>windowexixts
WriteLN>C:\CaptureTesting\testwincapture.txt,The Window Name tested is %basewindowname%
WriteLN>C:\CaptureTesting\testwincapture.txt,The Class tested is %WindowClass%

Let>x=0
Label>Start
Let>x=x+1
If>x=%IN%,EOF
Let>Contents=0
SetFocus>%Windowname%
Wait> .5
GetControlText>%Windowname%,%WindowClass%,%x%,Contents
If>%Contents%=##NOSUCHOBJECT##,tryanotherClass
Len>%Contents%,filled
If>filled>1,writeit
Goto>Start
Label>writeit
If>%Dialog1.msCheckBox1%=True
MDL>The instance is %x% %CRLF%and the contents are %Contents%
Endif
WriteLN>C:\CaptureTesting\testwincapture.txt,,The instance is %x% and the contents are %Contents%
Goto>Start
Label>EOF
ExecuteFile>C:\CaptureTesting\testwincapture.txt
Label>EXIT


SRT>tryanotherClass
MDL>The handle %WindowClass% instance %x% does not exist in %Windowname%
Goto>EXIT
END>tryanotherClass

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sat Apr 07, 2007 4:01 pm

Hi kpassaur,

Thanks for posting that, much appreciated. I didn't have a C:\CaptureTesting\ directory on my PC so the macro failed but creating the directory manually solved that.

I also notice several files tied in with your macro that seem to be related to one or more eDocFile Inc. utilities:

C:\CaptureTesting\eDocFileBAckground2.bmp
C:\CaptureTesting\eshelp.pdf

Which utility/s in particular? Are these files available for download?


Hi Marcus and pgriffin,

Could something like this be integrated into Macro Scheduler? That would be a nice feature to add for Macro Scheduler's upcoming 10 year anniversary.

Any chance you can tell us about some of the things under development? I would almost be willing to pay to have the "Wish List" made public, to be able to see what's actually on there.

Any other users out there feel the same way?

:?: Curious... curious... :?:
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

another utility for screen capture

Post by kpassaur » Sat Apr 07, 2007 4:12 pm

The bmp file just makes it look pretty.

Here is the code for another test utility. I also have one for dos appliations if you need that as well.



////////////////This tests to see if you can capture a window
COF
Let>APP_TITLE=Test Screen Capture Locations
IfFileExists>C:\CaptureTesting\CaptureResults.txt,dfile
SRT>dfile
DeleteFile>C:\CaptureTesting\CaptureResults.txt
End>dfile

WriteLn>C:\CaptureTesting\CaptureResults.txt,result,Capture Test Results%CRLF%%CRLF%%CRLF%

Let>w=
Dialog>Dialog1
Caption=Test Window Compatibility
Width=370
Height=226
Top=CENTER
Left=CENTER
Max=1
Min=1
Close=1
Resize=1
Image=C:\CaptureTesting\eDocFileBAckground3.bmp,0,0,361,49
Label=This utility will find the Screen Location of the Data to be Captured ,28,70,true
Label=and generate a report with its results. This data can be entered,40,85,true
Label=Copyright© eDocFile Inc. 2004-2005,101,172,true
Image=,0,0,105,105
Label=into the setup of eDocFile Programs,101,100,true
Image=C:\CaptureTesting\CaptureScreenLocation.bmp,153,5,201,25
Button=Exit,149,141,75,26,2
Button=Help,222,141,75,26,3
Button=Continue,76,141,75,26,1
EndDialog>Dialog1



Dialog>Dialog3
Caption=Capture the Field
Width=228
Height=151
Top=CENTER
Left=CENTER
Label=Place the Mouse over the Right side of ,16,8,true
Label=DO NOT click on the Window,41,70,true
Label=Press Enter to Continue,56,88,true
Label=where the data begins,59,24,true
Label=Once over the Location Press Enter,27,48,true
Button=Button1,0,0,0,0,1
EndDialog>Dialog3

Dialog>Dialog2
Caption=Capture the Field
Width=224
Height=149
Top=CENTER
Left=CENTER
Label=Place the Mouse over the left side of ,24,8,true
Label=DO NOT click on the Window,41,70,true
Label=Press Enter to Continue,56,88,true
Label=where the data begins,59,24,true
Label=Once over the Location Press Enter,27,48,true
Button=Button1,0,0,0,0,1
EndDialog>Dialog2

Label>MainMenu
Show>Dialog1,r
If>r=1,Beginroutine
If>r=3,Helpbox1
If>r=2,EOF
Goto>MainMenu



Label>Beginroutine
PutClipBoard>
Input>w,Please enter the Window to be Captured,%w%
IfWindowOpen>%w%*,GoodWindowname
MDL>The Window %w% is not available
Goto>Beginroutine
Label>GoodWindowname
SetFocus>%w%*
Ask>Do you want to Capture the Data from the left ?,side
If>%side%=NO,startright,startleft
SRT>startleft
Waittime=0.1
SetFocus>%w%*
Wait> .5

Label>MainLoop
Show>Dialog2,result
If>result=2,End
If>result=1,Position
Goto>MainLoop

Label>Position
GetWindowPos>%w%*,X,Y
GetCursorPos>X1,Y1
Let>Width=%X1%-%X%
Let>Height=%Y1%-%y%
SetFocus>%w%*
Wait> 0.1
GetWindowPos>%w%*,npX,npY
Add>npX,%Width%
Add>npY,%Height%
MouseMove>npX,npY
Wait> 0.1
LDown
LUp
Wait> 0.1
Press Shift
Press End
Wait> 0.1
Release Shift
Wait> 0.1
Press CTRL
Wait> 0.1
Send c
Wait> 0.1
Release CTRL
Wait> 0.1
GetClipBoard>Scraped
Let>captureside=Left
END>startleft

SRT>startright
Waittime=0.1
SetFocus>%w%*
Wait> .5

Label>MainLoop
Show>Dialog3,result
If>result=2,End
If>result=1,Position2
Goto>MainLoop

Label>Position2
GetWindowPos>%w%*,X,Y
GetCursorPos>X1,Y1
Let>Width=%X1%-%X%
Let>Height=%Y1%-%y%
SetFocus>%w%*
Wait> 0.1
GetWindowPos>%w%*,npX,npY
Add>npX,%Width%
Add>npY,%Height%
MouseMove>npX,npY
Wait> 0.1
LDown
LUp
Wait> 0.1
Press Shift
Press Home
Wait> 0.1
Release Shift
Wait> 0.1
Press CTRL
Wait> 0.1
Send c
Wait> 0.1
Release CTRL
Wait> 0.1
GetClipBoard>Scraped
Let>captureside=Right
End>startright



MDL>Window Name %w%%CRLF%Data Captured from %captureside%%CRLF%X Position is %Width%%CRLF%Y Position is %Height%%CRLF%Value Captuted is %Scraped%
WriteLn>C:\CaptureTesting\CaptureResults.txt,result,Window Name %w%%CRLF%Data Captured from %captureside%%CRLF%X Position is %Width%%CRLF%Y Position is %Height%%CRLF%Value Captuted is %Scraped%%CRLF%%CRLF%%CRLF%

Ask>Do you want to try to capture another location ?,continue
If>%continue%=YES,Beginroutine,End


/////////////////////////////Begining of Help/////////////////
SRT>Helpbox1
Dialog>Dialog9
Caption=Help
Width=449
Height=250
Top=CENTER
Left=CENTER
Button=Close,176,168,75,25,1
Memo=Helptxt,8,8,417,145,The utility will prompt for the following:%CRLF%%CRLF%1) The Name of the window that contains the data to be captured.%CRLF%The Name is case sensitive and needs to be unique. For instance, in Outlook%CRLF%for a Contact enter "- Contact", as the first part of the Window changes%CRLF%with each contact.%CRLF%%CRLF%2) Should the data be captured left to right or right to left. (try left to%CRLF%Right first.%CRLF%%CRLF%3) The location of the Data. Move the cursor to the left side of the of the data%CRLF%to be captured (if left capture was selected) WITHOUT CLICKING ON THE SREEN
EndDialog>Dialog9


Label>DisplayHelp
Show>Dialog9,Result
If>result=1,firstscreen
If>result=2,EOF
Goto>DisplayHelp
Label>firstscreen
GoTo>MainMenu

End>Helpbox1
//////////////////////////End Help Section////////////////////////////

Label>End
Ask>Do you want to create a report of your results,DR
If>%DR%=NO,EOF
ExecuteFile>C:\CaptureTesting\CaptureResults.txt
Label>EOF

7buicks
Newbie
Posts: 3
Joined: Mon Mar 24, 2008 2:29 am
Location: Iowa USA

Post by 7buicks » Tue Mar 25, 2008 5:02 pm

I think that my "Wish List Item" is more simple, since what I want is for Runtime, of the macro. That puts all open window titles into automatically numbered variables, ex. vWinTitle1...vWinTitle2 ect., with already available Status variables, that gives the Window Status of each Window Title captured to the variables, ex. vWinStat3=Restore.

Then a subroutine can be run to establish what all the Open Window statues were at the initiation time of the macro, and then be set Back to their original status at exit of the macro. Such a process would then be able to add Elegance to the macro that ran, because any window manipulation during the macro and/or status change or active window changed, would seem almost seamless to the user. In other words, despite the macro ran, All the windows were put BACK, including, which one was active, before the macro ran.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts