Results 1 to 4 of 4
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Extend my Windows Desktop (VBScript)

    > you will need to replace the percent with the symbol of the same (since the lounge parser doesn't like it)

    HTML interprets % followed by a hexadecimal number as a character code. We have a <!t>[%]<!/t> tag especially for that reason. For example, <!t>[%]<!/t>E becomes %E when posted.

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Extend my Windows Desktop (VBScript)

    <P ID="edit" class=small>(Edited by Andrew Lockton on 06-Jul-06 21:51. Hans gave me clue to fix the symbol issue in the script)</P>I have created a vbscript to toggle between running a second monitor as a clone / as an extended desktop. Does anyone know of a way to replicate the same behaviour without the clunkiness of SendKeys?
    <pre>Dim WshShell
    Set WshShell = CreateObject("WScript.Shell")
    With WshShell
    .Run "C:WindowsSystem32control.exe desk.cpl,@0,3"
    WScript.sleep 1000 'wait for 1 second
    .SendKeys "2" 'moves selection to second monitor
    .SendKeys "%E" 'toggles the extend desktop setting
    WScript.sleep 1000 'wait for 1 second
    .SendKeys "{ENTER}" 'apply setting and close dialog
    End With</pre>

    Note you will NOW NOT need to replace the percent with the symbol of the same (since Hans has corrected me)
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Extend my Windows Desktop (VBScript)

    It might be possible to use the ChangeDisplaySettingsEx API function and the dmPosition member of the DEVMODE structure, but that's far beyond me.

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extend my Windows Desktop (VBScript)

    No idea if it will achieve what you're after, but AutoIt v3 - Automate and Script Windows Tasks - For <img src=/S/free.gif border=0 alt=free width=30 height=15>! "boasts"
    AutoIt "uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys)."

    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •