Jump to content

How to navigate fron Xen Desktop to our Local System

Recommended Posts


I tried (using AutoIt) to automate a scenario where i  have to open IE with specific URL on my extranet(Xen Desktop or Citrix ) ,from there i need to download  file and then through WinSCP; I  have to move that file to another location that can be access from my Local system using VMWare.

I did as far as the above step. Now i want to navigate from my extranet to my local desktop system. But i am not able to move  from there.Mouse click is also not working.Please find the below screenshot highlighted in YELLOW.




Share this post

Link to post
Share on other sites

I'm assuming you are running your script from inside the citrix desktop?  if so, that drop down and home are not visible to the client itself.  you would have to have the autoIT script running on your local system to click those.

I have a few scripts that run between Citrix and local systems and I use an .ini file on a network share that is updated when the Citrix desktop script is finished so the local system script knows when to take over.


hmm... I guess I have to have a signature...

Share this post

Link to post
Share on other sites

Yes, Inside citrix desktop I am running the script.can you share the script just for a hint.

Share this post

Link to post
Share on other sites

My Citrix scripts are rather complicated and use too much internal Company stuff to share but here is a quick overview.

Main app is run from local desktop
  Create/update an ini file on a network share to flip a flag to say it needs to run, and identify what to run.
  Launch a specific Published Desktop where I have login scripts enabled, 2 ways to do this.
    1.  Use _IECreate to access your Citrix site then _IE.. stuff to login, and click the one you want
    2.  Use registry to find the one you want and launch via command line.
  Loop, checking every xxx seconds until the .ini flag switches to finished.

Citrix desktop Startup Script  this was the hardest for me to get as it required some admin config to allow
  Read the .ini file on the network share
    if the flag is not set, then exit as this was started for a different reason.
    if the flag IS set then launch the app identfied in the .ini "this way I can use this 1 launcher for many other things"

The actual script
  Perform the actions you want, get any script specific settings needed from the .ini
  once finished, mark the the .ini as finished

Main App picks up again
  You can now, gather log files, or whatever else you need to do, like close or minimize Citrix.



Here is some code on how to launch a Citrix item.  Not sure if it will work in your environment as it was rather complicated to figure out.

#include <File.au3> ;Needed for the _PathSplit

;Get the Citrix MachineID
    $sMachineID = RegRead("HKEY_CURRENT_USER\Software\Citrix\Dazzle", "CurrentAccount")         ;CompanyID-123456  This is the pointer needed for other steps
    If @error Then
        MsgBox(0, "Citrix", "Unable to identify this machine Citrix ID")

    $sAppID = "@@DesktopName v1 $MoreStuff"                                                     ;This is the @@ Name for the item we want which will be appended to the $sMachineID
    $sCitrixRegPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"                    ;Each Citrix item will be in a sub folder \$sMachineID & $sAppID

;Piece stuff together to get the Launch string for the item we want to start
    $sLaunchString = RegRead("HKCU\" & $sCitrixRegPath & $sMachineID & $sAppID, "LaunchString") ;Get the full string to pass to the .exe to launch
    $sCitrixApp = RegRead("HKCU\" & $sCitrixRegPath & $sMachineID & $sAppID, "ShortcutTarget")  ;Get the location of the SelfService.exe that launches Citrix

;Split out the full path to the SelfService.exe to use as the Working Directory
    Local $sDrive, $sDir, $sFile, $sExt
    $aPath = _PathSplit($sCitrixApp, $sDrive, $sDir, $sFile, $sExt)
    $sCitrixDir = $aPath[1] & StringLeft($aPath[2], StringLen($aPath[2]) - 1)

;Launch the SelfService.exe with the command line options, and the working path, This will spawn a seperate item once fully loaded.
;Using ShellExecuteWait as once it's fully loaded, the initial process closes.
    $iPID = ShellExecuteWait($sCitrixApp, $sLaunchString, $sCitrixDir)
    ConsoleWrite("Launched the Citrix item" & @CRLF)


hmm... I guess I have to have a signature...

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

  • Similar Content

    • nooneclose
      By nooneclose
      Good afternoon, I am in need of some help. I am sure this is a stupid question requiring only one or two lines of code. However, I would greatly appreciate the help I cannot figure this out. I also tried searching for the answer on the internet but no one except me apparently seems to be having a hard time figuring this out and or is asking about it. 
      I simply want to change the "status" of an email from unread to read once I have processed it. My code is over 500 lines and I would like not to clutter this post with it. Assume I have all my includes and connections properly defined and stuff. 
      Here is the bit of code where I am trying to change the email that was used from unread to read:
      Func ChangeEmailStatus() ;******************************************************************************* ; changes the status of an email from unread to Read ;******************************************************************************* Local $iRows = UBound($aItems, $UBOUND_ROWS) MsgBox("", "Number of Unread emails (Before Change)", $iRows) _OL_ItemModify($oOutlook,$aItems[$i][0], Default, "Read=True") MsgBox("", "Array Display 1", $aItems[1][0]) MsgBox("", "Array Display 2", $aItems[2][0]) Local $iRows = UBound($aItems, $UBOUND_ROWS) MsgBox("", "Number of Unread emails (After Change)", $iRows) EndFunc  
    • SharpDressedMan
      By SharpDressedMan
      Is there any way to check for validity of a pointer to a DllStruct ?
      In the above code, a DllStruct is created from an invalid pointer. How to prevent from doing this ?
      local $tStruct = DllStructCreate("int i") DllStructSetData($tStruct, "i", 123) local $pStruct = DllStructGetPtr($tStruct) $tStruct = 0 ; destroy DllStruct ==> $pStruct becomes invalid ; how to check here for validity of $pStruct and prevent from doing the following ? $tStruct = DllStructCreate("int i", $pStruct) ; create DllStruct from invalid pointer... MsgBox(0, @ScriptName, @error) ; displays '0' : invalid pointer is not detected by DllStructCreate() MsgBox(0, @ScriptName, IsDllStruct($tStruct)) ; displays '1' : tStruct is assumed as a valid DllStruct object, which is not Thanks for help
    • nooneclose
      By nooneclose
      I need to send a string of text to this popup and click on the ok button to save it.
      Here is the code I have so far:
      ;Start IE Sleep(7000) $oIE = _IECreate("http://www.google.com") Sleep(500) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "hwnd") ; Get Handle of the IE window Sleep(500) WinSetState($hIE, "", @SW_MAXIMIZE) ;Wait for a browser page load to complete Sleep(3000) _IENavigate($oIE, "https://properURL.com") Sleep(8000) _IELoadWait($oIE) ;Attach to a browser control embedded in another window $oIE = _IEAttach("https://"properURL.com", url") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console Sleep(2000) ;Get the title of the webpage ;Local $wTitle = _IEPropertyGet($oIE, "title") ;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle) ;Clicks the new button Sleep(3000) _IEAction($nWorkOrderB, "focus") _IEAction($nWorkOrderB, "click") Sleep(5000) ;Store the Element names where the important data will be sent ;Store the long description button Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img") ;Store the long Description field id Local $wComments = _IEGetObjById($oIE, "ma6499a9c-rte_iframe") ;Store the ok button id that is in the long description Local $wCommOk = _IEGetObjById($oIE, "m74031266-pb") ;******************************************************************************* ; Send the stored data to the proper field ;******************************************************************************* ;Click the long description button Sleep(300) _IEAction($wLongDButton, "focus") _IEAction($wLongDButton, "click") Sleep(300) ;Sends the Comments Sleep(500) _IEAction($wComments, "focus") _IEAction($wComments, "click") Sleep(500) _IEFormElementSetValue($wComments, "hello darkness my old friend") ;Click the ok button Sleep(500) _IEAction($wCommOk, "focus") _IEAction($wCommOk, "click") Sleep(500)  
      Here is the popup:

    • yasha
      By yasha
      i want am trying to select a nimber to run a program and then select where to save the excel result at before hand
      the problem is that it does not save in the folder i want but the folder before any solutions
      $sFolder = ""
          ; Create a constant variable in Local scope of the message to display in FileSelectFolder.
          Local Const $sMessage = "Select a folder"
          ; Display an open dialog to select a file.
          $sFileSelectFolder = FileSelectFolder($sMessage, $sFolder)
          If @error Then
              ; Display the error message.
              MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.")
              ; Display the selected folder.
              MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder)
      $oExcel = ObjCreate("Excel.Application")                   ; Create an Excel Object
      $oExcel.Visible = 1                                        ; Let Excel show itself
      $oExcel.Workbooks.Open("J:\OPS\OPS_Share\Planners\2 - Weekly Reports\Auto download\"& $YY & $MM & $DD & " ORDER.xls",0)
      $oExcel.ActiveWorkbook.Saveas ( $sFileSelectFolder,""& $YY & $MM & $DD & " ORDER.xlsx", 1)
      i only want to save it as ddmmyy order inside documents but it saves in libraries as documents ddmmyy order.
    • vynce1982
      By vynce1982
      I am trying to make a simple installer script for my understanding.  I would just like to understand how to deal with multiple possible windows. In the case of installing VLC, I might get a window saying VLC is already installed. I have also tried a switch with no luck.  I would just like to understand some methods for dealing with the possible existence of unexpected windows. 
      Run(@ScriptDir & '\bin\VLCViewer_2.2.4_3.EXE')
      AutoItSetOption('MouseCoordMode', 0)
      WinWait("VLC Viewer 2.2.4")

           ; this window will pop up if vlc is already installed
          If WinExists( "VLC Viewer 2.2.4", "VLC 2.2.4 Already Installed") Then
                ConsoleWrite ("already installed")
                WinActivate ('VLC Viewer 2.2.4','Already Installed')
                MouseClick ('primary', 93, 83, 1, 0)
            ; this window will pop up if installer finishes sucessfully
           If WinExists( "VLC Viewer 2.2.4", "VLC Viewer 2.2.4 Installed") Then 
                ConsoleWrite ("already installed")
                WinActivate ('VLC Viewer 2.2.4','VlC Installed')
                MouseClick ('primary', 93, 83, 1, 0)