Jump to specific cell in google spreadsheets macro - google-apps-script

I am aware of f5 to open the jump to cell dialog, the problem with it, is that, while it allows you to do it once, the next time you press f5, to jump to another specific cell, the previous text is not highlighted, therefore you need to get you hands off the keyboard and select it with the mouse.
If I could have a way where I don't lift my hands from the keyboard it would speed up my workflow tremendously.
Any ideas?
Like, I'd need a macro to pop up the goto range dialog AND select whatever text is there so that I can just type a new cell range (e.g: a391)
Thank you!

There is a simple approach to add customized macros to Sheets. You only need to create a bounded script beforehand that contains a function with your desired actions. Then you can follow these steps:
Go to Tools > Macros > Import
Find your function and click on Add Function and click on the X to close.
Go to Tools > Macros > Manage Macros
Assign a number to your macro and click on Update
Run your macro using Ctrl + Alt + Shift + {NUMBER}
Following those steps you will create a customized macro without difficulty, but feel free to ask me any doubts.

Work around for MacOS (High Sierra, probably it will work on newer os as well)
I downloaded the file AppleScript Toolbox.osax from here: https://astoolbox.wordpress.com/
Put the file in the folder: /Users/me/Library/ScriptingAdditions
Run Automator and start a new Service:
Paste this script
activate application "Firefox" -- or "Safari" or "Chrome", etc
set mousePointLocation1 to {1700, 250} -- coordinates depend on your screen size
AST click at mousePointLocation1 number of clicks 1
And save:
Go to Preferences > Keyboard > Services and add shortcut for this service
After that you will see the new shortcut here:
In Google Spreadsheet I press F5, to show the panel and then I press ^F5 and cursor jump on this panel and does click.
I'm a noob in macOS I'm sure it can be done better. It's just how I managed to do it right now.
Another modification of the script could be more convenient:
activate application "Firefox"
tell application "System Events"
key code 96 -- this is F5 key
end tell
delay .5
AST click at {1700, 250} number of clicks 2 -- or 3 maybe
This way you don't need to press F5. Just press ^F5 and go ahead.
It works
Just in case. If you know Python. I've managed to press F5 move and click mouse with Python module pynput:
from pynput import mouse, keyboard
k = keyboard.Controller()
k.press(keyboard.Key.f5)
k.release(keyboard.Key.f5)
m = mouse.Controller()
m.position = (1700, 240)
m.press(mouse.Button.left)
m.release(mouse.Button.left)
m.click(mouse.Button.left, 2)
https://pynput.readthedocs.io/en/latest/
It can be converted into macOS Service this way:
And then you can run this Service the same way via Keyboard > Services > Add Shortcut

Keyboard shortcuts in Google Spreadsheets are rather suck. If you're on Windows I'd advice to try Autohotkey. It can move cursor at any coordinates on your screen (coordinates can be set relative current window). For example 'Win+F5' could work as F5 + move cursor at top-right corner of the screen and perform a left click.

I just found another a much more obvious native solution.
Put the code in Script Editor:
function jump() {
var range = SpreadsheetApp.getUi().prompt('Input cell').getResponseText();
SpreadsheetApp.getActiveSheet().getRange(range).activate();
}
Save it and add the function as a macros:
Then assign some shortcut to the macros:
After that you can press the shortcut (CmdOptionShift5 in my case), input cell address, press Tab and Enter and here we go.

Related

Keyboard shortcut to access Chrome bookmarks (mac)

I seem to be almost entirely mouse-free at this point, minus being able to access the Bookmarks bar in Chrome with a keyboard shortcut! I've searched the web quite a bit for an answer, but to no avail....any ideas or workaround?
EDIT: Use Firefox. You can CMD + B --> will open Bookmarks navigator, and you can type to search, hit TAB, and then arrow through results
If you are hoping to click on the actual bookmarks on your Google Chrome browser, using keyboard shortcuts, on Mac, you can make use of Mac's Keyboard shortcuts feature.
Open System settings app
Open Shortcuts section under Keyboard
Choose App shortcuts
Click +
Choose Google Chrome as application
On the title field, enter Bookmarks->{Bookmark-name-goes-here}
Set a hotkey
Save the changes and you can now use this hotkey to call that bookmark. This basically is setting a shortcut to your browser's menu item.
Holmes is an extension that allows a shortcut activated bookmark search similar to Garrett's answer but without the "read and change all the data on any websites that you visit" permission.
Install the tool then press shift+alt+H
⌘ + Option + b
or
⌘ + Shift + b
Try this shortcut
cmd+opt+B
I found a chrome plugin that is super useful and goes beyond what I was hoping for. It's called Bookmark Navigator. Here is the link https://chrome.google.com/webstore/detail/bookmark-navigator/bfibpphfhdpgkmbpkfmhdiklgcfmmkha
Below is a picture of what it looks like. The tool is summoned with cmd + b, and then you can start typing to search all of your bookmarks. You can press enter to access the bookmark at top of list, or use arrow keys to navigate further down the list.
This is the fastest and most user friendly option I have found.

How can I move focus from any other tool window to text editor in PhpStorm?

For an example after I go to the Project tab with Alt+1 shortcut and open specific file with pressing Enter I then want to go and edit content with single shortcut. Is there any way to do it?
There is couple of things that I can use, but neither does exactly what I want:
Ctrl+Tab - that opens the switcher and selects next file in switcher instead of allowing me to edit file with single Ctrl+Tab
Ctrl+E or Ctrl+Shift+E do different things but basically the result is simmilar as above
What I want is to simply edit the file after opening it with keyboard from Projects tab (without using mouse).
How can I move focus from any other tool window to text editor in PhpStorm?
Just press Esc key.
Works in every tool window. For built-in Terminal though you can (may have to) configure different shortcut for such action (as Esc can be needed there).
For an example after I go to the Project tab with Alt+1 shortcut and open specific file with pressing Enter I then want to go and edit content with single shortcut. Is there any way to do it?
Use F4 for that (action is available in context menu and called Jump to Source).
Ctrl+Tab - that opens the switcher and selects next file in switcher instead of allowing me to edit file with single Ctrl+Tab
Just press and release it quickly: it works just like Alt + Tab on Windows. If you keep modifier key pressed (Ctrl in this particular case) it will keep the Switcher window opened.

How to switch to source code in PhpStorm?

I want to be able to quickly switch to the code editor window in PhpStorm. I've found "jump to source" hotkey, but it works that way: if I have some folder selected in my directory tree ("Project", on the left side) and I use the hotkey (F4 by default) I won't get switched. Also, if some other file has been selected in directory tree I'll get switched to the code of the selected file. However, I just want to emit clicking on the editor field using mouse. Just switch.
However, I just want to emit clicking on the editor field using mouse. Just switch.
Just Esc -- that's it.

What is the keystroke to exit the file diff view in sublime text?

I am playing around with sublimerge. I got into the file diff view, having 2 panes. I don't know how to go back to the normal view.
Clicking in the diff pane and pressing "esc" worked for me.
You can open a new window with Shift + Ctrl + N.
It should open in one-pane view.
If you not see the menu bar you can access the menu via the command palette (ctrl+shift+p) and type in menu, as is explained in This answer.
Save your workspace, in the Project menu.
well I didn't find the keystroke yet, but you can at least hit the close buttons on the files in the side bar, and it does take you out of diff view mode
On a Mac, Cmd-Q seems to do it.

Assign the Shortcut key for Chrome Extension Option page

How can I assign my Google chrome extension option page with shortcut key.
The following works almost as good as a shortcut,
Go to location bar, press Ctrl+L
Type "ce" OR "cs",
Press Enter.
After setting it up as follows,
What I do is, I set them up as search engines on
chrome://settings/searchEngines
Name - Shortcut - URL Chrome Extensions - ce - chrome://extensions/
Name - Shortcut - URL Chrome Settings - cs - chrome://settings/
http://productforums.google.com/forum/#!topic/chrome/hqYtz15LrgQ
Hope this helps!
Currently there is no better way other than injecting content script to all pages with keypress listener. As you would imagine this approach not only isn't very effective, but wouldn't work on some pages (chrome://newtab would be the most annoying one).
Unless assigning a shortcut to your options page is crucial, I wouldn't bother doing it.
I think the options page is meant to be open only from the extension control panel links. However, to solve the shortcut part of the problem you can use the new commands API which will free you from having javascript listeners injected on every page. The shortcuts will work even if you don't have a page loaded in your tab.
You could use this autohotkey script:
#IfWinActive, ahk_class Chrome_WidgetWin_1 ; Shortcut functions only on Chrome
^q::Send, ^t chrome://extensions/ {enter} ; functioning script
#IfWinActive
The second line is the script and means that if you press Ctrl+q (^ stays for Crtl) the script opens a new Tab (Ctrl+t), type the address (chrome://extensions/) and press enter.
You can change the shortcut key changing what is before the ::.
Then I suggest you to put the file .exe in the startup folder.