Page 1 of 1
Faster opening a set of folders (or disks / partitions)
Posted: 31 May 2023, 13:16
by loek6000
I did make a script which opens 3 explorer folders of my drives / partitions
Is there a faster way to open up these explorer windows? Now it relatively slow because of the sleeps.
Code: Select all
runwait C:\
WinWaitActive, C:\
WinMove, C:\,, 50, 50, 1700, 2033
sleep 50
runwait D:\
WinWaitActive, D:\
WinMove, D:\,, 1740, 50, 1700, 2033
sleep 200
runwait W:\
sleep 500
WinWaitActive, W:\
WinMove, W:\,, 3430, 50, 1700, 2033
return
Re: Faster opening a set of folders (or disks / partitions)
Posted: 31 May 2023, 13:38
by RussF
This worked for me:
Code: Select all
Run C:\
WinWaitActive, Local Disk (C:)
WinMove, Local Disk (C:),, 50, 50, 500, 500
Run D:\
WinWaitActive, DATA (D:)
WinMove, DATA (D:),, 75, 75, 500, 500
Adjust the WinTitles and coordinates to suit you. Wintitles are case sensitive - see
WinTitle.
Russ
Re: Faster opening a set of folders (or disks / partitions)
Posted: 31 May 2023, 14:51
by colt
This is as fast as i could get it. It only takes 400ms if the windows already exist. It will just move them to the proper position
Code: Select all
#NoEnv
#SingleInstance Force
SetBatchLines -1
start := a_tickCOunt
winData := []
;spawn all windows at same time to take advantage of parallel processing
Run, C:\
winData.push({title:"C:\",pos:{x:50,y:50,w:1700,h:2033}})
Run, D:\
winData.push({title:"D:\",pos:{x:1740,y:50,w:1700,h:2033}})
Run, W:\
winData.push({title:"W:\",pos:{x:3430,y:50,w:1700,h:2033}})
;wait for windows here
scanCount := 0
hitCount := 0
targetCount := winData.count()
loop
{
scanCount++
for index,data In winData
{
if(data) ;still need to place
{
;msgbox % winExist(data.title)
if(winExist("ahk_exe explorer.exe",data.title) != "0x0") ;will ensure only explorer windows are snagged
{
hitCount++
winMove % data.title ,, % data.pos.x, % data.pos.y, % data.pos.w, % data.pos.h
winData[index] := "" ;clear pos data this window has been placed
}
}
}
if(hitCount == targetCount) ;everything placed so exit
{
break
}
sleep 18 ;tune speed here. this was sweet spot for me. got under 1s launch time, not having sleep was 1300ms
}
msgbox % "all windows placed scanned " . scanCount . " times.`nTicks elapsed : " . a_tickCOunt - start
Re: Faster opening a set of folders (or disks / partitions)
Posted: 01 Jun 2023, 00:54
by loek6000
Thanx both
I used
@colt script
this was exactly what i wanted
Re: Faster opening a set of folders (or disks / partitions)
Posted: 01 Jun 2023, 08:31
by mikeyww
Just a clarification: while some parts of WinTitle may not be case-sensitive, the window title is case-sensitive (without the "i)" option for RegEx).