• Making an EXE is probably the best way to deploy this. They probably would host an exe for me and give me access to the file location so I could update the exe as I see fit and run it like that. So yes this maybe a way.  I'm not getting a great deal of time to investigate this at the moment but spending a few minutes here and there.  I've made another break through though.   If I use the class of the citrix workspace which looks a bit like this "wMFService00010******"  rather than the actual window handle it seems to work.

    So as a recap , (all on client side)

    start the citrix application in the normal way.

    Run a script to  make a userform using the windows handle of the user form and the class of the citrix display set the parent of the display to the form.

    Move and resize the display within the form as needed.

    This now works.  So I'm one step closer. Why using the class rather than the Whnd make such a difference I'm not sure but it seems to ..

  • I'll have to do some more reading on the getgui message thing then...  I'm a little surprised no one else has made any comments on here, It's only you keeping me company David 🙂

  • Hello David,  unfortunately I do have a GUIGetMsg() in my loop as I'm processing the close event when I close my form and also I have a button on the form to fiddle with moving things on command (doesn't work) but as far as I know (which isn't very far at all 🙂 )  this is to capture the events being fired on my form to process in the loop it doesn't have any bearing on the application responding to its own events.

    So If I set up a form then set two instances of my process book applications to use my form as their parent then they will sit on the form and be bound within it. However if the process book application has a button on it , it is hit and miss whether clicking on that button does anything. I think either the click event in the application isn't being triggered or its being re routed somehow with the reassigning to the parent form. am I missing something here with the GUIGetMsg() ?   It does feel like I need to assign time in my loop for each application to do whatever it wants then come back to the loop.

    I've put a request in to the Citrix folks to see if I can slip an install of AutoIT Server side..

  • Just got back to this for a few minutes and I can't seem to find a DoEvents function in AutoIt..... I think it maybe a can't process the event thing though as a clock on one of the displays still works but only certain buttons on it seem to accept a mouse click..

  • good point David. Indeed I have not. A rookie mistake for sometime coming from a VBA background. I'll stick that in next time I'm in work to see if ti fixes the non responsive occasions. Then it's just moving and sizing the windows to fill my forms and I could be on tot something. I could probably do this whole thing from VBA within the app itself (IE I short cut a TopRight instance of the application and a BottomLeft ETC..... but as stated I wanted to use it to learn from. However if I can't bottom the AutoIT or power shell angle I could go half way there then once I've moved the application's parent to my form I could then cheat and use VBA inside the app to move it to 0,0 position and maximise it..  Problem is when I get back to work there will be a list of things I'm meant to be doing to get done and this will interfere with my fiddling.. 🙂

  • I'm off for a few days and no access to the test environment.. my last tests got the applications referencing my form as parent but seemed erratically unresponsive. Thus  they would work as a display and be responsive to button clicks one minute then not the next.. This would of course not be ideal in a production environment...

  • the process I'm running in Citrix is call PI Process book. If I start a couple of instances of these and list all handles,  I can see a handle for each instance. I think I had something else wrong before as I now seem to be able to set the parent for these instances to my form.  However I cant control them in terms of moving them or min/max or anything.

    I may end up trying to get AutoIt installed client side and fiddle with it there but I'm going to try and bottom it client side first if I can as this is sure to end up the path of least resistance (if it's possible).

     

     

  • I work for a big organisation and centrally served citrix. I think if I did what you say David and run the scripts on the inside then it could well do the trick but I'm not going to be given that sort of god like status anytime soon.. I'm not really knockings them as I know if they gave all us desk fellows access it would soon end up in tears.

    My next bash is to get my form to have the Citrix environment as the parent and it run another script to see if it changes the scope of what it can see.

  • now I've had chance to test it with Citrix I have a new problem..

    My citrix apps are running in an invisible virtual environment called workspace. If I click shift+F2 I can see it and in it (on it) there are my apps running in citrix.

    I can't move the workspace and set my form as its parent (not sure why it doesn't work)  but I can make a form and make the citrix workspace its parent. So  all I need to do now is to find the handles of the citrix child processes and make my form their parent and mission accomplished. However I don't appear to be able to get at the handles for the child processes.

  • Actually the set parent thing does work. What I hadn't noticed is that notepad only appears if I move the form and thus force a redraw Note pad is then maximised to the form and restricted to within the forms boundaries. not sure if it will work with my citrix apps yet but I think I have a way forward with note pad (not that I need one with notepad :-0 )

    #include <GUIConstantsEx.au3>
    #include <WinAPISysWin.au3>
    #include <WindowsConstants.au3>
    
    ; Create a form
    global $Form1 = GUICreate("Form1", 800,800, 5,5)
    GUISetState(@SW_SHOW)
    ConsoleWrite($form1)
    ;end form create
    
    Example()
    
    
    
    While 1
    	$nMsg = GUIGetMsg()
    	Switch $nMsg
    		Case $GUI_EVENT_CLOSE
    			Exit
    
    	EndSwitch
    WEnd
    
    Func Example()
      ; Run Notepad
      Run("notepad.exe")
    
      ; Wait 10 seconds for the Notepad window to appear.
      Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
    
      ; move notpad to be within the boundary of the user form
      WinMove($hWnd, "", 7, 7, 700, 700)
    
      ; Set the parent of notepad to be the user form
      _WinAPI_SetParent($hWnd, $Form1)
    
      ; Maximise notepad to fill the form
      WinSetState($hWnd, "", @SW_MAXIMIZE)
    
    EndFunc   ;==>Example

     

  • Yes I read that too and though it didn't jump out as to the way forwards I did get the message that some applications couldn't be controlled in this way. So how to find out which ones can and which can't or if there is a different method for ones that can't be controlled with this method.  So I turned to notepad, it seems that no matter what you are trying tot do all the examples use notepad or calculator  to demo the function. So I thought if any app can be controlled it should be notepad. But alas not, or can it and there is something wrong with my code ?

    I've also been dabbling with trying to change the parent of an application to a user form but that doesn't appear to work either. The main object of this project was to learn a bit more and I'm certainly doing that. Great if I can actually achieve the secondary objective as well but these little nudges you're giving me David are definitely helping the learning bit..

     

  • I think I understand how it is meant to work but hmmm it's not. I must have something fundamental wrong with my code below.

    I start up the notepad app.

    I grab the winhandle for it using WinGetHandle.

    I then set up a dll structure and populate it with some data...

    All this is going well so far 🙂

    I then try to send those numbers to the application using  _SendMessage . I receive a reply of 0 so that tells me its all worked? however the size of my notepad hasn't changed and isn't restricted in any way...

    I also tried doing another read after this and the data returned is the same as the data I sent , so it looks like it's doing something .. hmmmmm

    #include <windowsConstants.au3>
    #include <SendMessage.au3>
    
    Global Const $tagMINMAXINFO = "struct;long;long;endstruct;" & _
                                "struct;long MaxSizeX;long MaxSizeY;endstruct;" & _
                                "struct;long MaxPositionX;long MaxPositionY;endstruct;" & _
                                "struct;long MinTrackSizeX;long MinTrackSizeY;endstruct;" & _
                                "struct;long MaxTrackSizeX;long MaxTrackSizeY;endstruct;"
    
    Local $tMMI = DllStructCreate($tagMINMAXINFO)
    local $WinHandle = WinGetHandle("[CLASS:Notepad]")
    
    if @error Then
    	ConsoleWrite("Application not found " & @CRLF)
    Else
      ConsoleWrite("Application found and the handle is " & $WinHandle & @CRLF)
    endif
    
    DllStructSetData($tMMI, "MaxSizeX",50)
    DllStructSetData($tMMI, "MaxSizeY",50)
    DllStructSetData($tMMI, "MaxPositionX",10)
    DllStructsetData($tMMI, "MaxPositionY",10)
    DllStructSetData($tMMI, "MinTrackSizeX",40)
    DllStructSetData($tMMI, "MinTrackSizeY",40)
    DllStructSetData($tMMI, "MaxTrackSizeX",60)
    DllStructSetData($tMMI, "MaxTrackSizeY",60)
    
    Consolewrite("return from Send " & _SendMessage($WinHandle, $WM_GETMINMAXINFO, 0, $tMMI, 0, "wparam", "struct*") & @CRLF)

     

  • Oh yes I'm definitely seeing the advantages of AutoIt I've been YouTube binging on it and it is certainly the easiest tool for many tasks. The fact it's portable and contains a real easy to use EXE maker means it will be my go to for some thing. So thanks for that David I've leant a lot by coming on this forum already..

    Now to eagerly digest your posts about window restrictions... Happy Christmas to whomever reads this post.. 🙂

  • Hello David, I'm really sorry to harass you like this but I'm not really getting anywhere.  I can do the open and move stuff about after taking on board you comments and reading the post you linked but the crucial bit for my application is the "enforce a maximum size on the window" I can't fathom.  As mentioned I don't really care if I have to start the application in a container of some sorts (like in a panel on a win form)  or control its maximum some other way either directly or not but I do need to set its maximum size it goes to if someone presses the maximize button.  Even if I knew if this is possible or not would be a help I guess.

    so thanks again for your continued assistance..

  • Hello again David.. I'm probably missing something here as I must admit to being a bit guessy.  I can probably get to the point (using the above) of starting an application and sizing/moving it on the screen but still can't make it run inside a panel on a form and maybe I don't need to. My goal it to ensure if someone clicks maximize or tries to move a window manually then it can only happen within a set screen area. At the moment I can start four instances of the application and arrange them manually just nice and lovely. Someone will open a new one or press maximize on one of them and it'll cover the whole screen and in them trying to get it back to the right size they will end up making the display unusable for all. It is a common screen and people need to be able to interact with the displays..

    I haven't done anything with AutoIT before but giving it a quick read it looks like it does a lot of the heavy lifting for you.  Do you think AutoIt could do what I need ? and if so any suggestions as to how ? As mentioned restricting the screen space for each instance of the app is where I'm trying to end up..

     

    Thanks for your help and suggestions thus far David...

  • Thanks David, I'll trya and absorb that example over the next couple of days and hopefully the light will turn on and I'll be away...

  • Hello David,  I have run in to problems with Citrix before in the manner you've outlined but that's another days problem.

    Good you think the main part of my project should work OK,

    Would you have any pointers as to how I can achieve this ? Maybe an example on line somewhere to get me started. Like I said in my opener the basics of making a form and panels , buttons etc I'm ok with in PS but I need to do a lot more reading . I have scoured the google achieve and searched with every combination of words I can think of but alas nothing has popped up..

  • Hello David F.  The application is a thing called Pi Processbook made by a company called OSIsoft.  It looks to be a standard type interface with normal window form type controls.  Another complication is I'll be wanting to do it with with application being hosted on a Citrix server but one step at a time..

  • Bill Turner posted an update in the group Group logo of PowerShellPowerShell 11 months, 3 weeks ago

    Every day is a learning day. I've given myself a new little project to get me going with Powershell.

  • Hello all,
    I have a little project that I'm hoping I can do in PowerShell. There are other ways of achieving what I want to do but I also want to learn a bit more about PS and thus a little project is what I need. However I could do with a nudge in the right direction if anyone has some handy hints or pointers to where I can read up on solutions to my problems.

    I'm trying to write a bit of script that will start a number of processes (four probably) it will size the main window or each process and position them on the screen. I know I could start them then use hotkeys or Snap Assist but I want these applications to be contained in their allotted screen space. Thus if someone presses maximize the app will only go up to the limits of the screen area I've set and not the whole available screen.

    A possible way of doing this that I've thought of is use PS to produce a windows form with panels on it of the right shape and position. I would then start the process inside the panel and thus contain it. I can make the forms and panels no problem it's the starting the process in the form which is eluding me at the moment. I've seen it done in C# but not sure how to convert it over to PS. Does anyone have any tips ? or maybe another way to do it in PS that I haven't thought of ? Thanks for reading.

  • Load More
© 4sysops 2006 - 2021

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account