Jump to content

Recommended Posts

Posted

I have an AutoIt script that runs at high integrity level (elevated) that contains it's own function to basically use _WinAPI_ShowWindow to change its GUI window visibility. The changing of the window visibility is done by clicking on its system tray icon.

I have another AutoIt script that runs at Medium IL (unelevated). Since it is at a lower integrity level than the first script, I cannot use _WinAPI_ShowWindow within this process to change the visibility of the GUI window in the elevated script.

Possibilities:

  • Register a hotkey in the elevated script that would run the function within it. Simulate the hotkey presses in the unelevated script to run the function in the elevated script.
  • Simulate the clicking on the system tray icon (however user may have tray icon hidden) but likely not a good option
  • IPC
  • Maybe more possibilities that I cannot think of?

The IPC stuff is an area that I am still very unfamiliar with. Particularly going from Medium IL to High IL (unelevated to elevated). However, I would imagine that IPC is likely the better option.

What would be the best way for the unelevated script to run a function from within the elevated script?

Keep in mind that the elevated script is running at all times in the background and has a system tray icon. It has a GUI which is basically what hides and shows based on the following function within the elevated script:

Func idGUI()
    ; get GUI window state and show GUI window when clicking on tray icon
    If Not BitAND(WinGetState($hGUI), $WIN_STATE_VISIBLE) Then _WinAPI_ShowWindow($hGUI, @SW_SHOW)
    _WinAPI_SetForegroundWindow($hGUI)
EndFunc

Well, that function shows the GUI. The GUI is hidden to the system tray when the user closes the GUI.

Thank you for your time. I appreciate it very much. :)

  • Solution
Posted
16 minutes ago, Nine said:

Thank you, I will check this out for sure. I wont be able to thoroughly test and integrate this into my script until later in the evening. So I will respond more about whether or not this works well for my situation later in the day.

Posted (edited)

@Nine I was doing some testing with your WCD IPC UDF and I was very impressed with it. It really is quite simple yet such a genius idea and very efficient as well.

Testing with your scripts worked perfectly. But it didn't work when I integrated it into my script.

Is it possible that it didn't work with my script because my script is already a GUI script?

I checked with System Informer and there wasn't a window titled "WCDServer". It would've shown there whether it was hidden or not.

EDIT: I figured out the problem. I was using _WinAPI_SetWindowText to set the title for the AutoIt window specifically but it was changing the title from "WCDServer" to the other title that I was using previously. This is something that I can work around.

Your UDF is the perfect solution to my problem. Thank you. :)

Edited by WildByDesign

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...