AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

minimize maximize windows
Goto page 1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Fri Oct 23, 2009 7:52 pm    Post subject: minimize maximize windows Reply with quote

lets say i have 2 application running at the same time
and i want one to be maximize and the other application to minimize
and when i press a hotkey i want the application windows to switch
so now the maximize app will minimize and the other application that was minimize now will maximize the window,
in other words both apps running at the same time have opposite windows.

now for the fun part
autokey relys on mouse position to click
and when you minimize a window the position may not allways be in the same spot when it minimize as a example lets say you have 2 apps running and IE then the app minimize in the task bar some were else
OR if i send this to some one and im running screen resolution 1024 x 768 and there not then how will the script know what position to minimize or maximize?
is there such a thing like minimize-app,ms-paint.exe
then have maximize-app,gimp-paint.exe
that way you dont need to know the postion
Back to top
View user's profile Send private message
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Fri Oct 23, 2009 11:04 pm    Post subject: Reply with quote

Code:

F1::

SetTitleMatchMode, 2
IfWinActive, Gimp
{
   WinMinimize, Gimp
   Sleep, 100
   WinMaximize, Paint
   Return
}

SetTitleMatchMode, 2
IfWinActive, Paint
{
   WinMinimize, Paint
   Sleep, 100
   WinMaximize, Gimp
   Return
}


F1 to activate. Tested working
Back to top
View user's profile Send private message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Sat Oct 24, 2009 1:55 am    Post subject: Reply with quote

if you was a women i would kiss you.

all works fine but for it to work like it should there must be some kind of click with in the app.

if the app is 3D or paint i dont want it to click because it could mess some thing up the person is working on so is there like a code to act like a click
like app-press
im not saying click wont work but it might like
app-click,0

OR
set-paint:Active,1

these are fake codes off of the top of my head, im new

THANK Wink
Back to top
View user's profile Send private message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Sat Oct 24, 2009 2:52 am    Post subject: Reply with quote

AH HUH
found the fixs Laughing
Code:
Click %x% %y%
Back to top
View user's profile Send private message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Sat Oct 24, 2009 3:11 am    Post subject: Reply with quote

one last question for you or anyone else

can this be done?
i want a option to let the user type in the name of both apps
and all so let him chose his own hotkey
and once the exe is exited the setting stays until he changes when he wants.

sample

click a button and get 3 pop up
what hot key would you like to use type it here ______
what is the name of the first app type it here ______
what is the name of the second app type it here _______
Back to top
View user's profile Send private message
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Sat Oct 24, 2009 3:32 am    Post subject: Reply with quote

Code:

inputbox, var1, What is the name of the first window?
inputbox, var2, What is the name of the second window?

F1::

SetTitleMatchMode, 2
IfWinActive, %var1%
{
   WinMinimize, %var1%
   Sleep, 100
   WinMaximize, %var2%
   Return
}

SetTitleMatchMode, 2
IfWinActive, %var2%
{
   WinMinimize, %var2%
   Sleep, 100
   WinMaximize, %var1%
   Return
}
Back to top
View user's profile Send private message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Sat Oct 24, 2009 3:48 am    Post subject: Reply with quote

bookmarked and ill be using your name as credit Wink

not a big deal but text is case sensitive

like if i have MS Paint
or mS Paint
or Ms PAINT

if its not correct with lower or upper case it wont work,
not a big deal i can tell the user to make sure.

thanks

tekkie2412 wrote:
Code:

inputbox, var1, What is the name of the first window?
inputbox, var2, What is the name of the second window?

F1::

SetTitleMatchMode, 2
IfWinActive, %var1%
{
   WinMinimize, %var1%
   Sleep, 100
   WinMaximize, %var2%
   Return
}

SetTitleMatchMode, 2
IfWinActive, %var2%
{
   WinMinimize, %var2%
   Sleep, 100
   WinMaximize, %var1%
   Return
}
Back to top
View user's profile Send private message
tekkie2412



Joined: 22 May 2007
Posts: 73

PostPosted: Sat Oct 24, 2009 4:00 am    Post subject: Reply with quote

Code:

F1::
FileReadLine, var1, C:\Switch.txt, 1
FileReadLine, var2, C:\Switch.txt, 2

SetTitleMatchMode, 2
IfWinActive, %var1%
{
   WinMinimize, %var1%
   Sleep, 100
   WinMaximize, %var2%
   Return
}

SetTitleMatchMode, 2
IfWinActive, %var2%
{
   WinMinimize, %var2%
   Sleep, 100
   WinMaximize, %var1%
   Return
}

F2::ExitAPP
Return

F3::
FileDelete, C:\Switch.txt
inputbox, var1, Window 1, What is the name of the first window?`nWindow titles are case sensitive.
inputbox, var2, Window 2, What is the name of the second window?`nWindow titles are case sensitive.
FileAppend, %var1%`n, C:\Switch.txt
FileAppend, %var2%, C:\Switch.txt
Return


F1 to activate the switch
F2 to terminate the script
F3 to input window titles (the values are saved on the C:\ drive until they hit F3 again)
Back to top
View user's profile Send private message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Sat Oct 24, 2009 4:21 am    Post subject: Reply with quote

im really truly amazed Shocked
this is even better

thank





tekkie2412 wrote:
Code:

F1::
FileReadLine, var1, C:\Switch.txt, 1
FileReadLine, var2, C:\Switch.txt, 2

SetTitleMatchMode, 2
IfWinActive, %var1%
{
   WinMinimize, %var1%
   Sleep, 100
   WinMaximize, %var2%
   Return
}

SetTitleMatchMode, 2
IfWinActive, %var2%
{
   WinMinimize, %var2%
   Sleep, 100
   WinMaximize, %var1%
   Return
}

F2::ExitAPP
Return

F3::
FileDelete, C:\Switch.txt
inputbox, var1, Window 1, What is the name of the first window?`nWindow titles are case sensitive.
inputbox, var2, Window 2, What is the name of the second window?`nWindow titles are case sensitive.
FileAppend, %var1%`n, C:\Switch.txt
FileAppend, %var2%, C:\Switch.txt
Return


F1 to activate the switch
F2 to terminate the script
F3 to input window titles (the values are saved on the C:\ drive until they hit F3 again)
Back to top
View user's profile Send private message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Wed Dec 23, 2009 12:54 am    Post subject: Reply with quote

can you add more input fields

like have it say
1:What is the name of the first window?
2:What is the name of the first window hotkey for IMPORT?
3:What is the name of the first window hotkey for EXPORT?

REpeat the same thing with app 2 with the same question

lets say the user answered like this
1: 3dsmax
2: ctrl+I
3: ctrl+E

OK when your script runs i would like it to do this
F1 saves My-backup.obj and then save my.obj to lets say my desktop
then the app Minimize
(My-backup.obj Never gets loaded and is only there for a back up copy

press F1 again the other app Maximize
it then IMPORT my.obj ctrl+I
press F1 again then it does like the step i said above..

kind of like the one app saves it then the other app loads it
and vise verse
Back to top
View user's profile Send private message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Wed Dec 23, 2009 7:31 pm    Post subject: Reply with quote

It could be just me but I'm thinking typing in window names is error prone especially if the windows have arroneous titles. Heres a concept to select windows that store the names to memory.

Code:
ySec := -3
xMarg := 0x1f4 ;0xfa
btnTxt = Button 1,Button 2
   StringSplit, btnTxt, btnTxt,`,

Gui, Add, Text, Section vtxt1, Press button, then select the 1st Window.
Gui, Add, Button, ys%ySec% xm+%xMarg% gselW1, % btnTxt1
Gui, Add, Text, Section xm , Press button, then select the 2nd Window.
Gui, Add, Button, ys%ySec% xm+%xMarg% gselW2, % btnTxt2
Gui +AlwaysOnTop
Gui Show, NA, winSltr

Return

selW1:
selTxt = Select the 1st Window!,,
   StringSplit, selTxt, selTxt,`,

SetTimer, blinkTxt1, On
blinkTxt1:
   count++
   ControlSetText, Static1, % selTxt%count%, ahk_class AutoHotkeyGUI
   WinGetActiveTitle, acWin
   SplitPath, acWin, acWin,
   If acWin != winSltr
      {
      ControlSetText, Static1, % "Win 1 is : " acWin, ahk_class AutoHotkeyGUI
      ControlMove, Static1,,, % xMarg,, ahk_class AutoHotkeyGUI
      SetTimer, blinkTxt1, Off
      }

   Sleep, 0x1f4
      If count > 2
         count=
Return

selW2:
selTxt = Select the 2nd Window!,,
   StringSplit, selTxt, selTxt,`,

SetTimer, blinkTxt2, On
blinkTxt2:
   count++
   ControlSetText, Static2, % selTxt%count%, ahk_class AutoHotkeyGUI
   WinGetActiveTitle, acWin
   SplitPath, acWin, acWin,
   If acWin != winSltr
      {
      ControlSetText, Static2, % "Win 2 is : " acWin, ahk_class AutoHotkeyGUI
      ControlMove, Static2,,, % xMarg,, ahk_class AutoHotkeyGUI
      SetTimer, blinkTxt2, Off
      }

   Sleep, 0x1f4
      If count > 2
         count=
Return
Still a bit messy and lots of redundancy.
For instance the active window titles should be stored to an array.
Now the new window name overwrites the active window var.

Wrote on win7, not tested on XP..

hth
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Wed Dec 23, 2009 8:50 pm    Post subject: Reply with quote

TLM wrote:
It could be just me but I'm thinking typing in window names is error prone especially if the windows have arroneous titles. Heres a concept to select windows that store the names to memory.

Code:
ySec := -3
xMarg := 0x1f4 ;0xfa
btnTxt = Button 1,Button 2
   StringSplit, btnTxt, btnTxt,`,

Gui, Add, Text, Section vtxt1, Press button, then select the 1st Window.
Gui, Add, Button, ys%ySec% xm+%xMarg% gselW1, % btnTxt1
Gui, Add, Text, Section xm , Press button, then select the 2nd Window.
Gui, Add, Button, ys%ySec% xm+%xMarg% gselW2, % btnTxt2
Gui +AlwaysOnTop
Gui Show, NA, winSltr

Return

selW1:
selTxt = Select the 1st Window!,,
   StringSplit, selTxt, selTxt,`,

SetTimer, blinkTxt1, On
blinkTxt1:
   count++
   ControlSetText, Static1, % selTxt%count%, ahk_class AutoHotkeyGUI
   WinGetActiveTitle, acWin
   SplitPath, acWin, acWin,
   If acWin != winSltr
      {
      ControlSetText, Static1, % "Win 1 is : " acWin, ahk_class AutoHotkeyGUI
      ControlMove, Static1,,, % xMarg,, ahk_class AutoHotkeyGUI
      SetTimer, blinkTxt1, Off
      }

   Sleep, 0x1f4
      If count > 2
         count=
Return

selW2:
selTxt = Select the 2nd Window!,,
   StringSplit, selTxt, selTxt,`,

SetTimer, blinkTxt2, On
blinkTxt2:
   count++
   ControlSetText, Static2, % selTxt%count%, ahk_class AutoHotkeyGUI
   WinGetActiveTitle, acWin
   SplitPath, acWin, acWin,
   If acWin != winSltr
      {
      ControlSetText, Static2, % "Win 2 is : " acWin, ahk_class AutoHotkeyGUI
      ControlMove, Static2,,, % xMarg,, ahk_class AutoHotkeyGUI
      SetTimer, blinkTxt2, Off
      }

   Sleep, 0x1f4
      If count > 2
         count=
Return
Still a bit messy and lots of redundancy.
For instance the active window titles should be stored to an array.
Now the new window name overwrites the active window var.

Wrote on win7, not tested on XP..

hth


not sure what that does because its not working
i see select the first window then select the second window but now what?
it seams thats all it does.

his script works but im asking a new question see below

i want to add to his script with some more options

nostroke wrote:
can you add more input fields

like have it say
1:What is the name of the first window?
2:What is the name of the first window hotkey for IMPORT?
3:What is the name of the first window hotkey for EXPORT?

REpeat the same thing with app 2 with the same question

lets say the user answered like this
1: 3dsmax
2: ctrl+I
3: ctrl+E

OK when your script runs i would like it to do this
F1 saves My-backup.obj and then save my.obj to lets say my desktop
then the app Minimize
(My-backup.obj Never gets loaded and is only there for a back up copy

press F1 again the other app Maximize
it then IMPORT my.obj ctrl+I
press F1 again then it does like the step i said above..

kind of like the one app saves it then the other app loads it
and vise verse
Back to top
View user's profile Send private message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Thu Dec 24, 2009 12:38 pm    Post subject: Reply with quote

You mean something like this?
Code:
switchFile := A_ScriptDir "\Switch.txt"
hkeyFile := A_ScriptFullPath

F1::
FileReadLine, var1, % switchFile, 1
FileReadLine, var2, % switchFile, 2

SetTitleMatchMode, 2
IfWinActive, %var1%
{
   WinMinimize, %var1%
   Sleep, 100
   WinMaximize, %var2%
   Return
}

SetTitleMatchMode, 2
IfWinActive, %var2%
{
   WinMinimize, %var2%
   Sleep, 100
   WinMaximize, %var1%
   Return
}

Return

F3::
FileDelete, % switchFile
inputbox, var1, Window 1, What is the name of the first window?`nWindow titles are case sensitive.
inputbox, var2, Window 2, What is the name of the second window?`nWindow titles are case sensitive.
inputbox, var3, Hotkey, App 1.`nWhat is the name of the first window hotkey for IMPORT?
inputbox, var4, Hotkey, App 1.`nWhat is the name of the first window hotkey for EXPORT?
inputbox, var5, Hotkey, App 2.`nWhat is the name of the first window hotkey for IMPORT?
inputbox, var6, Hotkey, App 2.`nWhat is the name of the first window hotkey for EXPORT?

FileAppend, % swVar := var1 "`n" var2, % switchFile
FileAppend, %  hkVar := "`n`n" var3 ":`n`nReturn`n`n" var4 ":`n`nReturn`n`n" var5 ":`n`nReturn`n`n" var6 ":`n`nReturn`n`n", % hkeyFile
Reload

The script reloads with the hotkeys written to it.

Only thing is I dont have those apps so its going to be impossible for me to create a script that performs actions on the underlying apps..
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Dec 24, 2009 5:39 pm    Post subject: Reply with quote

TLM wrote:
You mean something like this?
Code:
switchFile := A_ScriptDir "\Switch.txt"
hkeyFile := A_ScriptFullPath

F1::
FileReadLine, var1, % switchFile, 1
FileReadLine, var2, % switchFile, 2

SetTitleMatchMode, 2
IfWinActive, %var1%
{
   WinMinimize, %var1%
   Sleep, 100
   WinMaximize, %var2%
   Return
}

SetTitleMatchMode, 2
IfWinActive, %var2%
{
   WinMinimize, %var2%
   Sleep, 100
   WinMaximize, %var1%
   Return
}

Return

F3::
FileDelete, % switchFile
inputbox, var1, Window 1, What is the name of the first window?`nWindow titles are case sensitive.
inputbox, var2, Window 2, What is the name of the second window?`nWindow titles are case sensitive.
inputbox, var3, Hotkey, App 1.`nWhat is the name of the first window hotkey for IMPORT?
inputbox, var4, Hotkey, App 1.`nWhat is the name of the first window hotkey for EXPORT?
inputbox, var5, Hotkey, App 2.`nWhat is the name of the first window hotkey for IMPORT?
inputbox, var6, Hotkey, App 2.`nWhat is the name of the first window hotkey for EXPORT?

FileAppend, % swVar := var1 "`n" var2, % switchFile
FileAppend, %  hkVar := "`n`n" var3 ":`n`nReturn`n`n" var4 ":`n`nReturn`n`n" var5 ":`n`nReturn`n`n" var6 ":`n`nReturn`n`n", % hkeyFile
Reload

The script reloads with the hotkeys written to it.

Only thing is I dont have those apps so its going to be impossible for me to create a script that performs actions on the underlying apps..



what does that do because i press F1 and nothing happens.

if you look at his code you dont need to write the name of the app in the code because the user does that by typing it in the input field.

lets say some one wants to use this with other apps im not aware of
so there is no way of knowing the name
Back to top
nostroke



Joined: 22 Oct 2009
Posts: 95

PostPosted: Thu Dec 24, 2009 5:39 pm    Post subject: Reply with quote

that was me above^^^^^
if its to hard how about one with the names of
ZBrush and Hexagon

upper and lower case just like that
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group