How to change sound output to a earphone not to a hdmi? - macos

I am using Mac OS X 10.11.2. Recently I connected it to another monitor using HDMI. Whenever I turn on my mac, it sounds out to the monitor. How can I fix it sounding out to a earphone? I know where I set the audio output in mac preference. But even if I choose the earphone output, it doesn't work at all. I want to know the permanent way to fix the output to the earphone.

System Preferences > Sound > Output is probably what you're looking for. Pretty sure the device you select here becomes default. You can always check the Show volume in menu bar to change it quickly.

Related

How to run an Applescript when a mouse is connected?

I have an Applescript that changes my mouse tracking speed that I want to run whenever I connect a mouse to my laptop. How do I do something like this? I was thinking of making it into an application and just clicking it whenever I need it, but I feel like there's a better way to do it.
This answer mentions launchd's ability to detect and launch an app when usb devices are connected. Sounds like what you are after.
Execute an application on Mac OS X when a particular type of USB device is connected?
You can get your specific product is, to use in the plist file, from System Profile->USB
Hope that helps.

USB device opens Applications, then types in text field

I got a letter in the mail that contained a small USB device. Here is what it loks like: http://imgur.com/a/VEtNK
When I plug it into my computer it seems to hover over the programs in my Dock and then opens one. It then types a link into a text field that is available. I originally had Skype in the dock and it defaulted to that one, strange. I removed Skype from the dock and now it opens to System Preferences.
Here's a video of what happens as I plug it in: https://www.dropbox.com/s/yuw6ggvo77rkvwh/Test1MysteryDevice.mov
Also, it does not appear like a memory stick does on my computer. I can't seem to locate it when it's plugged in. It would be cool if I could find it somehow. It would be even cooler if I could program it to do something I wanted.
Thanks, and if anyone can help out that's awesome or if you could point me to a forum/anywhere that might be able to help out, that'd be great!
Probably it self-identifies as a HID (Human Interface Device), specifically a keyboard. As soon as it is accepted as a keyboard by the OS it can send any sequence of keystrokes, and the OS will assume that it is input from a human user.
Scripting such behavior is easy using Applescript.
However automatically running a program from a USB stick when it is inserted is supposed to be impossible on OS X, as auto-run is a security risk.
Of course at the very least a custom USB device could be made to act like a mouse and keyboard, so even without autorun it's a risk to plug strange devices into your computer.
To get more info on the device you can go to System Profiler and look for the device on the USB bus.
If it is a custom device pretending to be a keyboard then it's probably hardwired to do what it does, and you probably won't be able to reprogram it; you'd need to find a manufacturer that will sell you customized devices.

Debugging key event flow in OS X before it reaches an app

I have a user who reports that a particular keystroke isn't working (control-apostrophe) in my app on OS X. This does work for him on other machines.
I added some logging and my app never receives the NSEvent for the keyDown. Disabling universal access for assistive devices didn't fix it either. Nothing in keyboard shortcuts in system preferences uses that shortcut. Is there any way to trace a keystroke's path through the OS to find out why my app doesn't get it? Is this something dtrace can do?
This is an old question, but for anyone needing to do this I'll give an answer. I'm not going to go through the usual ways of tracking down a kb shortcut that is going bad, but you will have to make sure you do not have it set in system services, keyboard maestro, quicksilver and all of those apps that allow kb customization. Check this first. If you don't have a lot of kb shortcuts set through sys preferences, you might want to consider just deleting your plist file and letting the system default back to a fresh state. search for com.apple.symbolichotkeys.plist and delete this. If this doesn't solve your issue or you don't want to delete the plist then run dtrace's iosnoop command from terminal. This will just dump everything going on. Hit the key and ⌃ c to stop the output and inspect the output. You could output this to a text file and do some grep magic on it, but this should be enough to head in the right direction.

How to create a Windows application that: detects current program and sends shortcuts

I would like to create an application for Windows that is visible in the system tray and can detect the current open window. The application that I want to make should also be able to "press on the users keyboard": sending out keyboard shortcuts to the current open window/application.
How would I go about doing this? What programming languages/tools would be useful?
Best would even be if it is portable to Mac, but this is not a must.
Portability: Not very likely you can find anything that is cross-platform for this.
For Windows: AutoIt. Does everything you want and a lot more.
For Mac: Applescript (standard component of OSX) can probably do this, but I could be wrong about that. I do have a Mac, but I never had a reason to play around with this sort of stuff.

How to detect when OS X Screen Sharing is active programmatically?

OS X does not make it obvious that you might've left a screen sharing session open -- and it's still actively broadcasting your session to these other computers. Does anyone know where Snow Leopard stores that the computer you're sitting at has an open screen sharing session?
If I could detect this file using a shell script every minute or so, then I could fire a Growl notification to let me know that I'm essentially being watched by this other computer (using the code snippet found here).
Otherwise, the only way to know now is to notice a very small icon on the top right of my screen that looks like binoculars (very hard to notice).
One way would be to use lsof to check for any established connections by AppleVNCServer
lsof -a -i :vnc-server -sTCP:ESTABLISHED -c AppleVNCServer

Resources