I have a desktop application that opens a tutorial, hosted on a website, when it runs for the first time. I want the tutorial to open in a standard browser window minus the menubar/location bar etc... In javascript this would be simple enough but I can't find any information on how to do it from the command line (if it's even possible).
I'm only concerned with Mac OS X so I'm happy with a solution that specifically addresses Safari but any info on other browsers would also be useful.
UPDATE
blahdiblah's solution only allows toggling of the toolbars. With no info on what is currently open or closed, it isn't a very suitable solution.
From this blog post, do it with Applescript (and osascript):
tell application "Safari"
activate
if bounds of window 1 is not equal to {0, 22, 1440, 900} then
tell application "System Events"
keystroke "b" using {command down, shift down}
keystroke "|" using command down
end tell
set bounds of window 1 to {0, 22, 1440, 900}
else
tell application "System Events"
keystroke "b" using {command down, shift down}
keystroke "|" using command down
end tell
set bounds of window 1 to {160, 80, 980, 700}
end if
end tell
Read the post for additional information and caveats.
Related
Automating a process that is being run on a RDP session, I have to use ControlSend, and not Send command in AutoHotKey.
The WindowSpy doesn't find any control on the MDI toolbar, and there are no shortkey to the menu item I want to access (Filter..). How may I open the toolbar and select the item?
I've tried
ControlSend, ahk_parent, {alt}, ahk_class FNWND3170 ;Open project folder in treeview
But with no success.
I've considered using AutoIT, but I don't think that would help as the AutoIt spy doesn't pick up the control either.
Sorry, but think of the RDP window (or even full screen) as an ever-evolving bitmap image. Your PC and autohotkey have no idea what is behind the picture. Can you run the ahk script in the remote pc itself? Keep in mind, the RDP client handles your mouseclicks and keyboard (and even voice) entirely by re-directing inputs, etc. So best bet is to do a mouse click in the appropriate spot by running a script from outside the window:
CoordMode, TargetType [, RelativeTo]
Click, 44, 55 ; Clicks the left mouse button once at coordinates 44, 55 (based on CoordMode).
Use the CoordMode "RelativeTo" flag to set to "Relative" so coordinates are relative to the active window. You may have to click twice, once to activate the RDP window and then to click at the mouse position.
See https://www.autohotkey.com/docs/commands/Click.htm and https://www.autohotkey.com/docs/commands/CoordMode.htm for info.
Hth,
Inside of emacs, I use 'C-c c' to make an org-capture.
I would like to bind the same key (or some function key) to perform the same function even if emacs is not the currently open window.
Is there a way to tell OS X when pressing 'C-c c' (or f10, say) to change the window to Emacs, and then perform a org-mode capture?
There a post on thinknix.net [http://www.thinknix.net/2015/02/19/cross-platform-system-wide-org-capture/] which will do what you want using Keyboard Maestro or for Automator if you don't have KM.
I include parts of the post here for completeness:
There are two ways I’ve accomplished this. The first is to use Keyboard Maestro if you already have it. Create a new macro called
Org-Capture that triggers on F9. Have it Activate Emacs, simulate
keystroke Control-C, and simulate keystroke C.
If you don’t have Keyboard Maestro, you can use the following
Applescript in Automator:
on run {input, parameters}
tell application "Emacs"
activate
tell application "System Events"
keystroke "c" using {control down}
keystroke "c"
end tell
end tell
return input
end run
Save it as a service, and then in the Keyboard Shortcuts panel assign
the service to F9.
Using AutoHotKey, I'm trying to maximize the Netflix metro when it is already running and minimized. I haven't had any luck so far.
Here is the script I've tried:
^!z::
WinActivate Netflix
WinShow Netflix
WinMaximize Netflix
return
Here's what AHK Window Spy says about the Netflix metro app:
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
Netflix
ahk_class Windows.UI.Core.CoreWindow
>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 528, 738 (less often used)
In Active Window: 528, 738
>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
Color: 0x8B7272 (Blue=8B Green=72 Red=72)
>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: 0 top: 0 width: 1360 height: 768
>>>>>>>>>>>( Status Bar Text )<<<<<<<<<<
>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<
>>>>( TitleMatchMode=slow Visible Text )<<<<
>>>>( TitleMatchMode=slow Hidden Text )<<<<
Try to launch script with admin privileges.
Always use AutoHotkey and its documentation from
http://ahkscript.org/ (current uptodate version, new official
website)! AutoHotkey and its documentation from autohotkey.com is
outdated and you may have some problems using them!
I am not user of metro applications but here are my thoughts. If WinActivate, WinShow, WinMaximize command are not working and my above suggestions are not helping too as far as I know you are left with only one solution:
You have to activate window of minimized Netflix by clicking with
Click command on minimized Netflix.
Use ImageSearch for getting coordinates to use with Click command or enter coordinates manually.
The best option I've found so far is to re-run explorer.exe to restart the Netflix metro app, even if it's already running minimized.
;Start Netflix
^!z::
Run explorer.exe netflix:
return
This causes the Netflix app to load in the foreground without creating multiple instances of the app. However as a side-effect it causes the app to navigate back to the 1st screen.
I haven't found a better way.
I'm using notepad++ (v6.5.3) and I constantly have to change the size of the tab for viewing some results. Not that it's taking me a lot of time to do it manually everytime, but it would be great if I could optimize that.
Is there a way to do so? Would a macro be the solution, or are they just for typing stuff?
Thanks a lot!
Ok, there's an easy way how you can achieve this - I have tested it right now:
Install AutoHotKey (or start portable version which runs without installation)
In Windows 7 and above, ensure you launched AutoHotKey as Administrator (otherwise you get inconsistencies in its behavior) - if not sure, exit it and restart it as administrator
Right click Autohotkey tray icon and select Edit This Script
Import the macro below this list at the end of the AutoHotKey script file and save the file
Right click Autohotkey tray icon and select Reload This Script.
–– This was end of general steps, now let's go with your macro: ––
In N++, display Preferences window and press its Close button1 at the bottom (NOT at the top-right corner)
Now you can use shortcuts Win+F2 and Win+F3 to switch different tab sizes instantly
SendMode Input
DetectHiddenWindows, On
SetTitleMatchMode, RegEx
;--------------------------------- Hotkeys for Notepad++ only
#IfWinActive ahk_class Notepad\+\+
#F2::Send {F10}{Right 6}{Down}{Enter}{Tab 2}{Space}16{Enter}{Tab 3}{Space}
#F3::Send {F10}{Right 6}{Down}{Enter}{Tab 2}{Space}4{Enter}{Tab 3}{Space}
#IfWinActive
1) Important: N++ user experience provided in dialog boxes is absolutely terrible. There are no anchors where you can fix focus when using keyboard. Thus you always need to perform step 4 manually when leaving Preferences dialog box otherwise the macros would send keys into incorect window page OR at correct page but incorrect control. Preferences dialog window remembers selected page and control. Macros I created for you therefore assume that correct page is already listed and button Close was recently focused.
Good news is Notepad++ windows with this weird behavior are rare exception from general user experience. In other places in N++ (or in other apps) where user interface components (menus, dialogs etc.) always start from the same point you do not need any special precautions like the one in step 4.
Adjust the macros as you like:
you can create more of them
you can adjust the numbers "16" and "4" typed into tab size input box
you can change shortcut keys to something else
you can replace sending keys with sending mouse clicks at desired screen/window positions
you can achieve many other useful shortcuts in N++ and in all other apps – check AHK deeper!
We regularly access the build machine through RDP and it there are lots of command line windows that open. Sometimes these windows hang like someone switched focus to them and press the Pause key. Tapping the keyboard moves the process along, but every once in a while this is missed and everyone waits on the process to finish while it is waiting for someone to press a key. Why does this happen? Is there a setting or version up/down-grade that can keep it from happening?
When this happens, does the window title say "Select Command Prompt"? If so, hitting a key will unpause it, but the keystroke will also be sent to the paused program unless it's ESC or enter (or possibly others). You can turn this feature off by going into the Command Prompt properties/defaults and unchecking "QuickEdit Mode".
If that's not it, you'll have to post more information about your build process. What is your build system written in (make, scons, jam, msbuild, etc.)?
One thing to watch out for in command line Windows; if you have QuickEdit Mode enabled (click on icon in title bar, Properties..., Options tab) you can highlight and copy with the mouse, bypassing the Edit menu. Stray mouse clicks in the window highlight the character underneath and the console will appear to "hang" until a key is pressed.