Announcement

Collapse
No announcement yet.

Compiler error

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Compiler error

    I had to reinstall the client software (Speaker/Script/Bluetooth clients) on a Windows 7 client and I get the following error when trying to execute remote_monitor_power.cs

    line:8 error:CS1519 'Invalid token 'using' in class, struct, or interface member declaration'

    I'm running Plugin 1.23.2.4. This was working fine before the reinstall.

    Then I went to my 'everyday' computer where I don't use the script client often, but I get the same error??

    Any ideas?

    The cs file contents look exactly like the version posted here when updating to add ON and OFF parameters.

    #2
    Can you post the script you have on your computer ?
    It looks you have a using statement in the middle of the script Line 8
    --
    stipus

    Comment


      #3
      Here's the script. The error is referring to the #USING command

      Code:
      //If you invoke this script without any parameter, it will turn on the monitor.
      //You can also invoke with the following parameters:
      //- ON
      //- OFF
      //- LOW (low power mode)
      
      
      #USING System.Runtime.InteropServices
      
      [DllImport("user32.dll")]
      public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
      
      void Main( object param )
      {
       IntPtr HWND_BROADCAST = new IntPtr(0xffff);
       uint WM_SYSCOMMAND = 0x0112; 
       int SC_MONITORPOWER = 0xF170; 
      
       // WAIT TO LET DESKTOP SETTLE 
       System.Threading.Thread.Sleep( 500 );
      
       switch( param.ToString().ToUpper() )
       {
        case "ON":
         SendMessage( HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1 );
         break;
        case "OFF":
         SendMessage( HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2 );
         break;
        case "LOW":
         SendMessage( HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 1 );
         break;
        default:
         SendMessage( HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1 );
         break;
       }
      }

      Comment


        #4
        Try to remove everything before the #USING

        --> so that the #USING is on the first line of the script
        --
        stipus

        Comment


          #5
          Well that works.

          Not sure why, as I didn't write the script - it came with the script client. Did MS change parsing rules?

          Either way, it's working now. Thanks for the help!

          Comment

          Working...
          X