 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Wed May 14, 2008 9:27 pm Post subject: [Solved] Script to open folders... Doesn't work |
|
|
Hi everybody,
I need your help because I can't do what I want.
First, I have QTTabBar, so I only have 1 window but I have many tabs
I want to create a script that :
- opens windows explorer without the desktop in the folder tree. I want it to begin with the workstation. I have a shotcut which do this.
- open 2 folders (2 tabs) : the desktop I created (D:/Bureau) and Music (F:\Mes documents\Son). I want the desktop tab before the music tab. And I want to activate le desktop tab.
Something else I have to tell you is that when I run the shortcut to begin with the workstation, it automaticaly displays the workstation in a tab.
The problem I have is that my script doesn't close the workstation tab. And I don't want it...
So here is my script :
| Code: | #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetKeyDelay, 100
SetMouseDelay, 200
; Execute the shortcut that open a window on the workstation and hide the desktop in windows explorer folder tree
Run, C:\Program Files\AutoHotkey\Scripts\Ouvertures des dossiers\explorer
; Here is to open a new tab
Run, D:\Bureau
; Here is to open the other new tab
Run, F:\Mes documents\Son
; to activate the workstation tab and close the tab ------- DOESN'T WORK --------
;In fact, it doesn't activate the wokstation tab so it close the music tab
IfWinExist, Poste de travail
{
WinActivate, Poste de travail
Send ^w
}
; to activate the desktop tab ------ DOESN'T wORK TOO --------
IfWinExist, Bureau
{
WinActivate, Bureau
}
return |
Thank you for helping me.
Last edited by djodjolyon on Sat May 17, 2008 3:46 am; edited 1 time in total |
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Thu May 15, 2008 2:45 am Post subject: |
|
|
After thinking a little, I know why it doesn't work...
It's because I have tabs and so the commands containing "Win"(for window) can't work.
Do you know how I can get around this problem?
Thanks |
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Thu May 15, 2008 3:43 pm Post subject: |
|
|
| No idea? |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Thu May 15, 2008 5:04 pm Post subject: |
|
|
QTTabBar is a .NET Explorer add-in. All AutoHotkey "Win" commands will only work on the Explorer window, not on the tabbed windows "inside". You could try the AutoHotkey Spy program for more information, or even WindowSpy to search for messages, but I doubt you will find any useful information, so I guess you are out of luck with this one...
You could however ask the developer to add an interfacing option, so that one could use something like SendMessage to be able to select the tabs. |
|
| Back to top |
|
 |
k3ph
Joined: 21 Jul 2006 Posts: 114
|
Posted: Thu May 15, 2008 5:34 pm Post subject: |
|
|
| Quote: | | The problem I have is that my script doesn't close the workstation tab. And I don't want it... |
Don't forget to use ahk_class CabinetWClass to check the existence of qttabbar because it doesnt loads with explorer.exe stand alone mode (thats: ahk_class ExploreWClass).
Then, use the name of the window to check the unwanted tab.
Now you are ready to close the active unwanted tab using key shortcut ctrl+w or middle click on the tab. |
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Thu May 15, 2008 7:44 pm Post subject: |
|
|
Hi k3ph,
I'm just begining in autohotkey!
Can you tell me where I need to put "thats: ahk_class ExploreWClass" exactly?
Thank you |
|
| Back to top |
|
 |
k3ph
Joined: 21 Jul 2006 Posts: 114
|
Posted: Fri May 16, 2008 6:25 pm Post subject: |
|
|
| djodjolyon wrote: | ; to activate the workstation tab and close the tab ------- DOESN'T WORK --------
;In fact, it doesn't activate the wokstation tab so it close the music tab
IfWinExist, Poste de travail
{
WinActivate, Poste de travail
Send ^w
}
|
this is a working example, modify it to fit in your use:
| Code: | If WinExist("Poste de travail")
{
WinActivate
sendinput ^w
return
}
else
{
return
}
return |
| djodjolyon wrote: | ; to activate the desktop tab ------ DOESN'T wORK TOO --------
IfWinExist, Bureau
{
WinActivate, Bureau
}
return |
same, just change the name
---
| djodjolyon wrote: | | ; Execute the shortcut that open a window on the workstation and hide the desktop in windows explorer folder tree |
I really didn't understand what you meant, please explain?
---
| djodjolyon wrote: | Hi k3ph,
I'm just begining in autohotkey!
Can you tell me where I need to put "thats: ahk_class ExploreWClass" exactly?
Thank you |
what i meant was, don't confuse explorer with cabinet because qttabbar just works on cabinet. Read about ahk_class on ahk chm (aka help file).
for replacing win+e explorer with cabinet one, I use:
| Code: | #e::
Run ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ; CabinetWClass loader, thanks tic_irl
sleep 100 ; needed for tree view panel
SendMessage, 0x111, 41525,,, A ; tree view panel load
return |
|
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Fri May 16, 2008 8:51 pm Post subject: |
|
|
Thank you for answering back...
First Here is my script now as you told me :
| Code: | ; Execute the shortcut that open a window on the workstation and hide the desktop in windows explorer folder tree
Run, C:\Program Files\AutoHotkey\Scripts\Ouvertures des dossiers\explorer
; Here is to open a new tab
Run, D:\Bureau
; Here is to open the other new tab
Run, F:\Mes documents\Son
; to activate the workstation tab and close the tab ------- DOESN'T WORK --------
;In fact, it doesn't activate the wokstation tab so it close the music tab
If WinExist("Poste de travail")
{
WinActivate
sendinput ^w
return
}
else
{
return
}
If WinExist("Bureau")
{
WinActivate
sendinput ^w
return
}
else
{
return
}
return |
Then,
| Quote: |
djodjolyon wrote:
; Execute the shortcut that open a window on the workstation and hide the desktop in windows explorer folder tree
I really didn't understand what you meant, please explain?
|
Sorry for my crap English.. I'l try to explain you better.
I made a shortcut which when I click on it, open a window with windows explorer panel. The special thing with this shortcut is that the windows explorer panel begin with the workstation and not with the desktop as by default.
But when I execute the shortcut, I also have by default the workstation displayed in the windows. And I don't want this last thing. This is why I want to activate it and close it.
I made a little capture for you :
You'll understand better.
This is what I have when I execute my shortcut
| Quote: | what i meant was, don't confuse explorer with cabinet because qttabbar just works on cabinet. Read about ahk_class on ahk chm (aka help file).
for replacing win+e explorer with cabinet one, I use:
| Code: |
#e::
Run ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ; CabinetWClass loader, thanks tic_irl
sleep 100 ; needed for tree view panel
SendMessage, 0x111, 41525,,, A ; tree view panel load
return |
|
About that, I can't use it because I need my shortcut
Do you have any idea, how I can do?[/code][/img] |
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Fri May 16, 2008 10:41 pm Post subject: |
|
|
Hello again,
In fact I found the solution!
The code is here :
| Code: | #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetKeyDelay, 100
SetMouseDelay, 200
; ------------ open windows explorer without the desktop
Run, C:\Program Files\AutoHotkey\Scripts\Ouvrir le bureau\Annexes\explorer
Sleep, 250
; -------------------------------- Open the desktop
Run, D:\Bureau
Sleep, 250
; --------------------------------- Open music
Run, F:\Mes documents\Son
Sleep, 250
; ------------------ Execute the Hotkey to activate the workstation's tab
Send, #e
Sleep, 250
; ------------------------------- Close the workstation tab
Send, ^w
Sleep, 250
; -------------------------------- Active activate the desktop
Run, D:\Bureau
return |
The code for the Hotkey to activate the workstation's tab is the same you gave me
| Code: | #e::
Run ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ; CabinetWClass loader, thanks tic_irl
sleep 100 ; needed for tree view panel
SendMessage, 0x111, 41525,,, A ; tree view panel load
return |
Can I integrate the hotkeyt to the whole script and where if it's possible?
Thanks a lot k3ph |
|
| Back to top |
|
 |
k3ph
Joined: 21 Jul 2006 Posts: 114
|
Posted: Fri May 16, 2008 11:04 pm Post subject: |
|
|
| djodjolyon wrote: | Can I integrate the hotkeyt to the whole script and where if it's possible?
|
yeah, sure use gosub cabinet to trigger
example code:
| Code: | gosub cabinet ; open cabinet when the script execute
cabinet:
Run ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ; CabinetWClass loader, thanks tic_irl
sleep 100 ; needed for tree view panel and go back to desktop
SendMessage, 0x111, 41525,,, A ; tree view panel load
sendinput {backspace} ; go back to desktop
return
#e:: ; win + e replacer
gosub cabinet
return |
1- your run method uses explorer, so this is not cabinet. thats exaplains why 'desktop shortcut' isn't shown. (you can use run explorer.exe path_to_folder, it would load explorer as cabinet)
2- hmm about the desktop, you can go back using backspace from "my computer", it would show your desktop ;)
3- sleep 250 is a lot, u can reduce. you already got delay on keypress that makes too slow.
4- #e:: works flawlessy. you need to press win+e to load the cabinet explorer, it shows desktop shortcut. take a look:
DO NOT try to load a CLSID trying to run at url bar, it WILL NOT RUN ;)
5- advantages of #e:: opening cabinet explorer + tree view: if i want to hide tree view, i just need to press again win+e, mantaining only one main "explorer" window
offtopic: the reason i dont use toolbars
| Code: | #IfWinActive ahk_class CabinetWClass
esc::
send ^w
return
capslock::
send {backspace}
return
+capslock::
send {alt down}{left}{alt up}
return
#IfWinActive |
so i can go back using capslock and/or return from history using shift + capslock (this idea was ripped from colemak) |
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Sat May 17, 2008 3:46 am Post subject: |
|
|
| Quote: | | your run method uses explorer, not cabinet thats why desktop shortcut isn't shown. | I didn't want to see the desktop on the windows explorer panel. That's why I put my shortcut at the begining of the script! Because I don't use it actually.
| Quote: | | sleep 250 is a lot, u can reduce. you already got delay on keypress that makes too slow. | It goes faster now I reduced!!!!!
Thank you for the lesson you gave me. I didn't use it for that but I keep it in my mind for further scripts.
My final script is this one. It works as I wanted.
| Code: | ; ------------ open windows explorer without the desktop
Run, C:\Program Files\AutoHotkey\Scripts\Ouvrir le bureau\Annexes\explorer
Sleep, 100
; -------------------------------- Open the desktop's tab
Run, D:\Bureau
; --------------------------------- Open music's tab
Run, F:\Mes documents\Son
; ------------------ Activate the workstation tab
Run ::{20d04fe0-3aea-1069-a2d8-08002b30309d}
Sleep, 200
; ------------------------------- Close the workstation tab
Send, ^w
Sleep, 200
; -------------------------------- Active activate the desktop
Run, D:\Bureau
return |
BIG THANK YOU K3ph for your help!!!  |
|
| 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
|