Autohotkey script only works when I have this window open (please see screenshot). If I minimise it, it does not work. I have the H visible in the tray. Any help would be appreciated, thanks.
My script to use with Windows Pen is simply:
#F20::Run OneNote ; Single click, Open OneNote
if your keyboard has a f20 key
#F20::Run C:\Windows\write.exe
Would run wordpad.
Supply the path where OneNote is located.
#F20::Run path\OneNote
Related
I am trying to click on the iVMS-4200 window with a script made with Autohotkey.
The script works as I have tested it on the browser and it doesn't give me any problems. The thing is that on the mentioned software, the clicks don't work.
This is the script in ahk:
MouseMove 500, 300 ; Move mouse to my coor
Send {Click Right} ; First right click
Any idea how to make it work?
If someone is also facing this problem with Autohotkey, just try to run the script as administrator.
I have two queries that needs to be resolved.
How can I resize Windows Powershell to a considerable size in Windows 10? I have already tried using the Properties options and via ** Layout**.
But the moment I re-launch it, the window size goes to an in-proportionate size. (Please check the image attached for this query)
P.S - I also browsed Stack-overflow and found this link - [https://superuser.com/questions/68013/how-can-i-set-the-powershell-default-window-size-in-windows-7] but wasn't able to eliminate the issue. :(
Image - 1: In-proportionate size of Windows Powershell
Other than query #1, I also want to know - when I try to open cmd window in a particular folder, I am not able to see the option reading open cmd window here in the context sensitive menu. For quick reference, I am also attaching one image for this query.
Image - 2: No option to open Command Prompt via context-sensitive menu.
P.S: I am getting the option to open Windows Powershell in the above image
I earnestly request the experts here to guide me on these two queries so that I can use both Windows Powershell and Command Prompt without worrying about the size of the window every time.
I look forward to some quick guidance.
Regards.
You can set it in the properties on Powershell window.
After,
When you reopen Powershell, these settings will be saved. Tune Window Position values as well as needed.
For your 2nd issue, read on this link - https://fossbytes.com/powershell-replaces-command-prompt-windows/
If you aren’t ready to accept this change and ditch Command Prompt,
you can opt out of the WIN+X change. To do this, open Settings >
Personalization > Taskbar. Now, turn the “Replace Command Prompt with
Windows PowerShell in the menu when I right-click the Start button or
press Windows key+X” option to “Off”.
As for this...
open cmd window here in the context sensitive
Option:
You can just select any directory and click the Explorer search bar and type cmd or powershell or pwsh (v6 if you have it installed) and it will start in that directory; As long as you don't have directory configured in you PowerShell profile.
You can add thing to the context menu using the Registry editor
See instructions here:
Add the Command Prompt to the Windows Explorer Right-Click Menu
A hidden functionality in Windows allows you to right click on a directory, and select “Command Prompt Here” from the menu.
https://www.howtogeek.com/howto/windows/add-the-command-prompt-to-the-windows-explorer-right-click-menu
Just as you can for PowerShell
Add PowerShell to Windows Explorer Context Menu in Windows 10
Ever since the days of Windows Vista, it was possible to use Windows Explorer’s context menu to quickly open a command prompt window to a specific location by holding the shift key and right-clicking a folder. The “Open Command Prompt Here” appeared, allowing you to open the command prompt in the folder of your choice.
https://www.petri.com/add-powershell-windows-explorer-context-menu-windows-10
BTW, you can add anything you wish to your SendTo menu as well, just by copying the short cut there, and then that too will show up in the explore context menu for use.
As far as your PowerShell Window being overly large/small. Of course the is not the default and something / someone did that. I seen that, but never had it happen to me.
Have you made a lot of customizations?
Is this only happen in your logged on session, vs other users of the system?
So, are you saying also, you cannot resize the Window using your mouse to another size?
Try this first.
Exit the console host.
Open the PowerShell_ISE
Reset the defaults there using these commands
$PSise.Options.RestoreDefaults()
$PSise.Options.RestoreDefaultConsoleTokenColors()
$PSise.Options.RestoreDefaultTokenColors()
$PSise.Options.RestoreDefaultXMLTokenColors()
Next start the console host from the ISE by clicking the console host icon in the toolbar.
Try and work the properties from there, then close and reopen the console host form the ISE to see if the settings stayed.
Then open the console host from whatever shortcut you normally use and see if the changes remained.
If that does not reposition / resize the console windows then this is Windows proper causing this. Similar to a Window being off screen that you can't get to.
Then right click an open space on the taskbar and select Cascade windows.
If that does not work use the move option from the Taskbar.
Use Shift+Tab to select the console Windows.
Shift+RightClick the taskbar icon of the Window and select move.
The close and check again.
Lastly, if you have not done a lot of customizations, you can grab the default PowerShell regkey from another user / profile and import that into your registry.
If you don't have another default logon to use, just create one, check PowerShell state and the get that regkey to use.
Last thing, I meant to add, if none of the above works and you don't want to take the RegKey route. Create a PowerShell console profile and add this code to it. This of course will run each time you start you console using your profile. Of course adjust as needed,
$ConsoleSettings = (Get-Host).ui.rawui
$ScreenBufferSettings = $ConsoleSettings.buffersize
$ScreenBufferSettings.height = 50
$ScreenBufferSettings.width = 120
# $ConsoleSettings.buffersize = $ScreenBufferSettings
$ScreenSizeSettings = $ConsoleSettings.windowsize
$ScreenSizeSettings.height = 50
$ScreenSizeSettings.width = 120
$ConsoleSettings.windowsize = $ScreenSizeSettings
I want to have a script that works with a specific program open when I open that program with the program's shortcut icon. I have tried pasting the path into the target line in the icon's properties, but that didn't work. What do I need to do?
I think that I read that you want to create an icon that looks like the original application launch icon, which will, when clicked, indeed launch the original application AND run some extra ahk code. You can create a Shortcut or Link to a ahk script that will launch your app (run, c:\path\yourapp.exe) and perform other tasks (WinWaitActive, your app) etc.. In the link to the ahk script (does not work on the real ahk script, ONLY with the lnk file) you can select the properties (right click) and change the icon to whatever you want (often you can use the icon of the original application, by pointing to the .exe (instead of selecting icons from the the standard shell32.dll). So by selecting the new icon to e.g. c:/program files/officexx/word.exe , your AHK script will get the icon as if it is the word launch icon. Hope that answers your question.
At the beginning of the script, but ater you execute the run command, you place the timer
Run, abc.exe
SetTitleMatchMode, 2
Sleep, 1000 ; Give the app some time to run before you start the test
SetTimer, CloseScript, 1000
Return
CloseScript:
IfWinExist, place the windows title here....
Return
ExitApp
This is one of the first things that I did with AutoHotKey. I wanted a 'wrapper' script for a program that I regularly used that lets me to chose different program options with a script GUI form when I press the F4 key while clicking the link. Just clicking the link starts the program normally. Eat your heart out Microsoft.
In the link's Start-In property I put the actual program's directory and my script gets the program name and other details from the script's command line arguments in the link's target property.
what name can I use for the Logitech button that appears on their keyboard that I'm using. I want to reprogram it in Autohotkey. I see it opens the calculator if you did not install the the proprietary software. Thanks!
e.g.
Calculator:: ;then some commands
Logitech:: ;then some commands
Here is how I set my Calc key to launch Google Chrome with AHK:
Launch_App2::
Run, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
You can use the keyboard hook along with viewing the keyboard history.
The process for finding these keys is specified in the documentation.
I'm trying to make an AutoHotKey macro that's active only in Windows Explorer but I don't know the name of Explorer in Windows 7. I tried the following:
;Make explorer understand that Ctrl+L means goto location bar (like Firefox / Chrome)
#IfWinActive .* Explorer *.
^l::Send {F4}
#IfWinActive
Any ideas?
Autohotkey comes with a program called Window Spy. You can use it to discover the title of the active window.
Also, take note of ahk_class (look up ahk_class in the help file), which uses the type of window, rather than the title.
For example, in my Win 7 case, I can restrict hotkeys to explorer by specifying:
#IfWinActive ahk_class CabinetWClass
Windows Explorer seems to use different window classes at different times (e.g., if Search is displaying or not--at least in Win XP). This script matches the two classes I've seen and maps Ctrl-L to "focus on address bar" (ala Firefox) in Explorer:
#IfWinActive ahk_class ExploreWClass
^L::
#IfWinActive ahk_class CabinetWClass
^L::
Send {F6}
return
#IfWinActive
Just wanted to thank Nathan enormously for resolving my problem -- virtually identical to Ola's question here. Had been using the very popular AHK script called "Favorite_folders" which displays a folders menu on Middle-button click. Been using for years in XP no problem -- but could not get the script to work in Win7 in a "Windows Explorer" window.
The script worked in all programs' explorer windows -- but NOT in a plain "Windows Explorer" window (as in -- Start > right-click > Open Windows Explorer). Spent over 20 hours trying to solve.
Nathan's advice to use the "#IfWinActive ahk_class CabinetWClass" script solved my problem. It led me to add the following script to the "Favorite_folders" script --
IfWinActive ahk_class CabinetWClass
f_AlwaysShowMenu = y
Apparently, the CabinetWClass refers to the "Windows Explorer" window -- whereas the ExploreWClass refers to the explorer window that appears in various programs when opening or saving a file. I needed the menu for both situations.
In the original "Favorite_folders" script, the command line for permitting a "f_Hotkey = ~MButton" menu to appear reads -- "if f_class in #32770,ExploreWClass,CabinetWClass ; Dialog or Explorer". For unknown reasons, this only permits the menu to appear in programs' explorer window -- but NOT a normal "Windows Explorer" window.
By adding the two command lines above to the original "Favorite_folders" script I was able to get the menu to appear in normal "Windows Explorer" windows -- but NOT in programs' explorer windows -- same problem in reverse. And if I added a second similar script modification for "#IfWinActive ahk_class ExploreWClass" -- then no menu appeared in either kind of explorer window. Crazy stuff -- by my reckoning.
So the solution for me was to load two separate versions of the "Favorite_folders" AHK script -- 1) the unmodified original Favorite_folders script; 2) a separate modified original Favorite_folders script with the two-line "#IfWinActive ahk_class CabinetWClass" command inspired by Nathan inserted into it. NOW -- the menu appears in both kinds of explorer windows. Not clear WHY these scripts cannot appear in a single script -- but they work just fine as separate scripts.
So a HUGE thanx to Nathan and Ola for raising and solving this issue and my problem.