I'm developing an app for the Mac OS X that provides various system statistics. I have a little problem with the printer because I have never worked with it before. Is there any way to listen to the printer and count pages printed in color and in b&w?
Edit: I remember that I was using a Mac OS X kiosk machine once and it offered color and b&w prints priced per page, so there must be a way to do this. Also, I develop this app for my own needs and for practice so the solution doesn't have to be universal.
I'm pretty sure access to this information is specific to individual printer models. I don't believe there's a system API that will help you here as it would require querying individual printer drivers or utilities.
The Core Printing Reference which is the documentation for the Mac OS X printing API doesn't appear to contain any calls that would allow you to extract this information from a printer.
Related
I am trying to find the best way to handle application windows on Mac OS from a script. I am open to any language, but I want it to have the following capabilities
Get list of open applications
Get location of specific application
Change focus, position, and size of specific application
Send key events to only specific application
I have managed to get a list of applications using JNA, Apple's Core Graphics library, and some code from this question, but the capabilities seem to be limited. Is there a way to implement the functionality I am looking for, or is Mac OS too closed down for this? Like I said, I am open to all languages.
Thanks so much!
I need to write what I think is a display driver for OS X. It's like those "Use your iPad as a second monitor!" apps, but I need to write the OS X software that will register another display with OS X, and give me the pixel data so I can use it for my various needs.
Where do I get started? I've read about IOKit, but I don't quite understand what I need to do to tell OS X that I'm a monitor, and then what the pixel data is going to look like.
A few links to the classes/headers/etc that I'm going to have to read through would be fine as well, but if anyone has done this and knows the particulars it would be very helpful.
Also, will this have to be a kernel extension, or is it possible to write a userspace IOKit driver that gives a second monitor to OS X?
Lastly, to be clear, I just want the pixel data that would be sent to a second monitor (either mirrored or extended) - I'm not actually attaching a monitor on, or an I/O device.
you could take a look at:
http://code.google.com/p/ioproxyvideofamily/
maybe as a starting point.
CoreGraphics. Display Services
and you probably want to look at the Quartz Display Services Reference
I'm trying to port an application I've written in Qt from the windows platform to the Mac OS X platform.
The application is relatively simple:
It queries the user for a document (either MS Word, or OOo Writer document). It than launches that that document inside the
respective application, and than replaces various text elements with other data (Think Mailmerge).
It starts up the application and does the text replacing using QAxObject which is wrapper for COM.
Now I'm wanting to port this to the Mac OS X. I've installed Qt Creator on the Mac etc., but obivously COM is a windows technique not available on the Mac OS X.
So I've been looking around for techniques on the Mac OS X that are similiar to COM.
For now, I'm especially interested in using the OOo API http://api.openoffice.org/.
I'd like some pointers which techniques I should be looking at. I'm also willing to accept that this just plainly is not possible at all.
Thanks in advance.
A bit of information about COM on OS X is available in this 2004 article from O'Reilly's MacDevCenter.
From the description of your problem, however, you're looking for something that works with Apple Events. Apple has developed an entire language for working with Apple Events, so most people equate them with the language -- AppleScript. You'll want to start exploring the field of scripting GUI applications with exploration of AppleScript, or Apple Events.
Each directly scriptable app has a "dictionary" of "verbs" and "nouns" you can manipulate. Nouns have properties, and name of the property is often either a string or the name of another noun (or a plural of a noun, which implies a collection - an array).
If the app doesn't have a dictionary (i.e. it isn't scriptable) or doesn't provide what you need via the dictionary, it is possible to send generic UI scripting commands to an "application" called "System Events".
Hmmm -- not a lot of experience in the OOo arena, but have you considered using UNO, the component model that is part of OpenOffice?
Some documentation can be found in the Developer's Guide here.
I'm looking at options to access DVB data on OS X. Initially I want to support the EyeTV DTT USB device, but in the long-run I'd like to support a number of popular devices. The problem I have is that there is no standard way of controlling such devices.
All the applications I know of that use them either hide the driver code within the application (for example EyeTV itself, all it's drivers are implemented totally in userspace and are not accessible to external apps), or they use the seemingly defunkt MMInputFamily driver (no source code availible any more, author gone walkabouts).
I've done some research and found that a number of the devices I want to support are supported within the Linux DVB project. Further research indicates that some years ago there was an attempt to abstract the linux implementation so that it could potentially be recompiled on other platforms. The idea being that efforts to support devices should be pooled and the best way to do that would be to make the current open source implementation work on multiple platforms: it seems in the end to have amounted to little however.
The idea of compiling linux drivers against other *nix type platforms has also been taken up elsewhere with some success. The approach the author took is detailed on the page I linked, it seems potentially viable on OS X as well.
At any rate, there seem to be a number of options, but no clear winner:
Find the source code for the MMInputFamily driver, try to get it working on OS X 10.6 and add support for the devices I require, referrencing the linux source code for pointers. Problem: the source code is nowhere to be found, nor is the author. Additionally it seems the author might perhaps have gone down another route had he fully appreciated the previous efforts to port the linux drivers to OS X.
Attempt to port the linux drivers to OS X in a manner similar to the FreeBSD project I linked. Problem: this is very low-level work and work in this layer is not recommended by Apple if it can be avoided.
Write a driver with OS X's IOKit: this is the preferred method for implementing drivers but I would have to do everything from scratch, clearly not a small job.
If I could I would really like to use the Linux source code, but I'm unsure if such a thing is really viable. Does anyone have any advice or ideas on the best way to proceed with this task?
Greetings.
I will be getting a new smartphone for work. It needs to work with Telus, so the iPhone, and Android-based phones are out. The available phones appear to be include a number of BlackBerries, HTC phones, Motorola phones, as well as LG, Samsung, and ZTE phones.
I have a LEGO Mindstorms NXT robot, and would like a phone for which I could potentially write a program that would communicate with it over bluetooth. (LEGO does provide a cellphone app but it only works with some Nokia, Sony Ericson, and BenQ-Siemens phones).
From my research thus far, it sounds like many phones support J2ME and that I could install NetBeans to develop for it. (I haven't programmed in Java in years.) Unfortunately, it sounds like even if the phone does have bluetooth capabilities, they aren't necessarily accessible from J2ME.
Lastly, I'd rather like to develop from my Mac. (I could boot into another OS or fire up a VM, but I'd prefer not to.) NetBean's IDE download page says, "Java ME is only available for Windows and Linux." There appear to be workarounds -- is it a pleasant environment to work in?
So, my question is, does anyone know if any of these phones are, um, pleasant to develop a simple bluetooth application for, preferably from the Mac?
- Edit -
It turns out that my contract has not expired, and I've replaced my partially functional phone with a Treo 700 we had around. I appreciate all the answers. I started setting up a J2ME environment (until I learned that I may as well set up a Palm environment, and have started on that.) When I do get a new phone, though, I was sure be looking at the S60 phones -- heck, it might even trump an iPhone or Android phone, at least for ease of creating hobby applications.
You may be interested in this application NXT Director. The author says it has been tested with the following models of Palm based devices, Treo 650, LifeDrive, Zire72, SONY TH55/E and Tungsten series. It may also work with your 700.
Nokia ported python to the S60 smartphone platform. That means you can just write python scripts with your favorite text editor and then run them on any of these phones. The python port includes APIs for the camera, bluetooth, SMS, dialing, sounds, text to speech synthesis, location services...
I found it very easy to install the python interpreter and console on my phone and immediately start running scripts, no other tools required. If you have a strong thumb and like a challenge then you can even write the scripts directly on your phone :-)
If you want to run an S60 phone emulation on your PC then you will need windows and even then it is complicated to set up. For small hobby projects you can live without the emulator though.
You can try following combination for J2ME development on Mac OS X
Eclipse - http://www.eclipse.org/
EclipseME - http://eclipseme.org/
MPowerPlayer - http://mpowerplayer.com/sdk