Powershell ISE Cut&Paste Problem

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 6 months, 2 weeks ago.

  • Author
    Posts
  • #61504
    Profile photo of Peter Marsh
    Peter Marsh
    Participant

    Hello. I know this is a dumb question, but I have encountered an odd problem using the scripting pane in PS ISE. I can see what the problem is, but can't figure out how to fix it within ISE. Here's what happened: I was copying a small test function from Don Jones "Learn Toolmaking in a Month..." and this function fell on two pages. So, copy and paste the first part to a blank script pane, then go back and copy/paste the remaining part, appending it onto the next line in the pane. Ok, but it doesn't work. After much examination, I notice the first curly brace after the function line has a red squiggle that says "missing closing..." Also, the last curly brace for the function has a red squiggle that says "Unexpected Token.." Then I see the only thing different between this script and other ones that work is at the outline view next to the line numbers. In the other scripts that work, these all appear to be connected vertically, but in the script where I had to import the code in two blocks, the outline view is broken, and not connected. I tried everything I could think of to get them to connect, but it's almost like the ISE considers these two code blocks to be separate entities. So to test this hypothesis, I cut and pasted both blocks of code to a blank word document, then copied the entire block to a new script pane, and it did work. So.... how does one make ISE treat multiple lines of code as one input? Peter.

  • #61539
    Profile photo of Don Jones
    Don Jones
    Keymaster

    There was very likely an illegal, invisible character stuck in there causing your problem.

You must be logged in to reply to this topic.