Jump to content

How do I hide a window?


Recommended Posts

HotKeySet("^{F1}", "Sql")
HotKeySet("^{F2}", "Hide")
HotKeySet("^{F3}", "Close")

While 1
    Sleep(100)
WEnd

Func Sql()
    Run("runserver-sql.bat")
EndFunc

Func Hide()
    
EndFunc

Func Close()
    ProcessClose("login-server.exe")
    ProcessClose("char-server.exe")
    ProcessClose("map-server.exe")
EndFunc

The runserver-sql.bat runs 3 things, login-server, char-server, map-server.

Im wanting it to hide the windows that come up, on a certain keypress.

But seeing as when it runs the login, char, map server, because its like, in the dos promt, the window name is like this.

C:\Program Files\Gravity\eAthena v1.0b\eAthena v1.0b\athena\login-server.exe

But, thats fine, IF if i was using it, but im making it for a friend.

So I need help...

1# I need to know how to hide windows

2# Is it possible to hide the window using its process name, not the window name.

3# And is it possible to make the program e.g. login-server.exe use less CPU then its using? ( That ones my friends question )

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

1. Windows are hidden using

Help File(search)

2. What do you mean? Like hide the process itself or something. Note that most processes have multiple windows.

3. Why would you do that? At my pc the cpu usage is ~0% :D

Hope this helps

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

1. Windows are hidden using

Help File(search)

2. What do you mean? Like hide the process itself or something. Note that most processes have multiple windows.

3. Why would you do that? At my pc the cpu usage is ~0% :D

Hope this helps

Posted Image

^ Thats the window I want to hide, on every PC the name of the window will be different. But

If I can hide the window, using the process name...

Posted Image

It would work on all pcs.

And the CPU thing, because when youve got all 3 windows

login, char, map, it makes the pc go alot slower, because they use up alot of the cpu, so hes asking if its possible to make them use less. or something..

PS, eAthena.exe has nothing to do with it, thats the name of my scripts .exe

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

1. Yes, but every window will contain "login-server.exe", won't it? In that case, use

Opt("WinTitleMatchMode", 2)
.

2. About the cpu thingy...those are non-autoit programs then? Don't think you can externally change those processes' cpu usage...

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

1. Yes, but every window will contain "login-server.exe", won't it? In that case, use

Opt("WinTitleMatchMode", 2)
.

2. About the cpu thingy...those are non-autoit programs then? Don't think you can externally change those processes' cpu usage...

Thanks Muchly.
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

YWC, though SmOke_N's solution is good as well!

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • Moderators
1. Yes, but every window will contain "login-server.exe", won't it? In that case, use
Opt("WinTitleMatchMode", 2)oÝ÷ Û`¢ëmç)ºØb­j·§¢v®¶­¦º ­©¬¶§÷öÛay2¢çìmz¹Ú©àzØh±êk¡Ç¬±ë7õÊnºÆ {ú®¢×¢ºòªßu©»­¶­Â)ep¢¹«Ré6,µçpYZÛ(Â)e¶¬jëh×6Opt("WinWaitDelay", 0)

While 1
$list = ProcessList()
For $i = 1 To $list[0][0]
    Switch $list[$i][0]
        Case "login-server.exe"
            _WinMinimizePID($list[$i][1])
        Case "char-server.exe"
            _WinMinimizePID($list[$i][1])
        Case "map-server.exe"
            _WinMinimizePID($list[$i][1])
    EndSwitch
Next
Sleep(100)
WEnd

Func _WinMinimizePID($PID)
    $aWin = WinList()
    ReDim $aWin[UBound($aWin, 1)][3]
    For $n = 1 to (UBound($aWin, 1) - 1)
        $aWin[$n][2] = WinGetProcess($aWin[$n][1])
        If $aWin[$n][2] == $PID Then
            WinSetState($aWin[$n][1], "", @SW_HIDE)
        EndIf
    Next
    Return $aWin
EndFunc   ;==>_WinMinimizePID
Link to comment
Share on other sites

@ big_daddy

Why would that not work? Just tested it on a dos window and worked fine!

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • Moderators

@ big_daddy

Why would that not work? Just tested it on a dos window and worked fine!

He's merely stating that you are only looking for 1 window out of the possibility of multiple window names.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

It will if you presume the program is named "login-server.exe" (as I did), or else can you explain why it wouldn't?

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • Moderators

It will if you presume the program is named "login-server.exe" (as I did), or else can you explain why it wouldn't?

Your using WinSetState() (Win = Window) on an .exe? I didn't even notice you had .exe there... I was assuming you were referring to the window name, but as you clearly state above, you are referring to the .exe... I will for giggles try your assumption on Notepad.exe and post it here for your amusement in a second...

So this is what I'm understanding you say will work?

If Not ProcessExists('Notepad.exe') Then
    Run('Notepad.exe')
    ProcessWait('NotePad.exe')
    Sleep(1000)
EndIf

Opt('WinTitleMatchMode', 2)
WinSetState('Notepad.exe', '', @SW_HIDE)
Your saying that the 'Untitled - Notepad' window should be hidden right?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Nonono of course that's not what I meant lol!!!

If you take a look at AzKay's screenshot you can see that the window title is, and I quote: "C:\Program Files\Gravity\eAthena v1.0b\athena\login-server.exe".

Now, unless I'm currenlty experiencing an autoit blackout, my suggestion should work, as the title obviously has

"login-server.exe" in it, and Opt("WinTitleMatchMode", 2) will, if I'm correct, find the substring "login-server.exe"

as well...

lol let me know if I'm wrong!

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • Moderators

Nonono of course that's not what I meant lol!!!

If you take a look at AzKay's screenshot you can see that the window title is, and I quote: "C:\Program Files\Gravity\eAthena v1.0b\athena\login-server.exe".

Now, unless I'm currenlty experiencing an autoit blackout, my suggestion should work, as the title obviously has

"login-server.exe" in it, and Opt("WinTitleMatchMode", 2) will, if I'm correct, find the substring "login-server.exe"

as well...

lol let me know if I'm wrong!

Nope, not wrong with that... but I was going off the statement "3 windows / chr/map or whatever"... or even if there is a window that the name could be possibly unknown. But if every window has that login-server.exe in the title, that should work. Although I don't know how it is for cmd.exe windows to be honest (I just looked at the screenshot for the first time :D ).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Nonono of course that's not what I meant lol!!!

If you take a look at AzKay's screenshot you can see that the window title is, and I quote: "C:\Program Files\Gravity\eAthena v1.0b\athena\login-server.exe".

Now, unless I'm currenlty experiencing an autoit blackout, my suggestion should work, as the title obviously has

"login-server.exe" in it, and Opt("WinTitleMatchMode", 2) will, if I'm correct, find the substring "login-server.exe"

as well...

lol let me know if I'm wrong!

Okay, now I see what you were doing. I was thinking along the same lines as SmOke_N.
Link to comment
Share on other sites

Well glad we understand one another now :D

It would be nice to know btw if this has actually helped AzKay...

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Well glad we understand one another now :D

It would be nice to know btw if this has actually helped AzKay...

Hehe, oops, sorry, i thought my post saying

"Thanks Muchly" summed it up xD anyway, I got it all working fine through what you said, well, worked fine for me, but not my friend, eg:

When he presses Ctrl F1 all 3 run fine. But when he presses Ctrl F2 to hide the windows, char & map server hide, but login doesnt. and when he does Ctrl F4 to close, it closes char & map but not login..

I checked and rechecked the script, it all seamed fine. Works for me, but not for him... weird..

Id post the script, but nevermind, ill try fix it on my own =P, but if all fails, i know where to come ^^

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Moderators

Id post the script, but nevermind, ill try fix it on my own =P, but if all fails, i know where to come ^^

:D Now there's a Concept!! :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

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