AutoHotkey Community

It is currently May 26th, 2012, 10:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: October 23rd, 2009, 8:52 pm 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 12:04 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 2:55 am 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
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:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 3:52 am 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
AH HUH
found the fixs :lol:
Code:
Click %x% %y%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 4:11 am 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
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 _______


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 4:32 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 4:48 am 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 5:00 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
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)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2009, 5:21 am 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
im really truly amazed :shock:
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)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2009, 1:54 am 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2009, 8:31 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
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

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2009, 9:50 pm 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 24th, 2009, 1:38 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
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..

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 24th, 2009, 6:39 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 24th, 2009, 6:39 pm 
Offline

Joined: October 22nd, 2009, 10:26 pm
Posts: 95
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: AndyJenk, hyper_, JSLover, Leef_me, patgenn123, rbrtryn, XstatyK and 71 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group