When creating hacky AppleScripts to do stuff in Salesforce Kimble, it would be good to just click on a web page element, and have the ID for that element automatically copied to my Clipboard, without doing all that right-click view source nonsense.
A good way of using this is to create a service for Safari in Automator.
- Open Automator and choose New -- Service
- Drag the 'Run AppleScript' widget into the main panel
- 'Service receives selected' = 'No Input' in 'Safari'
- Remove (* Your script goes here *) line and replace with our script.
- As this is running from Safari directly now, you can remove the 'activate line and the delay.
- Save the service as "What's My Name?" (or whatever).
- Open System preferences --> Keyboard --> Shortcuts --> App Shortcuts
- Click '+'
- Application = 'Safari'
- Menu title = 'What's My Name?'
- Keyboard shortcut CTRL+OPT+CMD+C
Now, whenever you want the name of a DOM element, select it and then hit CTRL+OPT+CMD+C and it will be copied to you clipboard. Try doing that just in Javascript! (Hint, you can't!)