Jump to content

Recommended Posts

Posted

HI All,

I can press a button in tablet to bring up the software using the script below 

This is saved as a button script which gets called by button press.There is a main script which starts with windows startup so we can just multiple tasks with different key press's

AS you can see the script maximizes the window is winexists and if the the window is not present then runs it after deleting few folders.

If WinExists("MobilePublic") Then
    WinActivate("MobilePublic")
    WinSetState("MobilePublic", "", @SW_MAXIMIZE)
Else
    FileDelete("C:\Users\test01\appdata\local\Intergraph Corporation, Inc\MobilePublicSafety\*.*")
    Run("C:\Program Files\Intergraph\MobilePublicSafety\bin\ingrviewer.exe /application:MobilePublicSafety /wsgSearchPath:customEms", "C:\Program Files\Intergraph\MobilePublicSafety\bin\", @SW_MAXIMIZE)
EndIf

What i am trying to do is i need to press the same button and If WinExists("[CLASS:IEFrame]") Then IEFrame {The reason i used Class is title do keeps on changing} becomes the main window @sw_maximize. and if i press again it will take me to the previous window, in this case it is ingrviewer.exe @sw_maximize. Thus no other user input rather then just a mere push of the button{Main reason why i am not sending ALT+Tab}

 

If wanted i can get the process status by

Func FixIngrViewer()


    Global $aPL = ProcessList("ingrviewer.exe")
    For $iCC = 1 To $aPL[0][0]
            ProcessClose($aPL[$iCC][1])
    Next
    sleep(500)


    DirRemove("C:\Program Files\Intergraph\MobilePublicSafety\wsgapplicationdata\data\",1)
    FileDelete("C:\Users\test01\appdata\local\Intergraph Corporation, Inc\MobilePublicSafety\*.*")
    Run("C:\Program Files\Intergraph\MobilePublicSafety\bin\ingrviewer.exe /application:MobilePublicSafety /wsgSearchPath:customEms", "C:\Program Files\Intergraph\MobilePublicSafety\bin\", @SW_MAXIMIZE)
endFunc

tried this but only getting from IEFrame to Mobilepublic but not going back to IEFrame

If WinExists("[CLASS:IEFrame]") Then

    Local $state = WinGetState("[CLASS:IEFrame]","")

    if BitAND($state,16) then
        WinSetState("[CLASS:IEFrame]", "", @SW_RESTORE);
    elseif BitAND($state,2) and BitAND($size[1],300) then
        WinSetState("[CLASS:IEFrame]", "", @SW_HIDE);
    Elseif BitAND($state,2) and BitAND($size[1],1) then
        WinActivate("MobilePublic")
    else
        WinSetState("[CLASS:IEFrame]", "", @SW_SHOW)
    EndIf

Else
    Run("C:\Program Files\Intergraph\MobilePublicSafety\bin\ingrviewer.exe /application:MobilePublicSafety /wsgSearchPath:customEms", "C:\Program Files\Intergraph\MobilePublicSafety\bin\", @SW_MAXIMIZE)
EndIf

Easiest way i can do the above requirement is by sending a ALT+ ESC as shown below, which does the job for me  

send ("!+{ESC}")

But there is a small mandatory window which runs in the background, comes in the middle of ALT+ESC press.Not that is a big deal, i just wanted to create a script which does the job perfectly.

  Oh yea forgot to mention i even tried Z-listing Can get change the active window from IEFrame to mobilepublic but not the other way {ie, when window Mobilepublic is active going back to IEFrame }

Func _WinPrevious($z = 1)
    If $z < 1 Then Return SetError(1, 0, 0) ; Bad parameter
    Local $avList = WinList()
    For $n = 1 to $avList[0][0]
        ; Test for non-blank title, and is visible
        If $avList[$n][0] <> "" And BitAND(WinGetState($avList[$n][1]), 2) Then
            If $z Then 
                $z -= 1
            Else
                WinActivate($avList[$n][1])
                Return 1
            EndIf
        EndIf
    Next
    Return SetError(2, 0, 0) ; z-depth exceeded
EndFunc

 

Hope someone can help me out with this, as i been working on this for quiet time i just ran out of ideas and interest :P, Just let me know if you didn't understand the requirement, i can try my level best to explain.

 

 

 

 

 

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...