AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: March 18th, 2010, 6:14 am 
Offline

Joined: January 4th, 2010, 9:40 am
Posts: 22
how do you modify the save as and open dialogue boxes to e.g.
show all files when using a certain program, and to always show the same folder to open or save to, when using a specific program.
Does this need to be done in the registry for each program.

using vista home premium.
xp used to automatically keep these settings, but vista has problems with this and its a pain.

john


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 11:37 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6071
Location: San Diego, California
you are talking about programs external to Ahk, right?

Doesn't the program in question 'learn' where you want the files stored or opened from?

Some programs have a configuration setting for these parameters.

If there is no such configuration, you need to write a routine that waits for the dialog box and tweaks the controls on that dialog box.

take a look at this example for some ideason how to wait and tweak:
http://www.autohotkey.com/docs/scripts/ ... nNames.htm

But first:
Start with opening up Window Spy (in the Ahk directory) and looking at the name and class of the dialog window and the name of the control.

For notepad, in vista, I see the dialog as "Save As" with ahk_class #32770
save as type is ClassNN: ComboBox1


Code:
f1::
; this sets the file type to All
Control, ChooseString, All, ComboBox2, Save As ahk_class #32770

; I had to click the control to get to the state where I could send text to the addressbar

ControlGetPos, X, Y, W, H, Edit2, Save As ahk_class #32770
mousemove, x+w/2+100,y+h/2, 10
click

; now the data is in a normal file address 'folder' format
;ControlClick , Edit2, Save As ahk_class #32770,, Left
sleep, 500
ControlSend , Edit2, ^a, Save As ahk_class #32770
sleep, 500
ControlSend , Edit2, {DEL}, Save As ahk_class #32770
sleep, 500
ControlSend , Edit2, {shift down}c:{shift up}\, Save As ahk_class #32770
sleep, 500
ControlSend , Edit2, {ENTER}, Save As ahk_class #32770
return

Try reviewing these instructions, can you see the purpose of the commands?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 11:44 am 
FileOpenPatcher: http://www.netcult.ch/elmue/ElmueSoft-en.htm ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 11:50 am 
Quote:
Edit the Places bar locations in 'Open/Save As' common dialog boxes

Published: June 27, 2004
Updated : Aug 03, 2005

The Places bar locations in a Common Dialog (Open/Save As) boxes can be customized to your choice of folders. To do so, try the following methods:

Open Registry Editor and navigate to:

HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ comdlg32 \ Placesbar

By default the Placesbar key is not present; you need to create one.

Create a String value for it named Place0. Place0 is the top-most folder as it appears on the Open/Save As dialog. Type the folder name with it's full path as the value of Place0. You can create similar keys and values upto Place4. Sample places bar registry key in my system:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\comdlg32\PlacesBar]
"Place0"="e:\\XP Utils"
"Place1"="e:\\research"
"Place2"="e:\\Registry Patches"
"Place3"="e:\\UtilitiesSet 2"
"Place4"="e:\\UtilitiesSet 1"
Combined with IfWinActive you could try to update that reg settings on-the-fly to create app related "save-as"-profiles. Good luck 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 11:56 am 
Another thing you could have a try: autoselect another view option.
Quote:
Open a common dialog box, change the view to the one you want, and then
hit Ctrl/Cancel. Yes, it's counterintuitive, but this solution is in Ed
Bott's book "Windows XP Inside and Out" and it works.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 12:04 pm 
http://www.howtogeek.com/howto/windows/ ... indows-xp/


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 12:58 pm 
The registry contains some file extension related settings which seems to influence OpenSave dialogs:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\txt

So if you open Notepad (the standard assigned app for txt files) and you run this code, before you call the Open/Save-dialog ...
Code:
RegWrite, Reg_SZ, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\txt, k, c:\mydir\mysubdir ; change this path !
RegWrite, Reg_SZ, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\txt, MRUList, kabcdefghij
... the dialog will open at YOUR path (hopefully :D).

I guess if you do the same for the 'extension' > * < (All files) it'll work the same for unassigned file extensions.

Good luck 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 5:59 pm 
Offline

Joined: January 4th, 2010, 9:40 am
Posts: 22
Leef_me, was playing with your code, works good, still trying to understand it.

this is what i came up with last week, its crude and needs some work. took hours of guessing, but was hoping for a registry fix,

problem with code below is i need the combox number to be able to change to 2 or 3 depending on the program, but windows spy does not show this unless i click on the save as type: box.
do i need to write a list of various programs, so if notepad combobox = 2, or if vidredo combobox = 3 e.t.c.

i just wanted to click on the window of the prog i was using, and it automatically would get the open window to show all files when pressing f1 or save when pressing f2,


"WinMenuSelectItem, ahk_class %aTitle%, , 1&, 1&," this part of the code needs changing as different progs use different menu values.

or i could use a simpler method using ctrl+o or ctrl+s


Code:
f1::



;MsgBox, The text is:`n%OutputVar%
WinGetClass, aTitle, A
;MsgBox, The active window is "ahk_class %aTitle%".



WinMenuSelectItem, ahk_class %aTitle%, , 1&, 1&,


MouseClick, left,  918,  589; click anywhere on the window

sleep,100
WinGetClass, bTitle, A
;MsgBox, The active window is "ahk_class %bTitle%".
;WinMenuSelectItem, ahk_class %bTitle%,   



ControlClick, ComboBox3, ahk_class %bTitle%, ;All Files

Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN} ;pathetic peice of code, as all files are usually at the bottom
Send, {ENTER}





murx, do i change registry keys of a specific program, i use a video editing program, and the main files i open do not have a
file name extension, this is why i need the folder to show all files.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 7:15 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6071
Location: San Diego, California
beetlejuice wrote:
do i need to write a list of various programs, so if notepad combobox = 2, or if vidredo combobox = 3 e.t.c.
AFAIK, Yes.

Quote:
or i could use a simpler method using ctrl+o or ctrl+s
sccriptwriter's choice.

Quote:
ControlClick, ComboBox3, ahk_class %bTitle%, ;All Files
Ahh, no, terrible thing :wink:

Quote:
Code:
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN} ;pathetic peice of code, as all files are usually at the bottom
Send, {ENTER}

Send, {DOWN 10}
or
Send, {DOWN 12}
or
Send, {PgDn}

Quote:
murx, do i change registry keys of a specific program, i use a video editing program, and the main files i open do not have a
file name extension, this is why i need the folder to show all files.

Are you sure the O.S. isn't just hiding the extension from you ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 8:53 pm 
Quote:
and the main files i open do not have a
file name extension
As Leef_me said, it could be that the extension is handled as 'hide known file extensions" were "known" means already assigned to an app. I expect that means that once you select the open dialog in Excel it'll offer you xls, while for W(inw)ord it'll show you doc, Notepad --> txt, Adobe Acrobat --> pdf, ...


Report this post
Top
  
Reply with quote  
 Post subject: -
PostPosted: March 19th, 2010, 3:50 pm 
Offline

Joined: January 4th, 2010, 9:40 am
Posts: 22
slowly getting there,

Code:
f1::

MouseClick, left, 100, 10 ; click anywhere on the window
DetectHiddenWindows on
sleep,10

WinGetClass, aTitle, A
IfWinActive, ahk_class Notepad

{

comboboxx = ComboBox2
WinMenuSelectItem, ahk_class %aTitle%, , File, open
sleep, 10

if WinExist("Notepad")
 {
    MouseClick, left,  230,  104
Sleep, 10
}

sleep, 10

IfWinActive, ahk_class VideoReDoClass

{
WinMenuSelectItem, ahk_class %aTitle%, , File, open video

comboboxx = ComboBox3


}
MouseClick, left, 500, 500 ; click anywhere on the window
sleep,10
 
Control, ChooseString, All, %comboboxx%, Open ;ahk_class #32770

return

f2::

MouseClick, left, 100, 10 ; click anywhere on the window

sleep,10
WinGetClass, aTitle, A
IfWinActive, ahk_class Notepad
{

comboboxx = ComboBox2
WinMenuSelectItem, ahk_class %aTitle%, , File, save as
sleep, 200

if WinExist("Notepad")
 {
    MouseClick, left,  230,  104
Sleep, 10
}
sleep, 10
IfWinActive, ahk_class VideoReDoClass
{
WinMenuSelectItem, ahk_class %aTitle%, , File, save video as
comboboxx = ComboBox3

}

MouseClick, left, 500, 500 ; click anywhere on the window
sleep,10
Control, ChooseString, All , %comboboxx%, Save As ahk_class #32770





Much easier to save and open.
just need to add more programs.
Thanks all for the help. john


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

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