Jump to content
Macro Express Forums

Getting simulated key strokes working in windows 7 on 64 bit system


Recommended Posts

I want to launch a macro every morning that opens the screen resolution page under Control Panel\Appearance and Personalization\Display\Screen Resolution.

Then I want it to "detect" the screen resolution. Then close the page.

 

The macro opens the screen resolution window.

It waits until the window is fully displayed.

Then I send these simulated key strokes.

Alt d to highlight the address

Tab Tab to move the focus to the detect button

Alt c to hit the detect button.

Then wait for it to do a detect.

Then alt f4 to close the window.

 

However, the macro breaks down when I start sending keystrokes to the window. When I actually do keystrokes it works fine. However, when ME Pro sends the window keystrokes something different happens or nothing happens at all.

 

Any settings I need to set up in ME or Windows 7 that will help this to happen?

 

Here is my macro

<MOVE MOUSE TO TRAY ICON Icon="UltraMon" Exact="TRUE" Center="TRUE"/>

<MOUSE LEFT DOUBLE CLICK/>

<WAIT FOR WINDOW TITLE Title="Screen Resolution" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="10"/>

<DELAY Flags="\x01" Time="10"/>

<WINDOW ACTIVATE Title="Screen Resolution" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>

<GET CONTROL Flags="1" Program_Name="EXPLORER.EXE" Class="CabinetWClass" Title="Screen Resolution" Control="\"WorkerW\",\"2\",\"ReBarWindow32\",\"1\",\"Address Band Root\",\"3\",\"msctls_progress32\",\"1\",\"Breadcrumb Parent\",\"1\",\"ToolbarWindow32\",\"1\"" Variable="%C1%" Caption="Screen Resolution" Partial="FALSE" Wildcards="FALSE"/>

<MOUSE CLICK ON CONTROL Clicks="\x01" Control="%C1%" Button="\x00" Center="TRUE"/>

<TEXT TYPE Action="1" Text="<TAB><TAB>"/>

<DELAY Flags="\x02" Time="500"/>

<TEXT TYPE Action="1" Text="<ALTD>c<ALTU>"/>

Link to comment
Share on other sites

I want to launch a macro every morning that opens the screen resolution page under Control Panel\Appearance and Personalization\Display\Screen Resolution.

Then I want it to "detect" the screen resolution. Then close the page.

 

The macro opens the screen resolution window.

It waits until the window is fully displayed.

Then I send these simulated key strokes.

Alt d to highlight the address

Tab Tab to move the focus to the detect button

Alt c to hit the detect button.

Then wait for it to do a detect.

Then alt f4 to close the window.

 

However, the macro breaks down when I start sending keystrokes to the window. When I actually do keystrokes it works fine. However, when ME Pro sends the window keystrokes something different happens or nothing happens at all.

 

Any settings I need to set up in ME or Windows 7 that will help this to happen?

 

Here is my macro...

I've spotted a couple of problems with your macro!

1) Get Control won't work because the index settings will change from run to run.

2) Alt-C won't work because there's no underlined c in Detect (at least, not on my machine).

 

So try this - it works perfectly for me:

Move Mouse to Tray Icon to UltraMon
Mouse Left Double Click
Wait for Window Title: Screen Resolution
Delay: 2 seconds
Window Activate: Screen Resolution
Text Type (Simulate Keystrokes): <SHIFT><TAB><SHIFT><TAB><ENTER>

 

<MOVE MOUSE TO TRAY ICON Icon="UltraMon" Exact="TRUE" Center="TRUE"/>
<MOUSE LEFT DOUBLE CLICK/>
<WAIT FOR WINDOW TITLE Title="Screen Resolution" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="10"/>
<DELAY Flags="\x01" Time="2"/>
<WINDOW ACTIVATE Title="Screen Resolution" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<TEXT TYPE Action="0" Text="<SHIFT><TAB><SHIFT><TAB><ENTER>"/>

Link to comment
Share on other sites

I am not sure why you need to do this, but I am sure you have a good reason!

 

The code can be greatly simplified:

 

Program Launch: "control.exe" (Normal)

Parameters: desk.cpl,1,4

Wait for Window Title: Resolution

Text Type (Simulate Keystrokes): <ALT>c

 

<PROGRAM LAUNCH Path="C:\\Windows\\System32\\control.exe" Mode="\x00" Parameters="desk.cpl,1,4" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/>
<WAIT FOR WINDOW TITLE Title="Resolution" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="5"/>
<TEXT TYPE Action="0" Text="<ALT>c"/>

 

But I think rberg nailed it with his very elegant solution.

Link to comment
Share on other sites

I am not sure why you need to do this, but I am sure you have a good reason!

 

The code can be greatly simplified:

 

Program Launch: "control.exe" (Normal)

Parameters: desk.cpl,1,4

Wait for Window Title: Resolution

Text Type (Simulate Keystrokes): <ALT>c

 

<PROGRAM LAUNCH Path="C:\\Windows\\System32\\control.exe" Mode="\x00" Parameters="desk.cpl,1,4" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/>
<WAIT FOR WINDOW TITLE Title="Resolution" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="5"/>
<TEXT TYPE Action="0" Text="<ALT>c"/>

 

But I think rberg nailed it with his very elegant solution!

Link to comment
Share on other sites

Take a look at command

Variable Set Interger [set Value from Screen Width] and

Variable Set Interger [set Value from Screen Height]

With respect, these 2 MEP commands simply interrogate the display and set 2 variables with the current width and height; thsy have no impact at all on what the operating system sees.

 

I don't really know what the Detect button does that Windows hasn't already been able to do for itself, but I imagine that under some circumstances, the Detect button might cause the displayed resolution to change if Windows has somehow become confused. If anything does change as a result of clicking Detect, then I imagine those changes will affect the entire operating system.

Link to comment
Share on other sites

... these 2 MEP commands simply interrogate the display and set 2 variables with the current width and height; they have no impact at all on what the operating system sees.

The question was, to find out what the current settings are, not to have an impact on (i.e., change) the current settings. When I have used those two commands, the numbers returned always match what is shown by Properties | Settings | Screen Resolution. Maybe I'm missing something and I've just been lucky that it works in my situation?????

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...