Sign in to follow this  
Followers 0
HollyN

WinActivate Citrix Published App window

12 posts in this topic

I have a published app in Citrix that brings up a login screen for the user. Unfortunately it's not coming up with focus. I thought it would be easy to fix that with AutoIt, but it isn't working. Here is my script:

$WinName="JD Edwards EnterpriseOne Login - \\Remote"

WinWait($WinName)

WinActivate($WinName)

It appears to think it's working because the script completes and AutoIt exits. I even double-checked that with a WinWaitActive at the end to be sure. But I still have to click in the window to enter my password.

Here is my AutoIt Window Info Summary. Any help would be appreciated.

>>>> Window <<<<

Title: JD Edwards EnterpriseOne Login - \\Remote

Class: Transparent Windows Client

Position: 436, 296

Size: 452, 473

Style: 0x96000000

ExStyle: 0x00010105

Handle: 0x00B4088A

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x00230C50

Share this post


Link to post
Share on other sites



Citrix application run in a seemless window. That means you can't see the 'terminal server' desktop you work in, but it's certainly there.

There is actually no application, only the seemless desktop. So you can't detect anything in it.

Try pressing <shift> + <F2> then you'll see the desktop surrounding the application.


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

Thanks for the information - you certainly put me on the right track. At first I tried using the name of the hidden Desktop window in the user workstation, but that didn't work. So instead, I transferred my original script to run on the server side before the application launches and it worked perfectly!

Thanks.

Holly

Share this post


Link to post
Share on other sites

Mmmh,

if the settings in citrix for your application is set to Work as "Published Application" you can use all Window (Winactivate,....)

related commands.

If you get with Au3Info:

>>>> Window <<<<

Title: JD Edwards EnterpriseOne Login - \\Remote

Class: Transparent Windows Client

Position: 436, 296

Size: 452, 473

..

it seems to be a "Published Apllication" otherwise you would get only the name of the "Citrix-Desktop".

Here some code how I start an app with login and how to start Excel (as Citrix Published App).

best regards, Reinhard

#region StartNew

func KSNewSessionstart()  
    Run('"C:\Programme\Citrix\ICA Client\pnagent.exe" /QLaunch "Konsis"')
    $i = 0
    Do
        sleep(1000)
        if $i = 30 then
            $OK = MsgBox(1,"KS-Helper","Wait on Logon Window?")
            if $OK = 2 then exitloop
        EndIf
        $okDe = WinActive("Anmeldung - \\Remote")
        $okEn = WinActive("Login - \\Remote")
        $ok = $okDe + $okEn 
        $i += 1 
        if $ok > 0 then 
            if $KSTextLG = 1 then WinActivate("Anmeldung - \\Remote")
                        if $KSTextLG = 0 then WinActivate("Login - \\Remote")
            send("{Enter}") ;=>password deleted
            WinWait($KSWinTitleTop,"",30)
            Winactivate($KSWinTitleTop)
            WinWaitActive($KSWinTitleTop,"",30)
        endif   
    Until $ok > 0
EndFunc;;-> KSNewSessionstart   

func XLSNewSessionstart()
    Run('"C:\Programme\Citrix\ICA Client\pnagent.exe" /QLaunch "Citrix Excel"')
    $i = 0
    Do
        $ok = WinWait($XlsWinTitleTop,"",10)
        $ok = Winactivate($XlsWinTitleTop)
        $ok = WinWaitActive($XlsWinTitleTop,"",2)
    Until $ok > 0
EndFunc;;-> KSNewSessionstart

Share this post


Link to post
Share on other sites

Mmmh,

if the settings in citrix for your application is set to Work as "Published Application" you can use all Window (Winactivate,....)

related commands.

That's true indeed. The seemless app will send the recieved commands/send()'s to the app in the server.

Nice script, simple but effective. Certainly could be a help to some.

Note though that with that script you have to have the pnagent installed, not only the webclient and such.


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

... Note though that with that script you have to have the pnagent installed, not only the webclient and such.

Oh,

thought that would be standard.

Thanks for clarification,

Reinhard

Share this post


Link to post
Share on other sites

Well, I personally only work with the webclient, but that depends on you situation.

You can see what client the script uses and in what path: "C:\Programme\Citrix\ICA Client\pnagent.exe".

(note the 'Programme' directory, that would be best replaced by '@ProgramFilesDir' to avoid language issue's)


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

I am trying to get to the published application using an .ica file, rather than the client.

I am writing sign-on scripts to send credentials for two different published applications that appear to be configured in Citrix the same way. They each use .ica files, and each of those files seems to be configured the same. For each application, the user is prompted for network credentials first.

For one of the published applications, the network credential prompt launches with focus, and the other it does not. For the prompt that launches with focus, AutoIT has no trouble seeing the window, and the script works fine - passing credentials as expected.

For the prompt that launches without focus, the window comes to the front, but the title bar is gray. I have been unable to get AutoIT to recognize that the window is there at all - until I click the window and the title bar turns blue. I have tried winactivate using title and handle.

When that didn't work, I tried to it manually.

This is what happens: When the ica file is launched, two "Citrix" windows appear in the taskbar - one that says "Log On to Windows - \\Remote" (which is the network credential prompt), and one that says "Starting syngo Workflow Production - \\Remote" (syngo Workflow is the published application).

**Even if I click "Log On to Windows" from the task bar, the window comes to the front, but does not actually have focus (the title bar stays gray). I actually have to click in the window itself for it to get focus.

Then I tried going to Task Manager, choosing the "Log On to Windows" item and clicking "Switch To". This resulted in the same behavior.

Other than clicking the window (that AutoIT can't see yet), the only way I am able to get focus to that window is to use Alt-Tab (twice).

I would like to avoid using send to emulate the alt-tab. Does anyone have any suggestions about other options?

I have tried to attach screenshots of the window, taskbar and autoIT info output.

This is the last code I tried that didn't work:

$myNetworkUsername="User"
$myNetworkPassword="Password"
$networkLoginWindow = "Log On to Windows - \\Remote"
$myExe = "wfica32.exe"

$myProcess = ProcessWait($myExe)
If $myProcess = 1 Then
     sleep(2000)
     WinActivate($networkLoginWindow)
EndIf
if WinWaitActive($networkLoginWindow,"",30) = 1 Then
     send($myNetworkUsername)
     send("{TAB}")
     send($myNetworkPassword)
     send("{enter}")
EndIf

Thanks!

Mmmh,

if the settings in citrix for your application is set to Work as "Published Application" you can use all Window (Winactivate,....)

related commands.

If you get with Au3Info:

>>>> Window <<<<

Title: JD Edwards EnterpriseOne Login - \\Remote

Class: Transparent Windows Client

Position: 436, 296

Size: 452, 473

..

it seems to be a "Published Apllication" otherwise you would get only the name of the "Citrix-Desktop".

Here some code how I start an app with login and how to start Excel (as Citrix Published App).

best regards, Reinhard

post-30359-1244211561_thumb.jpg

post-30359-1244211684_thumb.jpg

post-30359-1244211752_thumb.jpg

Share this post


Link to post
Share on other sites

Very odd that the ica file starts two applications, and above all, starts the syngo without having to login. :s

I would publish the application anew and see what happes manually. Looks like there is something wrong with the ica file or the published applications.

I can't happen that without logging in an application starts.


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

Very odd that the ica file starts two applications, and above all, starts the syngo without having to login. :s

I would publish the application anew and see what happes manually. Looks like there is something wrong with the ica file or the published applications.

I can't happen that without logging in an application starts.

I think I didn't do a good job of explaining myself.

There are two separate ica files.

In each case, the user is prompted for network credentials. Also in each case, the user is prompted for application credentials - after the network credentials have been entered successfully.

The issue is that for *one* of the applications (Syngo), the network prompt displays on top, but does not really have focus (title bar is gray rather than blue), and while it is gray, there doesn't seem to be a way to "see" the window to populate the username/password fields, or to even activate the window.

At this point, I am unable to control the published app (so I can't re-publish it). I'm going to see if The Google has anything to say about .ica clients and focus.

Thanks,

-Michael

Share this post


Link to post
Share on other sites

Ok, Now I think I understand your problem.

However I still think this is kinda a citrix-server side issue. As the apps really work in a hidden desktop AutoIt can't touch the application itself.

So the hidden desktop may have focus, the application still does not have to.

The only AutoIt solutions I can think of are alt-tabbing until it's focused or pixelsearch a certain line of pixels and then AutoItted-mouseclick that spot.

There are probably much better AutoIt solutions out there, but I ain't so good yet :D


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

Hi Holly,

I know this post is 5 years old.I hope you are still active member.

Could you please let us know what do you mean by:

but that didn't work. So instead, I transferred my original script to run on the server side before the application launches and it worked perfectly!

 

We need to pass username and password to open window from citrix but it's not working.

$myNetworkUsername="SHELLdev"

$myNetworkPassword="xxxxxxxxxxxx"
$networkLoginWindow = "Service Center - Windows Internet Explorer - Remote"
$myExe = "wfica32.exe"
_FileWriteLog($hFile, "resource launched") ;
$myProcess = ProcessWait($myExe)
 
_FileWriteLog($hFile, $myProcess) ;
 
If $myProcess = 1 Then
     sleep(2000)
     WinActivate($networkLoginWindow)
  EndIf
_FileWriteLog($hFile, "window activated") ;
if WinWaitActive($networkLoginWindow,"",30) = 1 Then
     send($myNetworkUsername)
_FileWriteLog($hFile, $myNetworkUsername) ;
     send("{TAB}")
     send($myNetworkPassword)
     send("{enter}")
EndIf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0