Run a program in citrix window

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
pricey
Newbie
Posts: 1
Joined: Tue Jan 08, 2008 8:00 pm

Run a program in citrix window

Post by pricey » Tue Jan 08, 2008 8:25 pm

Hi,

I am trying to run a program (batch file) located on a w2K server.

The script I have written needs to open the sever as a citrix session and then run the program in the citrix.

Trying to use "run program" or "execute" runs the program on the local machine not in the citrix session. I have set focus onto the citrix window but still cannot get the program to run on the session.

Any ideas much appreciated.

Chers
Chris

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Jan 08, 2008 9:09 pm

Searching on this forum comes up with over 25 results for "citrix"
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 08, 2008 10:13 pm

If Macro Scheduler is running on YOUR machine then "Run Program" will run the program/command/batch file on YOUR machine. If you want it to do something inside a remote session then either it needs to be installed INSIDE the remote session, or you need to automate the session - simulate user input, using it as you would.

E.g. if you wanted to run a command line on the remote session would you click Start/Run on YOUR machine and issue a command, or click on a desktop shortcut on YOUR desktop? No - of course not - that would only have an effect on YOUR desktop. No, you'd click Start/Run or double click the desktop shortcut INSIDE the citrix session.

Setting focus simply sets the keyboard focus. It won't make Run Program know about the remote operating system. Here's how citrix/remote desktop/VNC/Radmin/PC Anywhere/etc/etc work:

1. An image of the remote environment is transmitted across the network and displayed on your screen inside a window.
2. When you move the mouse or press a key inside that window the mouse/keyboard event is detected, a message is sent to the server and the mouse/keyboard event simulated there.

In short we have a copy of the screen and we can send it mouse and keyboard events. That's it.

If you want to automate a remote session you will have to do so by sending mouse/keyboard events to it. You can detect objects using image recognition because you can SEE the remote environment.

But Run Program runs apps on the local machine. All script commands work on the LOCAL machine. The only way to have them work on the remote machine is to have Macro Scheduler installed ON IT.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 08, 2008 10:22 pm

This article demonstrates a way to automate a Citrix session reliably:
http://www.mjtnet.com/blog/2007/02/20/h ... cognition/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
AntoniusMomac
Junior Coder
Posts: 20
Joined: Fri Dec 07, 2007 7:46 am
Location: New York City, NY

Post by AntoniusMomac » Mon Jan 14, 2008 12:19 am

The only way to have them work on the remote machine is to have Macro Scheduler installed ON IT.



So if you had a script which was developed on a local machine using commands such as WaitWindow, MouseOver or SetFocus; You would need to have MS loaded on the Citrix server and launch the script from the server. Is that correct?
Love Simple!! "Simplicity means the achievement of maximum effect with minimum means" - Dr. Koichi Kawana, Architect, designed the botanical gardens

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Jan 14, 2008 12:35 am

Yes, except if you compiled the script. Then you would only need to have the executable installed and run from there, a copy of Macro Scheduler on that machine would not be needed.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jan 14, 2008 2:10 pm

AntoniusMomac wrote:So if you had a script which was developed on a local machine using commands such as WaitWindow, MouseOver or SetFocus; You would need to have MS loaded on the Citrix server and launch the script from the server. Is that correct?
Yes, if those commands want to act against the windows INSIDE the Citrix session. If they are acting on the local Citrix client window then they could run locally. But I'm guessing you want the former.

Remember:

Code: Select all

**********      Screen Images             ***********
YOUR PC       <------------------------            Citrix
Runs Citrix                                               Session
Client            ------------------------->
                       Key/Mouse Events         
**********                                         ***********
Your PC receives screen shots of the remote PC. Your PC sends mouse/keyboard events to the remote PC.

All we know about is screen pictures.

We don't know about window titles, objects, operating system functions. For all we care the remote operating system could be Linux.

So Macro Scheduler running on your PC cannot know about objects and other items inside the Citrix session except in terms of images. Hence Screen Image Recognition being so useful for automating remote environments. But if you want to know about the detail of processes inside the remote environment you need to BE inside the remote environment.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts