Hi,
I would like to change my file association/ file extension or to open my file with other applications.
Example
When I click on .txt or .doc or .docx files it opens my openoffice software instead.
Hmm..any ideas?
Thank you all.
[/u]

Change File Association/File Extension or Open with..
Started by
Esther 21
, Apr 15 2010 03:45 AM
18 replies to this topic
#1
-
Posted 15 April 2010 - 03:45 AM

On XP
Tools :arrow: Folder Options
Select file types tab
Find the extension and select it
Click Change button and select your new program
Tools :arrow: Folder Options
Select file types tab
Find the extension and select it
Click Change button and select your new program
#2
-
Posted 15 April 2010 - 03:52 AM

also look into the following command prompt commands:
ftype
assoc
You can use that, and can write a script with autohotkey to reassociate your programs if you like. I have a script that does so for my portable programs on my flash drive for when I go to school. (they have a program that changes all settings back to how they have it setup, so my changes don't stay around like they would normally).
<!-- m -->http://ss64.com/nt/<!-- m -->
ftype
assoc
You can use that, and can write a script with autohotkey to reassociate your programs if you like. I have a script that does so for my portable programs on my flash drive for when I go to school. (they have a program that changes all settings back to how they have it setup, so my changes don't stay around like they would normally).
<!-- m -->http://ss64.com/nt/<!-- m -->
#3
-
Posted 15 April 2010 - 04:52 AM

Hi
Thanks for you all for you reply, but if is possible if i write them into a AutoHotKey script? So there when ever i just click on the file (txt or doc or docx) i am able to open with open office?
Thanks for you all for you reply, but if is possible if i write them into a AutoHotKey script? So there when ever i just click on the file (txt or doc or docx) i am able to open with open office?
#4
-
Posted 15 April 2010 - 06:23 AM

>>Thanks for you all for you reply, but if is possible if i write them into a AutoHotKey script?
It seems like you did not understand. You got 2 different answers but you did not pick the one you want. You just stated that you wanted a script.
Which do you want? :roll:
It seems like you did not understand. You got 2 different answers but you did not pick the one you want. You just stated that you wanted a script.
Which do you want? :roll:
#5
-
Posted 15 April 2010 - 06:35 AM

Hi Leef_me,
Its you, Thanks for replying.. hehe. I understand what "None" is saying but i wish to do the same steps using AutoHotkey not doing it manually .
And for CodyBear, i am not really good in cmd but i did read the website CodyBear stated however wasn't too clear about it.
Below is the code i written, i am still missing out the "open with" command.
Mbutton::
Send ^c
fn=%clipboard%
Ext:=Substr(fn,-3) ; detect the extension
myNotepad =.txt
If Ext =%myNotepad%
{...Read from INI File...notepad = .doc }
Splitpath, fn,,dir,,name_no_ext
new = %dir%\%name_no_ext%%notepad%
run new ;
-> but missing out "open with" command...
Its you, Thanks for replying.. hehe. I understand what "None" is saying but i wish to do the same steps using AutoHotkey not doing it manually .
And for CodyBear, i am not really good in cmd but i did read the website CodyBear stated however wasn't too clear about it.
Below is the code i written, i am still missing out the "open with" command.
Mbutton::
Send ^c
fn=%clipboard%
Ext:=Substr(fn,-3) ; detect the extension
myNotepad =.txt
If Ext =%myNotepad%
{...Read from INI File...notepad = .doc }
Splitpath, fn,,dir,,name_no_ext
new = %dir%\%name_no_ext%%notepad%
run new ;
-> but missing out "open with" command...
#6
-
Posted 15 April 2010 - 07:25 AM

Would you please edit your post and put your script contents within [code][/code] tags
The way you have written your script suggests to me that the subject title you chose was very poor.
It seems like you just want to open a file with whatever program you write into the script.
Btw, you comments {...} and " -> " are terrible to try to understand.
The way you have written your script suggests to me that the subject title you chose was very poor.
It seems like you just want to open a file with whatever program you write into the script.
Btw, you comments {...} and " -> " are terrible to try to understand.
#7
-
Posted 15 April 2010 - 09:25 AM

Hi Leef_me,
I chosen this title as this was what I am trying to do, so i thought to be concise. Anyway i have make changes to the post hope this helps.
Leef_me, I am trying to have something similar to Windows "open with" command but using AutoHotkey insted. Hmm..
Thank You all for your replies. I am open to suggestion
I chosen this title as this was what I am trying to do, so i thought to be concise. Anyway i have make changes to the post hope this helps.
Leef_me, I am trying to have something similar to Windows "open with" command but using AutoHotkey insted. Hmm..
Mbutton:: Send ^c fn=%clipboard% Ext:=Substr(fn,-3) ; detect the extension myNotepad =.txt If Ext =%myNotepad% { IniRead, Notepad, C:\Documents and Settings\Desktop\config.ini, General, Notepad } Splitpath, fn,,dir,,name_no_ext new = %dir%\%name_no_ext%%notepad% run new ; ;;Missing out "open with" command.
Thank You all for your replies. I am open to suggestion

#8
-
Posted 16 April 2010 - 02:16 AM

something like this?
GroupAdd, Explore, ahk_class CabinetWClass ; Add a class to the group GroupAdd, Explore, ahk_class ExploreWClass ; Add a other class to the group #ifWinActive,ahk_group Explore ; Set hotkeys to work in explorer only Mbutton:: SelectedFile:=ExplorerGetCurentFolder() "\" ExplorerGetFileName() SplitPath, SelectedFile, OutFileExt, OutDir, OutExt, OutFile, OutDrive menu,OpenWith,Add ; add nothing to prevent error when deleting menu,OpenWith,delete ; delete the menu incase you want diferent items for different filetypes menu,OpenWith,Add,Notepad,Openwith ; create the menuitems menu,OpenWith,Add,Notepadpp,Openwith menu,OpenWith,Add,Regedit,Openwith menu,OpenWith,Add,Commandline,Openwith menu,OpenWith,Show ; show the menu return Openwith: Notepad=Notepad.exe ; assign the exe to the menuitem Notepadpp=Notepad++.exe ; this meens that if % A_ThisMenuItem = Notepadpp then % %A_ThisMenuItem% = Notepad++.exe Regedit=Regedit.exe Commandline=cmd.exe run % %A_ThisMenuItem% " " SelectedFile ; run the app associated with the menuitem return ExplorerGetCurentFolder() { if (A_OSVersion="WIN_XP") ; If we have XP ControlGetText Pad, Edit1, A ; Get the Folder we are in else if (A_OSVersion="WIN_VISTA") { ; If we have vista ControlGetText, Pad, toolbarwindow322, ahk_class CabinetWClass ; Get the folder from the adressbar stringreplace, Pad, Pad,% "Address: ",% "" ; Strip the word Adress: from it } if (SubStr(Pad, 0, 1)="\") ; If last Char is a \ StringTrimRight, Pad, Pad,1 ; Remove it Return,%Pad% ; Return the Currrent folder } ExplorerGetFileName() { if (A_OSVersion="WIN_XP") ; If we have XP ControlGet, Selected, List, Selected Col1, SysListView321, A ; Get the file, Foldername else if (A_OSVersion="WIN_VISTA") { ; If it's Vista BlockInput, Mousemove ; Block mouse movement oldclip := ClipboardAll ; Backup the ClipBoard clipboard= ; Reset the ClipBoard send, ^c ; Send the copy command, Ctrl+C ClipWait, 0.5 ; Wait until the ClipBoard contains data Selected=%clipboard% ; Get the data from the ClipBoard clipboard := oldclip ; Restorte the old ClipBoard data BlockInput, MousemoveOff ; Enable mouse movement } Return,%Selected% ; Return the name of the selected item } IsFolder(FileOrFolder) { if InStr(FileExist(FileOrFolder), "D") return,%true% else return,%false% }or is it more something like this you want:
GroupAdd, Explore, ahk_class CabinetWClass ; Add a class to the group GroupAdd, Explore, ahk_class ExploreWClass ; Add a other class to the group #ifWinActive,ahk_group Explore ; Set hotkeys to work in explorer only Mbutton:: SelectedFile:=ExplorerGetCurentFolder() "\" ExplorerGetFileName() SplitPath, SelectedFile, OutFileExt, OutDir, OutExt, OutFile, OutDrive TxtOpen=Notepad.exe ; this you can all read from ini if you want IniOpen=Notepad.exe logOpen=Notepad.exe RegOpen=Notepad.exe CsvOpen=Notepad.exe AhkOpen=Notepad.exe if %OutExt%Open run % %OutExt%Open " " SelectedFile ; return ExplorerGetCurentFolder() { if (A_OSVersion="WIN_XP") ; If we have XP ControlGetText Pad, Edit1, A ; Get the Folder we are in else if (A_OSVersion="WIN_VISTA") { ; If we have vista ControlGetText, Pad, toolbarwindow322, ahk_class CabinetWClass ; Get the folder from the adressbar stringreplace, Pad, Pad,% "Address: ",% "" ; Strip the word Adress: from it } if (SubStr(Pad, 0, 1)="\") ; If last Char is a \ StringTrimRight, Pad, Pad,1 ; Remove it Return,%Pad% ; Return the Currrent folder } ExplorerGetFileName() { if (A_OSVersion="WIN_XP") ; If we have XP ControlGet, Selected, List, Selected Col1, SysListView321, A ; Get the file, Foldername else if (A_OSVersion="WIN_VISTA") { ; If it's Vista BlockInput, Mousemove ; Block mouse movement oldclip := ClipboardAll ; Backup the ClipBoard clipboard= ; Reset the ClipBoard send, ^c ; Send the copy command, Ctrl+C ClipWait, 0.5 ; Wait until the ClipBoard contains data Selected=%clipboard% ; Get the data from the ClipBoard clipboard := oldclip ; Restorte the old ClipBoard data BlockInput, MousemoveOff ; Enable mouse movement } Return,%Selected% ; Return the name of the selected item } IsFolder(FileOrFolder) { if InStr(FileExist(FileOrFolder), "D") return,%true% else return,%false% }
#9
-
Posted 20 April 2010 - 07:19 PM

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license
http://www.ahkscript.org/ the new forum
Normally, you'd need to edit the registry to make the system open files in a specific program. One can do this with AutoHotkey.
However: to be able to make the system open files in a specific program without editing the registry (if you are not a Super User/Administrator or have to/want to run portable) takes a bit more.
Fortunately, this has already been done (in AHK!), and its name is eXpresso
HTH
However: to be able to make the system open files in a specific program without editing the registry (if you are not a Super User/Administrator or have to/want to run portable) takes a bit more.
Fortunately, this has already been done (in AHK!), and its name is eXpresso
HTH
#10
-
Posted 21 April 2010 - 10:08 AM

true, eXpresso (alias Coffee) does it, but like for me i want to do it myself.
lots of things i dont like in expresso so i made my own.
but it is not clear what she wants realy.
does she has apps on d: and want to register the fileextentions everytime she reinstalls the os.
or does she want to catch filextentions in explorer for use on a usbstick(portable)?
on my pc all apps are porteble and on d:
so i am doing filextentions to reg
now i am working on caching fileextentions in explorer, like expresso but more advanced.
for the moment i am using both until the reg one becomes obsolete.
like she does it with middle button it looks like she wants to keep the original associations, and add custom items
she needs to be spicific in these matters, becouse if she wants left double click, thats no problem
lots of things i dont like in expresso so i made my own.
but it is not clear what she wants realy.
does she has apps on d: and want to register the fileextentions everytime she reinstalls the os.
or does she want to catch filextentions in explorer for use on a usbstick(portable)?
on my pc all apps are porteble and on d:
so i am doing filextentions to reg
now i am working on caching fileextentions in explorer, like expresso but more advanced.
for the moment i am using both until the reg one becomes obsolete.
like she does it with middle button it looks like she wants to keep the original associations, and add custom items
she needs to be spicific in these matters, becouse if she wants left double click, thats no problem
#11
-
Posted 21 April 2010 - 02:35 PM

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license
http://www.ahkscript.org/ the new forum
Emmanuel, I can't wait to see your finished product...hopefully you'll release it. Sounds really promising.
Sorry to OP for offtopic posting.
Sorry to OP for offtopic posting.
#12
-
Posted 22 April 2010 - 05:04 PM

Hi guys and emmanuel d,
emmanuel d thank you so much your effort. I am currently testing the code you posted. Sorry i haven make myself clear of what i am trying to do here.
The story is, i would like to open a file with another application. I know there is such function on windows already. But I would like to use it using AutoHotKeys.
I am trying the codes now, will update you guys shortly.
Really, thank you for the effort!!!
emmanuel d thank you so much your effort. I am currently testing the code you posted. Sorry i haven make myself clear of what i am trying to do here.
The story is, i would like to open a file with another application. I know there is such function on windows already. But I would like to use it using AutoHotKeys.
I am trying the codes now, will update you guys shortly.
Really, thank you for the effort!!!

#13
-
Posted 26 April 2010 - 03:26 AM

How complicated do you want to get?
Select a File then Hold Control and press RButton
Select a File then Hold Control and press RButton
^RButton:: Path:=GetFile() Gui, Add, Text,, %Path%`nOpen With Gui, Add, Button,,Notepad Gui, Add, Button,,Word Gui, Show,,OpenWith Return ButtonNotepad: Gui, Cancel Run Notepad.exe "%Path%" Return ButtonWord: Gui, Cancel Run C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE "%Path%" Return GetFile() { ClipSave:=ClipboardAll Clipboard:="" Loop { Send ^c ClipWait, .2 If !ErrorLevel Break } Path=%clipboard% Clipboard:=ClipSave Return Path }
#14
-
Posted 26 April 2010 - 05:06 AM

well, more complicated then your code, we want for instance that it only works in explorer, and not in other apps so #ifwinactive is needded.
then i dont think we want a gui, or only one fore settings.
and i use doubleclick like normal and rbutton for a menu. so it is like normal explorer but wit my fileassociations, and that is complicated.
then i dont think we want a gui, or only one fore settings.
and i use doubleclick like normal and rbutton for a menu. so it is like normal explorer but wit my fileassociations, and that is complicated.
#15
-
Posted 26 April 2010 - 02:51 PM

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license
http://www.ahkscript.org/ the new forum