AutoHotkey Community

It is currently May 27th, 2012, 2:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: November 25th, 2009, 12:53 am 
Offline

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

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2009, 1:37 am 
Offline

Joined: November 22nd, 2009, 1:54 am
Posts: 28
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2009, 2:48 am 
Offline

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

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2009, 3:00 am 
Offline

Joined: November 22nd, 2009, 1:54 am
Posts: 28
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2009, 3:10 am 
Offline

Joined: March 10th, 2008, 12:55 am
Posts: 1907
Location: Minnesota, USA
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) :oops:

Asking for help is not the same as requesting/begging/demanding code.
But.... nice to see you actually tried :D thats nice.

_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
"I think Bigfoot is blurry, that's the problem. It's not the photographer's fault, Bigfoot is blurry. So there's a large, out-of-focus monster roaming the countryside."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 2:19 am 
Offline

Joined: November 22nd, 2009, 1:54 am
Posts: 28
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 9:14 am 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 355
Location: Germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 9:19 am 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
Code:
Run,C:\scriptural_data
?
Then Winmove the windows to left or right hand.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 9:22 am 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 12:09 pm 
Offline

Joined: October 25th, 2009, 6:10 pm
Posts: 17
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 4:28 pm 
Offline

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

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 1:31 pm 
Offline

Joined: October 25th, 2009, 6:10 pm
Posts: 17
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Layout Macro 2
PostPosted: November 30th, 2009, 2:07 am 
Offline

Joined: November 22nd, 2009, 1:54 am
Posts: 28
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Layout Macro 2
PostPosted: November 30th, 2009, 6:55 am 
Offline

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

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2010, 2:22 pm 
Offline

Joined: November 22nd, 2009, 1:54 am
Posts: 28
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


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], rbrtryn, Yahoo [Bot] and 30 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