 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Tue Nov 24, 2009 11:53 pm Post subject: |
|
|
Does the 1st loop, 10 run My Computer actually open 10 My Computer windows?
If not then you could remove the Loop 10 section and add my bulcky workaround .
If so you can keep your version.
| Composer wrote: | | 1) I need 10 x My Computer directories opened, 5 on the Left hand side of the Screen and 5 on the middle right side so I can swap files from 5 instances of C:/scriptural_data to 5 instances of G:/Scriptural_data folders. |
I have to mention again, you should be using FileMove to swap the files.
Just a thought. _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
Composer
Joined: 22 Nov 2009 Posts: 28
|
Posted: Wed Nov 25, 2009 12:37 am Post subject: |
|
|
Haven't yet tried to see if 10 My computers open.
Would the combined Code now be -
Loop 4
Run, iexplore.exe
Run, msimn.exe
Run, C:\Program Files\WordWeb\wwnotray.exe
Run, C:\Documents and Settings\Robert\Start Menu\Programs\Pocket Oxford Dictionary
Run, C:\sm_bible\smw.exe,C:\sm_bible
Run, C:\program files\Commander\efcw.exe
Run, C:\Program Files\NET Bible First Edition\netbible.chm
Run, C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft FrontPage
Num=
Loop, 10
{
Num++
FileCreateDir, % A_Desktop "\Folder" Num
Run, % A_Desktop "\Folder" Num
WinWait, % "Folder" Num
IfWinExist, % "Folder" Num
ControlSetText, Edit1, My Computer, % "Folder" Num
ControlClick, ToolbarWindow321, % "Folder" Num
WinWait, My Computer
WinGet, mcPID, PID, My Computer
Sleep, 500
FileRemoveDir, % A_Desktop "\Folder" Num
if Num <= 5
{
WinWait, My Computer
WinMove, My Computer,,0, 0, % A_ScreenWidth / 2
}
Else
{
WinWait, My Computer
WinMove, My Computer,,% A_ScreenWidth / 2, 0, % A_ScreenWidth / 2
}
}
ToolTip
Thanks |
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Wed Nov 25, 2009 1:48 am Post subject: |
|
|
| Composer wrote: | | Haven't yet tried to see if 10 My computers open. |
You should try that 1st!
You may run into strange behavior with multiple lines under a loop that are not in a block.
I really suggest testing out different configerations to see what works for you. _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
Composer
Joined: 22 Nov 2009 Posts: 28
|
Posted: Wed Nov 25, 2009 2:00 am Post subject: |
|
|
It seems to work, I typed -
Loop, 10
{
Num++
FileCreateDir, % A_Desktop "\Folder" Num
Run, % A_Desktop "\Folder" Num
WinWait, % "Folder" Num
IfWinExist, % "Folder" Num
ControlSetText, Edit1, My Computer, % "Folder" Num
ControlClick, ToolbarWindow321, % "Folder" Num
WinWait, My Computer
WinGet, mcPID, PID, My Computer
Sleep, 500
FileRemoveDir, % A_Desktop "\Folder" Num
if Num <= 5
{
WinWait, My Computer
WinMove, My Computer,,0, 0, % A_ScreenWidth / 2
}
Else
{
WinWait, My Computer
WinMove, My Computer,,% A_ScreenWidth / 2, 0, % A_ScreenWidth / 2
}
}
ToolTip
Although it worked I forgot to include Num= (is that important?)
What do I do next, add the other part of the Code? -
Loop 4
Run, iexplore.exe
Run, msimn.exe
Run, C:\Program Files\WordWeb\wwnotray.exe
Run, C:\Documents and Settings\Robert\Start Menu\Programs\Pocket Oxford Dictionary
Run, C:\sm_bible\smw.exe,C:\sm_bible
Run, C:\program files\Commander\efcw.exe
Run, C:\Program Files\NET Bible First Edition\netbible.chm
Run, C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft FrontPage
Thanks |
|
| Back to top |
|
 |
tidbit
Joined: 09 Mar 2008 Posts: 1808 Location: Minnesota, USA
|
Posted: Wed Nov 25, 2009 2:10 am Post subject: |
|
|
Use code tags when posting code, like everyone else.
| Quote: | | Instead it should be called " Do it all yourself help forum " 'cos that's all the help you are going to get from here. |
Actually, this forum is called "Ask For Help" and not "Give Me Code". So when we the helpers actually tell you where to look and how to do it while NOT giving you code, we are actually doing what we should. It's just people want others to do everything for them. But when they have to work for it, they get all mad and yell at us for not "helping" (doing it all)
Asking for help is not the same as requesting/begging/demanding code.
But.... nice to see you actually tried thats nice. _________________ rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb |
|
| Back to top |
|
 |
Composer
Joined: 22 Nov 2009 Posts: 28
|
Posted: Thu Nov 26, 2009 1:19 am Post subject: |
|
|
I have now basically got all working almost how I want, great. -
Loop 4
Run, iexplore.exe
Run, msimn.exe
Run, C:\Program Files\WordWeb\wwnotray.exe
Run, C:\sm_bible\smw.exe,C:\sm_bible
Run, C:\pod\pod.exe
Run, C:\program files\Commander\efcw.exe
Run, C:\Program Files\NET Bible First Edition\netbible.chm
Run, C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft FrontPage
Num=
Loop, 10
{
Num++
FileCreateDir, % A_Desktop "\Folder" Num
Run, % A_Desktop "\Folder" Num
WinWait, % "Folder" Num
IfWinExist, % "Folder" Num
ControlSetText, Edit1, My Computer, % "Folder" Num
ControlClick, ToolbarWindow321, % "Folder" Num
WinWait, My Computer
WinGet, mcPID, PID, My Computer
Sleep, 500
FileRemoveDir, % A_Desktop "\Folder" Num
if Num <= 5
{
WinWait, My Computer
WinMove, My Computer,,0, 0, % A_ScreenWidth / 2
}
Else
{
WinWait, My Computer
WinMove, My Computer,,% A_ScreenWidth / 2, 0, % A_ScreenWidth / 2
}
}
ToolTip
- - - -
How do I get the 5 left hand (LHS) My computer directories to Open in a specific Folder - C:\scriptural_data
And the 5 folders on the Right hand side (RHS) to open in G:\scriptural_data ?
Sorry, & can a routine be made to close all these commands down when I have finished the session and want to shut down till next time?
Thanks |
|
| Back to top |
|
 |
hd0202
Joined: 13 Aug 2006 Posts: 265 Location: Germany
|
Posted: Thu Nov 26, 2009 8:14 am Post subject: |
|
|
Hi,
why will you close those 10 folders at logoff? Let Windows himself open them again at logon,
set Restore previous folder windows at logon
in Tools - Folder Options - View
Hubert |
|
| Back to top |
|
 |
aaffe
Joined: 17 May 2007 Posts: 1002 Location: Germany - Deutschland
|
Posted: Thu Nov 26, 2009 8:19 am Post subject: |
|
|
| Code: | | Run,C:\scriptural_data | ?
Then Winmove the windows to left or right hand. |
|
| Back to top |
|
 |
aaffe
Joined: 17 May 2007 Posts: 1002 Location: Germany - Deutschland
|
Posted: Thu Nov 26, 2009 8:22 am Post subject: |
|
|
| Quote: | | Sorry, & can a routine be made to close all these commands down when I have finished the session and want to shut down till next time? |
Or you try Winclose or Winkill. |
|
| Back to top |
|
 |
gunns256
Joined: 25 Oct 2009 Posts: 17
|
Posted: Thu Nov 26, 2009 11:09 am Post subject: |
|
|
Here's code that I use to open a work session and then later close a work session. It does not do everything you want.
My code is specific to my needs, and many of my ideas are stupid. (I am a newbie.) Frankly, the startup script needs tuning up (the msgbox, Wait 10 does not work well). However, you may get some of the stuff you need.
I'm using Regex title matching in the closedown, because when I am finished with Chapter 9, I will move on to Chapter 10. Also I will have created windows with titles like "9.3"
gunns256
| Code: | ::/morningppt::
run powerpnt.exe
run F:\My Documents\Highland_Park\8 Algebra\Carnegie Algebra 0809\Chapter\Chapter 09\Algebra I Teacher Implementation Guide Volume 2 chapter 09.pdf
run C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe "F:\My Documents\Highland_Park\8 Algebra\Carnegie Algebra 0809\Chapter\Chapter 09\Algebra I Teacher Implementation Guide Volume 2 chapter 09.pdf"
run F:\My Documents\Highland_Park\8 Algebra\Carnegie Algebra 0809\Chapter\Chapter 09\
run F:\My Documents\Highland_Park\8 Algebra\CarnegiePPT\
msgbox, Wait 10
sleep,10000
SetTitleMatchMode, 2
winactivate, Foxit
sleep,200
send,^m
WinWait,ZoomTo
send,200{enter}
sleep,200
send,!7
sleep,200
send,+^n
SetTitleMatchMode, 1
return
::/closemorningppt::
SetTitleMatchMode, 2
IfWinActive, PowerPoint
{
WinActivate, PowerPoint
WinClose, PowerPoint
IfWinActive, ahk_class #32770, Do you want to save the changes you made
{
msgbox,1,Save or Escape?, Save or Escape?
IfMsgBox, OK
{
msgbox buh
send, y
}
IfMsgBox, Cancel
{
msgbox fud AND buh
send, {esc}
SetTitleMatchMode, 1
Return
}
}
}
IfWinExist, Adobe Reader
{
winclose, Adobe Reader
}
IfWinExist, Foxit
{
winclose, Foxit
}
IfWinExist, CarnegiePPT
{
winclose, CarnegiePPT
}
SetTitleMatchMode, regex
IfWinExist, Chapter \d.*
{
winclose, Chapter \d.*
}
ifwinexist, \d.*[.]\d.*
{
;msgbox, bobo
winclose, \d.*[.]\d.*
}
SetTitleMatchMode, 1
return |
|
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Thu Nov 26, 2009 3:28 pm Post subject: |
|
|
| gunns256 wrote: | Here's code that I use to open a work session and then later close a work session.
| Code: | .....
run powerpnt.exe
run F:\My Documents\Highland_Park\8 Algebra\Carnegie Algebra 0809\Chapter\Chapter 09\Algebra I Teacher Implementation Guide Volume 2 chapter 09.pdf
run C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe "F:\My Documents\Highland_Park\8 Algebra\Carnegie Algebra 0809\Chapter\Chapter 09\Algebra I Teacher Implementation Guide Volume 2 chapter 09.pdf"
.....
::/closemorningppt::
SetTitleMatchMode, 2
IfWinActive, PowerPoint
{
WinActivate, PowerPoint
WinClose, PowerPoint
IfWinActive, ahk_class #32770, Do you want to save the changes you made
{
msgbox,1,Save or Escape?, Save or Escape?
IfMsgBox, OK
{
msgbox buh
send, y
}
IfMsgBox, Cancel
{
msgbox fud AND buh
send, {esc}
SetTitleMatchMode, 1
Return
}
}
}
IfWinExist, Adobe Reader
{
winclose, Adobe Reader
}
IfWinExist, Foxit
{
winclose, Foxit
}
IfWinExist, CarnegiePPT
{
winclose, CarnegiePPT
}
..... |
|
Heres a cleanup for Adobe Acrobat and PowerPoint. I'm assuming your using Acrobat reader.
| Code: | SetTitleMatchMode, 2
; Change the dir/name of pdfDir to the dir/name of your acrobat file.
pdfDir = % A_Desktop "\Test.pdf"
Run, % pdfDir
WinWait, Acrobat Reader
WinGet, acroPid, PID, Acrobat Reader
; Change the dir/name of pprDir to the dir/name of your PowerPoint version.
; Assuming Acrobat on your system is the default PDF reader, you should not need to open Acrobat 1st.
pptDir = % A_ProgramFiles "\Microsoft Office\Office10"
Run, % pptDir "\POWERPNT.EXE",,, pptPid
WinWait, Microsoft PowerPoint
; For your shutdown Hotstring (following Msgbox can be removed).
Msgbox, % "PowerPoint's PID is: " pptPid "`nAdobeAcrobat PID is: " acroPid "`n`nPress OK to close them."
Process, Close, %acroPid% ; Used instead of WinClose, ahk_pid %acroPid%. AcrobatReader does not need to save 1st.
WinClose, ahk_pid %pptPid%
WinWait, ahk_class #32770,, 5
ControlClick, Button1, ahk_class #32770, |
Remember to change the dir's and app names to ones on your system . _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
gunns256
Joined: 25 Oct 2009 Posts: 17
|
Posted: Fri Nov 27, 2009 12:31 pm Post subject: |
|
|
Thanks. I have been aware of people using pids in their work, but haven't followed up on it yet. Happy Thanksgiving, if you're from USA. Or even if you're not.
gunns256 |
|
| Back to top |
|
 |
Composer
Joined: 22 Nov 2009 Posts: 28
|
Posted: Mon Nov 30, 2009 1:07 am Post subject: Layout Macro 2 |
|
|
Ok, I have got my 1st Macro sorted reasonably well.
Now on my 2nd Computer I would like to have 3 My Computer's Open, each one taking 1/3rd of the Screen space.
Far left C:\m
Centre F:\G_drive_backup\m
Right side G:\m
i am a Composer of Music and need to transfer files from C:m - F:\G_drive_backup\m - G:\m
Ideally even 3 My Computers open and 1 instance of My Network places\m
Any help appreciated. I did try editing the other Code but I get the C| in the middle and the G:\ on the left and a message saying F:\ is not a directory?
Thanks |
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Mon Nov 30, 2009 5:55 am Post subject: Re: Layout Macro 2 |
|
|
| Composer wrote: | | Now on my 2nd Computer I would like to have 3 My Computer's Open, each one taking 1/3rd of the Screen space. |
To start off, heres a simple method to divide the screen and get coordinates.
| Code: | posDiv = 0
Loop, 3
{
cursPos .= "Screen Position " A_Index ": " posDiv "`n"
posDiv += round(A_ScreenWidth / 3)
}
Msgbox, % "Screen Divded into 1/3rd`n`n" cursPos |
Use the positions to move the windows ..
hth _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
Composer
Joined: 22 Nov 2009 Posts: 28
|
Posted: Mon Apr 26, 2010 1:22 pm Post subject: |
|
|
Sorry to get back so late I had to let it go as I couldn't make it work properly.
I get error message using the following -
posDiv = 0
Loop, 3
{
cursPos .= "Screen Position " A_Index ": " posDiv "`n"
posDiv += round(A_ScreenWidth / 3)
}
Msgbox, % "Screen Divded into 1/3rd`n`n" cursPos
Loop, 4 {
Run, iexplore.exe, ,Max
}
Sleep, 5000
Run, msimn.exe, ,Min
Run, C:\Program Files\WordWeb\wwnotray.exe, ,Min
Run, C:\sm_bible\smw.exe,C:\sm_bible, ,Min
Run, C:\program files\Commander\efcw.exe, ,Min
; Run, C:\pod\pod.exe, C:\pod\,Min
Run, C:\Program Files\NET Bible First Edition\netbible.chm, ,Min
Run, C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft FrontPage, ,Min
Sleep, 5000
Loop, 4 {
Run, explorer.exe /n`,C:\scriptural_data,,
Sleep, 2000
WinMove, scriptural_data,,0, 0, % A_ScreenWidth / 3
Run, explorer.exe /n`,F:\scriptural_data,,
Sleep, 2000
WinMove, scriptural_data,,% A_ScreenWidth / 3, 0, % A_ScreenWidth / 3
Run, explorer.exe /n`,G:\scriptural_data,,
Sleep, 2000
WinMove, scriptural_data,,% A_ScreenWidth / 3, 0, % A_ScreenWidth / 3
}
-------------------------------
I tried on my own using -
Loop, 4 {
Run, iexplore.exe, ,Max
}
Sleep, 5000
Run, msimn.exe, ,Min
Run, C:\Program Files\WordWeb\wwnotray.exe, ,Min
Run, C:\sm_bible\smw.exe,C:\sm_bible, ,Min
Run, C:\program files\Commander\efcw.exe, ,Min
; Run, C:\pod\pod.exe, C:\pod\,Min
Run, C:\Program Files\NET Bible First Edition\netbible.chm, ,Min
Run, C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft FrontPage, ,Min
Sleep, 5000
Loop, 4 {
Run, explorer.exe /n`,C:\scriptural_data,,
Sleep, 2000
WinMove, scriptural_data,,0, 0, % A_ScreenWidth / 3
Run, explorer.exe /n`,F:\scriptural_data,,
Sleep, 2000
WinMove, scriptural_data,,% A_ScreenWidth / 3, 0, % A_ScreenWidth / 3
Run, explorer.exe /n`,G:\scriptural_data,,
Sleep, 2000
WinMove, scriptural_data,,% A_ScreenWidth / 3, 0, % A_ScreenWidth / 3
It may be a long winded way but it did work except the G:\scriptural_data directories all overlapped the F:\scriptural_data directories in the middle 1/3rd of the screen?
I need to just get the 4 x G:\scriptural_data directories to shift to the far right 1/3rd of the screen and it will be great!
Please help refine?
Thanks |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|