Announcement

Collapse
No announcement yet.

Remote Script Requests and Help

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

    Originally Posted by lunkan
    Want to send keystrokes to another program not focused. Can this be done with script connector? Its' for iTunes.
    oops! sent you an pm and had not submit the reply
    Code:
    If ProcessExists("itunes.exe") Then
     ControlSend ( "iTunes", "", "iTunesThumbnailView1", "{RIGHT}" )
    EndIf
    Code:
    If ProcessExists("itunes.exe") Then
     $iTunesApp = ObjCreate("iTunes.Application")
    $iTunesApp.PlayPause
    EndIf

    Comment


      I'm 100% certain you don't really need autoit. The Script Connector *should* be able to do everything auto-it does, but the right syntax might be more complex.


      For example your code

      Code:
      If ProcessExists("itunes.exe") Then
       $iTunesApp = ObjCreate("iTunes.Application")
      $iTunesApp.PlayPause
      EndIf
      Can be rewritten with the VB.NET syntax as

      Code:
      ...
      If Process.GetProcessesByName( "itunes" ).Length > 0 Then
        Dim t as Type = Type.GetTypeFromProgID("iTunes.Application")
        Dim o as Object = Activator.CreateInstance( t )
        o.PlayPause()
      End If 
      ...
      It's the same for the autoit ControlSend() API. You could replace this with a FindWindowEx() function call, and PostMessage() calls.
      --
      stipus

      Comment


        launch opera

        Im trying to launch opera in front of my netremote screen and have not been successful. But I did get firefox to launch. Though is popping under the netremote full screen display. Firefox would be OK but I still need it to pop on top of the netremote screen. Oh - and I'm using the remote_activateapp.cs script.
        John

        Comment


          I think Opera is a Java application, isn't it ?

          Do you know what is the process name when it's running ? Is it the same name as the .exe file ?

          Also if the netremote window is set to full screen, I'm not sure if I can activate another window on top ...
          --
          stipus

          Comment


            Originally posted by stipus View Post
            I think Opera is a Java application, isn't it ?(
            Its a browser???? I like it because it will shape the web page to fit my airpanels (10") so I do not have to scroll left and right.

            Do you know what is the process name when it's running ? Is it the same name as the .exe file ?
            Yes....though I actually can have multiple instances of Opera because I am running the xp hack for 3 user logins. If that matters?

            Also if the netremote window is set to full screen, I'm not sure if I can activate another window on top ...
            It has an option to stay on top which I turned off. I have to play with this a little longer to see whats really happening.
            John

            Comment


              The pop under happens on both netremote and hS Touch. I was hoping I could launch a browser from either app to pop over the top and then when done web browsng I could shut it down and be returned to the touch screen interface. I tried to combine this with restarting netremote which gave the desired effect - browser pops under - netremote shuts down leaving browser - netremote pops onder and is available when browser is closed. But.....then I ran into another problem. I have three concurret users running. Two airpanels and one touch screen. The restart of the netremote can apply to one of the other users and not to the touchscreen I am on. That may be why I thought Opera was not launching, it was launching on different user touchscreen. Oh well....
              John

              Comment


                A while ago I asked for a similar routine.

                The one I have is VERY Specific, But I will post it.

                It opens an IE session to a specific site (my driveway Web cam). If the session is already open it brings it to the top.

                I use the remote script with the following command

                Exec remote script Remote_ie2.cs on computer * Param: http://192.168.0.5/user/cgi-bin/view_S_t_uF.thtml

                and then Remote_ie2 looks like:
                #USING System.Diagnostics
                #USING System.Runtime.InteropServices
                [DllImport("user32.dll", SetLastError = true)]
                static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
                [DllImport("user32.dll")]
                [return: MarshalAs(UnmanagedType.Bool)]
                static extern bool SetForegroundWindow(IntPtr hWnd);
                void Main( object param )
                {
                IntPtr hWnd = FindWindow(null,"Bellwoods1 (VGA) TOSHIBA Network Camera - IK-WB15A. - Windows Internet Explorer");
                if( hWnd == IntPtr.Zero )
                {
                ProcessStartInfo processStartInfo = new ProcessStartInfo();
                processStartInfo.FileName = "IEXPLORE.EXE";
                processStartInfo.Arguments = param.ToString();
                processStartInfo.WindowStyle = ProcessWindowStyle.Maximized;
                Process.Start( processStartInfo );
                }
                else
                {
                SetForegroundWindow( hWnd );
                }
                }
                The line with "Find Window" is the one that is very specific...if you misspell it, it will continue to open a new windows each time it is called. Not a problem if you close it each time. I was having trouble with " " vs " " in the title. (They are different, believe me) I was away from this station for a while and came back to a desktop FULL of sessions... locked up the station but good... the camera flaked out as well with that many session requests...

                As cut-n-past doesn't always work I have included it as an attachement.

                good luck !
                Attached Files

                Comment


                  Help to convert from autoit

                  Hi Stipus!
                  Need some help
                  how to code this in scriptconnector? see this
                  Code:
                  If ProcessExists("spotify.exe") Then
                  ControlSend( "Spotify", "", "", "^{RIGHT}" )
                  EndIf
                  Code:
                  If ProcessExists("spotify.exe") Then
                  ControlSend( "Spotify", "", "", "^{LEFT}" )
                  sleep (500)
                  ControlSend( "Spotify", "", "", "^{LEFT}" )
                  EndIf
                  Last edited by lunkan; September 20, 2009, 05:24 AM.

                  Comment


                    Please check the Script Gallery thread. There is a user contributed vb script to send any key sequence to an application.
                    --
                    stipus

                    Comment


                      thisthis
                      Code:
                      ' This script simulate key pressed on the computer running it
                      ' This simulation is a keyboard simulation that send keys to Windows OS
                      ' This does not send keys to a specific window or process
                      ' Keys must be  send in a string to subroutine Main()
                      Last edited by lunkan; September 20, 2009, 06:54 AM.

                      Comment


                        Totally off the wall reply here, not having read the whole thread... but if you want to script some stuff to direct keystrokes easily to any window do a google for scriptit...

                        D
                        ---------------------------------------------------http://weather.penicuik.org

                        Comment


                          yes I have google around but it doesn't help me. I must learning more about vb or .cs scripting. Will do that (when I had time).

                          Comment


                            I had a quick look on google, and it looks difficult to send keystrokes to an inactive window.

                            One possible way would be to find the window, then use the SendMessage Windows API to send WM_KEYDOWN and WM_KEYUP messages.
                            --
                            stipus

                            Comment


                              Guys

                              I know this is not "integral" to your solution, but ScriptIT handles this kinda stuff so easily...

                              http://technet.microsoft.com/en-us/l.../cc723493.aspx

                              "ScriptIt can be configured to differentiate (and respond appropriately) between multiple windows that have the same title bar but different instructional text."
                              ---------------------------------------------------http://weather.penicuik.org

                              Comment


                                In the source code of Spotifyremote

                                Comment

                                Working...
                                X