How to get the filename of document that opened my app
Hope that makes sense. I'm relatively new to OS X programming and have built a small Cocoa app (not a document-based app). I've associated a file type (.myFileType) with my application. If I double-click a file with that file type, it opens my app automatically as expected. From within my app, how do I get the full pathname of the document that opened my app?
I know what you're saying. IB is made to seem easy, but when you start asking "What's this?", and "What does that do when the nib is loaded??", the pretty pictures suddenly aren't as clear as they seemed. Been there!
The File's Owner never causes the creation of an object. It's always a "proxy" (a stand-in) for an object that's created elsewhere. The actual object may be defined in another xib, or it may be created in code. In MainMenu.xib. the File's Owner is a proxy for the Application object. The Application object isn't created because of that nib, it's created by the startup code before the nib is loaded. But the "proxy" allows you to make connections to the Application object in the xib.
I know this is clear as mud so far, but it will start to make sense after you grok a few more pieces of the puzzle. A good place to start might be Anatomy of a Nib File in the +Resource Programming Guide+.
Nib proxies are actually easier to understand when building an iPhone app. In that case, the SDK makes it much easier to associate proxies with the objects they represent. The concept is still the same, but for example, bridging two iPhone xibs with a proxy only takes a couple mouse clicks in IB.
Hope that helps!
\- Ray
Similar Messages
-
How to get the filename from J2SE File adapter
In our project scenario , we are using J2EE and J2SE engine both .J2EE for mapping and J2SE for Deliveying the message .
In one senario, routing will be based on the filename .
J2SE Sender File adapter --- XI Adapter --- XI pipe line
So the File reaching to XI pipelane via J2SE File adapter--> XI adapter.
When we are using the dynamic configurator in the XI to get the filename
we are not able to get the file name becasue it is coming to XI via
XI adapter.
How to get the filename ????Hope I am clear about the problem.hi,
try this
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//obtengo la Key del FileName
DynamicConfigurationKey keyF = DynamicConfigurationKey.getName();
http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/DynamicConfigurationKey.html
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516
/people/mohammed.zabiulla/blog/2008/03/26/have-you-ever-tried-to-determine-mail-cc-dynamically
Hope it helps
Thanks
Rodrigo
Edited by: Rodrigo Pertierra on Apr 11, 2008 9:31 AM -
How to get the list of documents
Hi everyone
Can anyone help me How to get the list of documents residing in a folder of KM repository of SAP Netweaver using a simple java program
Thanks in ADV.
Rupesh KhemkaHi Rupesh,
I have written the code for you and it works with WebDynpro, no seperate java program is required.
Just try to paste it in your application code and run it.
try{
// Will check the user athentication for EP
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
com.sapportals.portal.security.usermanagement.IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
// The path in which your folder resides
RID rid1 =RID.getRID("/documents/Public Documents/SCAP/");
IResourceFactory factory1 = ResourceFactory.getInstance();
ICollection icollection = (ICollection)factory1.getResource(rid1, context);
IResourceList resourcelist = icollection.getChildren();
int size1 = resourcelist.size();
for(int s=0; s<listOfDocuments.getLength(); s++){
IResource resource = resourcelist.get(i);
InputStream input = new InputStream();
input = resource.getContent().getInputStream();
}catch(Exception e){
e.getMessage();
Once you get the InputStream everything else is possible....
This will surely help you in reading the documents from KM.
Regards,
Rekha Malavathu -
How to get the Next Material Document Number
Hi,
Please let me know How to get the next Material Document Number using Functional Module,
Material Document number are in MSEG table.
Regards,
GaneshHi Ganesh,
if you want the next matrial number then first of all you have to define it as a number range in transaction snro.After creating the number range you have to define the interval.
now you can use your number range by calling the function module
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01' " here you have to give the number range number which you have defined in number range
object = 'ZPRODLOG' " Number Range
IMPORTING
number = wa_prod_error_log-seqnr " sequence number generated,in your case material number field
EXCEPTIONS
interval_not_found = 1
number_range_not_intern = 2
object_not_found = 3
quantity_is_0 = 4
quantity_is_not_1 = 5
interval_overflow = 6
buffer_overflow = 7
OTHERS = 8.
each and every time next number will get generated .
i hope this will help you.
Thanks,
Tanmaya -
How to get the number of files currently open?
hi,
does any one know how to get the number of files currently open in windows OS?
e.g. lets say .txt files...
any comment will be really appreciated.
thanksAssuming that you don't want to actually do this from within Java code (which would obviously require native code), here's a utility that will give you a list of which file handles are opened by which processes (on Windows):
http://www.sysinternals.com/ntw2k/freeware/handle.shtml
- K -
Why do I get the following message when I open an APP. Connect to ITUNES to use push notifications. What do I need to do to resolve this issue.
I have had the same problem since the iOS 7 update, but with regards to the Find Friends app. uninstalling and reinstalling the app has not fixed the problem
-
How to get the filename of the active jsp page?
how can i get the filename of the active jsp page?
You could register the JSP [ages in the web.xml and then use the ServletConfig.getServletName.
You could use the JspContex.getServletName which will return the registered name or the name of the servlet class.
You could programmatically add a page context attribute that holds the jsp page name -
How to get the filename when parsing a file with d3l
All
After some time have experience with interconnect, IStudio I need the following info. Is it possible to get the filename when parsing a flat file using a d3l? This is needed because we need to store the filename together with the data into the database.
Any examples or directions to some documents are welcome.
Regards
Olivier De Groefhas anyone some info on this
-
I'm a green hand on hardware. This question is maybe kind of a silly quetsion.
I already have a data acquisition board installed (built-in) and there is the corresponding program to control it.
Now I need to install another board to the computer, and make the necessary Vi to control the new board. I'm wondering what should be the procedure like? HOW to get the computer know the new board. Should there be any driving program coming along with the hardware. Or the operation system should get to know the existing of the new hardware once it's installed( i mean plug in). Thank you for your kind reply!Hi Fenny,
What is the model number of the second board? If your existing driver has support for this board (which I'm assuming is a NI board, and it's plug and play), your OS (which I'm assuming is Windows) should recognize it when you start up your computer after installation. You can find out the driver support for your board and OS from the link below. If the installation was successful, you should be able to see the new board in the Measurement and Automation Explorer (MAX) under "Devices and Interfaces". If you can see the board in MAX, there will be a device number assigned to the board, which you can use in your VI to communicate with it.
If any of the above assumptions is incorrect, please provide some details (i.e. hardware used, driver you currently have installed, OS, and the application you'd like to use this new board for), and we can work from there.
Data Acquisition (DAQ) Installation/Configuration Troubleshooter
Thanks,
Lesley Y. -
How to get the current user name in Provider hosted app using appOnlyAccessToken
Hi,
Please help me, how to get the HostWeb UserName in Provider Hosted App
i have Provider hosted App, and Anonymous Authentication is enabled on AppWeb, using appOnlyAccessToken
Below code does not return current user who Log in in hostweb, it is returning
SharePoint App (app@sharepoint)
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
clientContext.Load(web.CurrentUser);
clientContext.ExecuteQuery();
clientContext.Web.CurrentUser.LoginName;
Below code gives a blank name when Anonymous Authentication is enabled, if Anonymous Authentication is disabled
app prompts for credentials
HttpContext.Current.User.Identity.Name
Thanks
RamHi,
Since you are using a provider Hosted app if you want to get the current logged in name than do not use AppOnlyAccessToken else use AccessToken which is App + user Context AccessToken.
then
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
clientContext.Load(web.CurrentUser);
clientContext.ExecuteQuery();
clientContext.Web.CurrentUser.LoginName;will return proper user Name.
HttpContext.Current.User.Identity.Name will never return the user as this object is related to IIS server of your App Server not sharepoint.you should set this as Anonymous in case of provider hosted app.you can download the below sample which uses the AccessToken which has user name in it.https://code.msdn.microsoft.com/Working-provider-hosted-8fdf2d95
Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer -
How to get the filename of the opened Illustrator document
Hi All,
I'm using Adobe Illustrator CS2, i have problem in getting the file name of the document opened. i have succesfully got the document reference(of opened document) but from that reference i'm not able to find the method which gives me the filename. Can you please help me out.Hello, I need to automatically enter the file name and date in a drawing using illustrator DC 2014, please can you help me understand how can I do?
Thanks so much -
How to get the filename of the current active document in InDesign CS4?
Hi,
If I open a document from File->Open, I can get the document's file name using IOpenedFileInfo->GetOpenedFilePath().
But, if I create a new document and perform File->SaveAs, GetOpenedFilePath is returning invalid IDFile reference.
What is the right way to get the active document's file name?
Thanks,
VSPYou can try this:
IDatabse * db = ::GetDatabase(theDoc);
IDFile * sysFile = db->GetSysFile();
PMString docName = sysFile->GetFileName();
Good luck -
How to get the web of document from the URL
Hi All,
Need small help here,
I have SharePoint doc URL as below:
http://sharepoint.com/sub1/sub2/sub3/documents/TestFile.docx
Here, TestFile existed in document library of Subsite i.e. sub3.
If I give above URL as input, I should be able to get "sub3" web.
How can achieve this programmatically. Overall we should get the leaf web from the URL.
Thanks in advance.
KrishnasandeepHi Sanny521,
The SPSite constructor does not care when you pass in the document library and filename as part of the url. you can use the following code:
string myFileUrl = "http://sharepoint.com/sub1/sub2/sub3/documents/TestFile.docx";
using (SPSite site = new SPSite(myFileUrl))
using (SPWeb web = site.OpenWeb())
SPFile file = web.GetFile(myFileUrl);
string webUrl = web.ServerRelativeUrl;
You pass the full url into the SPSIte constructor, it will retrieve the site collection, then the OpenWeb call will retrieve the proper web from the already passed full url, then you can retrieve the file and the url of the SPWeb.
Mathieu Desmarais http://www.matdesmarais.com/ -
Already connected with DB content. how to get the filename???
Hi, i solved my problem changing the server.xml, so now i can connect OK to Oracle Content Database, using the last code from OTN.
This BPEL Process starts when the user copies a file into a folder in content db..and i need to know that filename.
Anyone knows how to get that file name after i am connected???
The code i am using and works to connect is this:
try
oracle.ifs.fdk.RemoteLoginManagerServiceLocator rlmsl =
new oracle.ifs.fdk.RemoteLoginManagerServiceLocator();
rlmsl.setMaintainSession(true);
// initialize the RemoteLoginManager
oracle.ifs.fdk.RemoteLoginManager s_RLM =
rlmsl.getRemoteLoginManager(new java.net.URL("https://contentdev.nblenergy.com/content" + "/ws/RemoteLoginManager"));
// establish a session
oracle.ifs.fdk.NamedValue[] properties= s_RLM.login("kofax","xxxxxxxxxx", null, null);
addAuditTrailEntry("properties",properties);
catch(Throwable ex)
{addAuditTrailEntry("Others",ex);
ex.printStackTrace();
}Did you every find how to accomplish this?
Thanks,
Steve -
How to get the filename from URL
Hi,
I want get the file name from the url while downloading a file. here is my case follows:
I have url like "http://www.myhost.com/dowloadFile.do?id=345546" . this will download "test.zip"; file from the browser.
I want download the file from that url and save that as "test.zip";, how can we get the file name "test.zip"; from java. I am using ConnectionURL to download the file.
waiting for the earliest responses.
-BhaskarSpecify it in the content-disposition header.
To get it to work in a certain webbrowser, you need to supply it as part of the URL either.
Also see this example: [http://balusc.blogspot.com/2007/07/fileservlet.html].
Maybe you are looking for
-
When I close firefox, it closes, then later when I try to open firefox again a message opens and says firefox is already running, ---have to open task manager to close firefox before it will open again, browser may have been open for hours and didn't
-
I need to have an object to act like a Ticker in a Canvas. Does anyone know how to do it?? (MIDP's Ticker object can only append in Form object)
-
Playbook Activation could not connect to update server (9).
good day to all, I got a new Playbook yesterday and i have to activate it and update for the first time. it says "could not connect to update server (9)." what does this mean? Can anyone help me? What are the steps to resolve this. Thanks.
-
How to put 2D graphics in TransformGroup?
I can use J3DGraphics2D to draw graphics in Canvas3D, but may i put the graphics i drawed in a TransformGroup so that i can remove them later?
-
Allow page breaks and text overflow indicator
I have set up a sub form to allow page breaks within content which works but then the content that continues on the next page has the text overflow indicator showing and the text field does not expand which is what I want it to do. What do I need to