Results 1 to 2 of 2
  1. #1
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts

    Works correctly in ISE miscalculates in CMD Window?

    Hey Y'all,

    Here's one that's had me scratching the ole noggin' for the last 5 hours!

    I've got a script to Move windows around the screen(s) (I'm using identical dual screens).

    When run from the PowerShell ISE it works as it should. Both as regular user and as admin.

    But when run from a Shortcut or directly using the PS Command Window it gets the first window positioned correctly but then moves both of the remaining two off to the right.

    I've tried this with 2 different Move Functions I found on the web and they both exhibit the same behavior.

    Here are all the files in a zip: WrongPositionFiles.zip

    Set-WorkEnv-V4.ps1 goes with the function file Function-Set-WindowsSizePosition.ps1. This version will open the programs if they aren't already opened and is the one I've been messing with.

    Set-WorkEnv-V5A.ps1 goes with the function file Set-Window.ps1 which is just as I've downloaded it from the web so when testing this you have to have the program windows you're testing on already open.

    I can't understand why the same code would operate differently in this situation.

    Thanks for reading and hopefully testing!

    PS: If you want to see how it should work you can check out this post which was run from the ISE before I discovered this problem.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Hey Y'all,

    Ok I think I solved this you can view the quite lengthy post about it here.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

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