Saving a text file from external source to my app Objective C - objective-c

Abstract Question here I guess
I have an idea for an app that parses .txt files and outputs info based on what is contained in the file. My question is how would I go about getting the text file into my app for example if the text file was attached to an email?
This is the only hurdle I have to get clear in my mind before I begin.
So here's a real life scernaio -
I have email with text file, I want to open my app and say import file.
I need to get that text file from my email into the app so I can manipulate it.
Not sure this is possible, hopefully somebody can let me know or suggest a workaround.
Thanks in advance!

Register your app to open a particular file type and ensure the attached file is identified as one of these file types (i.e. using mime type). You will probably want to use a unique file extension, other than .txt.

Related

Is there a way to set a file name when jspdf output()

My site draws a column chart. I have a button to save it as a PDF file showing it before saving.
The way it works now is this.
google.visualization draws the chart.
html2canvas takes a screenshot of the chart.
jsPDF inserts the screenshot in a PDF file and shows it to the user.
The problem is the name of the PDF file. It is something like 5d78c1eb-0829-4e7e-8ffc-71cf1f102f56.pdf and the url is blob:http://example.com/5d78c1eb-0829-4e7e-8ffc-71cf1f102f56
When user sees the PDF and clicks save he receives this awful file name.
Now I show the PDF this way:
window.open(doc.output('bloburl'), '_blank');
I can set desired file name if I change this line to this:
doc.save('sample-file.pdf');
But in such a case the file just downloads but I need to show it first.
Is there a way to show the PDF and give it a desirable name? I tried this:
window.open(doc.output('bloburl', {filename: 'myFileName.pdf'}), '_blank');
But it did not help.
Another way I see is not showing the PDF from jsPDF, but sending images to the server and making a PDF file there using TCPDF. The files made with TCPDF can have a name I give it, but I think it is dumb to send the images there and back.
So the question is how can I make a PDF and show it to the user with the name I want?
At the moment the answer is no. You can download it directly, as mentioned in the accepted answer of this question: Download with filename
But you create an objectUrl and therefore the filename is always the url.
Maybe you could create an browser-extension for this...but I haven't had the time to try yet. Furthermore, you can't expect your visitors to have the extension installed.

VB.Net Run.exe with Form button

I'm pretty new to VB so I need a bit of help with some coding.
I made a program that should download a certain file to what ever directory the user wants, but now i want my program to run that certain file but i don't know how to do it since the user used his/her own directory.
Like i want the program to run that certain file no matter where its saved, how do i do that?
I do know this code:
System.Diagnostics.Process.Start("C:\")
but this doesnt really work since i have to put in a directory before i use the program.
You can get the path of the SFD by using filename.
Dim Path as String
Path = SaveFileDialog.FileName
Then run the file.
System.Diagnostics.Process.Start(Path)
Found another way of doing it,
I just used:
file.open(textbox1.text)
And made it take the text forom the the other textbox the user browsed the file to

VB.NET Opening A File From Form

I'm using the following the code to open a file that resides elsewhere on the computer:
System.Diagnostics.Process.Start(PathToOpen)
Where PathToOpen is the full address to the file I wish to open. This appears to work as intended for any file type that has an application installed that can open the file.
Whilst this works OK, if the file is on a networked drive, I want my VB.Net code to check if the file is currently in use, if so display a message. Currently what happens is if a second user tries to open the file, it opens read-only (a word file for example) which is handled outside of my application. I want to intercept before the file is opened and stop the process there.
Is this possible at all?
You are basically asking if it's possible to monitor files on a system that doesn't even belong to you ?
Word does know about a file already in use because it creates a hidden file next to the one you open. if there is already a hidden file, it means the file is already in use.
Other applications use different ways of knowing if a file they can use is already opened somewhere else.
In order to do what you want to do, you need to know how all the applications handle this problem...
A possible solution would be for you to create a small hidden file next to the file the user wants to open (just like MS Word does). Only problem, you need to destroy the file when it's closed by the user, and you have no way of knowing that...

Are Objective-C function names stored in text?

I don't remember where I heard about it, (I think I was searching up on how selectors worked and it ended up not being exactly the same as a callback function) and I can't confirm it. But more importantly than that, is there a way I could get a list of the function names from another application?
See class-dump.
You can sometimes see a list of the method names in an application. Find the .ipa file for the app (possibly in the Music->iTunes->Mobile Applications directory on a Mac). Make a copy of one of the ipa files and change it from .ipa to .zip. Unzip the file and in the Payload folder, there's a file with the same name as the app. Right click on it and "Show Package Contents". In there, you'll find another file with the same name as the app (with no extension). This is the executable file for the app. If you open it in a text editor like BBEdit, you'll sometimes be able to see some method names, as well as a list of the frameworks the app is built against. You can find the path name where things were kept too, often with the developer's name.
For example, looking into the Japanese dicitonary Daijirin, I can see these methods:
-[HMWebSupport openMONOKAKIDOSupportWithSafariForView:style:]
-[HistoryViewController viewWillAppear:]
I can also see that one of the developers was called Norihito, and he was using SVN: /Users/norihito/Developer/SVN/Mobile/DAIJIRIN/Other
Other applications (like Weightbot) don't show as much information. I don't know the reason it shows up some times and doesn't other times.

Associate file type/extension to non document based cocoa application

This is for some reason really hard to find and solve. Cannot find any documentation on it.
I've got a non-document based application which I would like to open all specific file types, but I do not want to use NSDocuments but let my code handle the opening of file and processing of it. I've added the CFBundleTypeExtensions and all, settings to the info.plist.
Now the application will open the filetype but display an error like: "The document xxxx could not be opened. Application cannot open files in the yyyyy format."
Have you implemented -application:openFile: in an app delegate? If not, your application has no way of knowing how to open some random file in some random format. It's up to you to add that functionality and respond with success or failure.