My OS is Windows 11 and at Settings > Apps > Default apps > Choose defaults by file type, .ahk is associated with AutoHotkey Unicode 64-bit. If left like this, then saving in SciTE4AutoHotkey will not apply the file extension. Changing the default app to SciTE4AutoHotkey will allow me to save with the correct file extension, but clicking a file in File Explorer or on the desktop will not launch the script and will open in SciTE4AutoHotkey.
EDIT: Also changing the default app will make scripts that are put in the startup folder to open in SciTE4AutoHotkey.
Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
You seem to be confusing opening (running) a script file with editing a .ahk script file. You don’t want to associate the .ahk extension with an editor in the manner you describe because that means it will open (run) by opening the file in your editor instead of running it as an AHK script.
You should only want it to open in your editor when you “Edit” the file, not “Open” it, especially since selecting open is the same as double-clicking it. You might say, “but I double-click .txt files to open them in an editor.” But that’s because .txt files are only meant to be edited, not executed like a script. ”Open” and “Edit” for .txt files are basically is the same thing, but they’re different for scripts.
If you installed SciTE4AutoHotkey correctly, it would have set it up so that it is the default editor for .ahk files (i.e., when you right-click on a file in File Explorer and select “Edit” — not “Open”).
You should only want it to open in your editor when you “Edit” the file, not “Open” it, especially since selecting open is the same as double-clicking it. You might say, “but I double-click .txt files to open them in an editor.” But that’s because .txt files are only meant to be edited, not executed like a script. ”Open” and “Edit” for .txt files are basically is the same thing, but they’re different for scripts.
If you installed SciTE4AutoHotkey correctly, it would have set it up so that it is the default editor for .ahk files (i.e., when you right-click on a file in File Explorer and select “Edit” — not “Open”).
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
Okay, I uninstalled and reinstalled while enabling Set as default .ahk file editor:
I just can't save with the .ahk extension:
I just can't save with the .ahk extension:
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
I don’t have that installed anymore. Are you saying there are no options if you click the dropdown next to “Save as type:”?
It looks like it’s filtering on AHK script files already because the pane above is showing all AHK scripts. Or maybe it’s just showing all files since that’s all you would have in that directory. It also looks like your settings are to not display extensions for known file types, which I hate the fact that that is the Windows default. You might want to change that in the File Explorer settings so you would see the actual .ahk part of the file names.
It looks like it’s filtering on AHK script files already because the pane above is showing all AHK scripts. Or maybe it’s just showing all files since that’s all you would have in that directory. It also looks like your settings are to not display extensions for known file types, which I hate the fact that that is the Windows default. You might want to change that in the File Explorer settings so you would see the actual .ahk part of the file names.
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
Yes:
- Attachments
-
- Save_a_Copy 16_01_23 07⦂07⦂49⦂128 AM.jpg (77.71 KiB) Viewed 4463 times
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
I guess someone else will have to help with that, but I suggest making the change I suggested regarding displaying extensions.
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
@boiler My solution was:
This only works one time and if I replace WinWait with WinAxtive, I get an error that says that variable hasn't been assigned.
EDIT:
This also works once:
Can you tell me why this happens to these scripts?
Code: Select all
if WinWait("Save a Copy ahk_exe SciTE.exe")
Send ".ahk{left 4}"
EDIT:
This also works once:
Code: Select all
WinWaitActive "Save a Copy ahk_exe SciTE.exe"
ControlSetText ".ahk", "Edit1"
Send "{left 4}"
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
Because you have done nothing to tell it to execute those lines more than once. How many time would you expect the following MsgBox to appear?
Code: Select all
MsgBox "Hello"
Code: Select all
loop {
WinWaitActive "Save a Copy ahk_exe SciTE.exe"
Send ".ahk{left 4}"
WinWaitNotActive "Save a Copy ahk_exe SciTE.exe"
}
That’s because there is no such function as WinAxtive. There is WinActive, but you shouldn’t use that. It would work but it would be continuously looping instead of only looping after the window appears. You should use WinWait or even better to to use WinWaitActive, but in the loop like above.
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
I snuck in an edit to add WinWaitNotActive or else it will keep sending over and over while the window is there.
S
Can I add Save File to the loop? I tried using && and AND, but they didn't work.
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
Do you you want it to wait for Save or Save a Copy window? Then leave off the a Copy and it will find either.
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
The editor's functions are under File and are the 6th and 7th options. This is what I tried that failed:
and:
Code: Select all
loop {
WinWaitActive "Save a Copy && Save File ahk_exe SciTE.exe"
Send ".ahk{left 4}"
WinWaitNotActive "Save a Copy && Save File hk_exe SciTE.exe"
}
Code: Select all
loop {
WinWaitActive "Save a Copy AND Save File ahk_exe SciTE.exe"
Send ".ahk{left 4}"
WinWaitNotActive "Save a Copy AND Save File ahk_exe SciTE.exe"
}
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
It doesn’t allow AND like that. As I mentioned above, just make it Save so it will match either Save File or Save a Copy:
Code: Select all
loop {
WinWaitActive "Save ahk_exe SciTE.exe"
Send ".ahk{left 4}"
WinWaitNotActive "Save ahk_exe SciTE.exe"
}
Re: Can I be able to save AHK files and to be able to click on one in File Explorer without opening in this app?
I came up with this solution because I've had scripts with the word save in it:
Code: Select all
SetTitleMatchMode "RegEx"
loop { ; writes .ahk in a Save window
WinWaitActive "Save File|Save a Copy ahk_exe SciTE.exe"
Send ".ahk{left 4}"
WinWaitNotActive "Save ahk_exe SciTE.exe"
}
Who is online
Users browsing this forum: No registered users and 3 guests