I just connected my TV to my Laptop. The ATI card has a setting in the Control Panel to output stuff either to the LCD screen or the TV.

ATI conveniently included a hotkey feature for changing settings, but it only works for going to LCD. When I go to TV, there is a confirmation dialog box with "No" as default. And using the hotkey it just goes past this dialog with "No, I don't want to change setting". Doing it manually works of course.

So, I used Perl and Win32::GuiTest to do it manually, only automatically :)

This is very specific to the particular thing I do here, but the general approach could possibly be useful to someone.

  1. Create a shortcut of the Display icon in the Control Panel
  2. Put the code below in enable-s-video.pl
  3. Create a shortcut of the Perl script and put it in the Start Menu. Assign a hotkey (Ctrl-Shift-Alt-T for TV) and select Run-as-minimized.

#!/usr/bin/perl -w #enable-s-video.pl use strict; use Win32::GuiTest qw(FindWindowLike GetWindowText GetForegroundWindow + SetForegroundWindow SendKeys); sub waitForSeconds { select(undef, undef, undef, $_[0]); } system("start ControlPanel-Display"); waitForSeconds(0.3); my ($hwindDisplay) = FindWindowLike(0, "^Display Properties", ""); $hwindDisplay or die("Could not open Control Panel - Display\n"); SetForegroundWindow($hwindDisplay); #Settings Tab SendKeys("^+{TAB}"); #Advanced Button SendKeys("%v"); #Dusplays Tab SendKeys("^{TAB}") for(1..5); #Move to the bottom of the Scheme combobox SendKeys("{DOWN}") for(1..10); #OK Button SendKeys("{ENTER}"); #Leave it time to change mode waitForSeconds(1); #Did we change the settings? Then we need to confirm the dialog box. SendKeys("{TAB}{SPACEBAR}") if(GetWindowText(GetForegroundWindow()) =~ + /^ATI Property Page/); #Close dialog SetForegroundWindow($hwindDisplay); SendKeys("{ENTER}"); __END__

/J


In reply to Enable S-Video output by jplindstrom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.