|
#1
| |||
| |||
| Make StdC++ Console App Droppable? New to Mac/OSX programming. In Windows when dropping a file (of which there are no restrictions) on a conole app, it is the equivalent of calling the application's main function with argv[1] as the full path to the file that was dropped on the app. This is pretty convenient. I've managed to write a console app in CW that I can explicitly call from the terminal, like so: $myapp <path_to_input_file> It works fine (though it opens a separate terminal window for cerr output that does not return control to the calling terminal; I have to command+break to close, but that's a separate question). However, apparently I have to define a value somewhere (.plc file in CW?) that describes what files are droppable onto the application??? Any help, much obliged. |
|
#2
| ||||
| ||||
| I do not understand how this is supposed to work. If you drag a file to the console, how is it to know what application to call? As it is, if you drag a file to the Terminal.app, the entire path is copied. Thus, if you have typed $my_app in the terminal, dragging the file you want will cause the path to be placed in the terminal, resulting in $my_app <path_to_file>, which is as far as I can see what you want. Maybe I'm understanding your question wrong as I've never worked with CodeWarrior. |
|
#3
| |||
| |||
| Quote:
Quote:
I would like to do this in OSX. |
|
#4
| |||
| |||
| I don't think it's possible with standard Mac console apps. You need to bundle it into a .app and implement specific functions for accepting a dropped file in Carbon or Cocoa. What you can do is use an AppleScript to allow someone to drop a file onto the AppleScript, and then have the AppleScript launch the console app. I wrote up a small little script to do this for you. Just open it in Script Editor and Save As an Application so it can be used. Last edited by kainjow; October 19th, 2005 at 02:36 PM. |
|
#5
| ||||
| ||||
| I honestly do not understand what the OP is describing. Do you mean to say that on Windows, if I drag any file to the command prompt (which is saying something like c:\ with no launched application), it will automatically load up a program (what program?) and pass the path to the file as the first command line argument? Or do you mean that if you have an application running on the command line, and you drag a file to it, it automatically .... relaunches the application, passing the path to the argv variable? Neither of these seems plausible and I work on Mac OS X and Linux almost 8 hours every day. |
|
#6
| |||
| |||
| I think what he wants is to be able to drop a file onto a Mac executable and have the executable launch with the path as an argument to the program. He mentions you can do this on Windows, but as I said you can't really do it with a normal Mac console program. You have to do it as Carbon/Cocoa or an AppleScript workaround like I posted. |
|
#7
| |||
| |||
| Quote:
You are correct kainjow. Thank you for your time and help. I'll check out the script this afternoon. Something like this is what expected to have to do. Hopefully I'll be able to "package" the end result in such a way that it appears to be a single file to the end user, but one step at a time I'll report later on. |
|
#8
| |||
| |||
| Quote:
Gosh darn it. I'm registered and logged in, but seem to be prevented from downloading this file. When I click on it, it asks me to log in (though I am logged in) and informs I may not have access privelages. What gives? |