Get file name of file used to open the associated application - delphi

I want to write a small app that does some data manipulation on the contents of a simple text file.
I just want to be able to right click such a file, choose 'Open with' in Windows, select my app, then the app opens, parses the file, does some stuff and closes immediately again.
Question: when my app starts, how do I get the file name that triggered the app to start?
Thanks!

You get the file as parameter number 1.
You can get it with the function ParamStr(1).
Have a look here for more details:
http://www.delphibasics.co.uk/RTL.asp?Name=ParamStr
For your information, ParamStr(0) is the filename (including complete path) of your EXE application.

Related

How to write text into the file saved on server in swift3 iOS

I am trying to write some text to the file on Server. Text file server path is:
http://test.info.com/log.txt
So, whatever we will write on this text file can able to see in browser. Please anyone suggest me.
In one word, There is no on the fly write possible from mobile to server file.
Justification:
Question:
What's happen if I paste the logfile URL(http://test.info.com/log.txt)
into the browser?
Answer:
It will just download the log.txt file. Also, It will not allow doing
direct editing in the browser too. If it will is not feasible from the browser So how can we do it from the mobile end?
Alternatives:
Recently I worked with the same type of requirements. I have achieved it by creating the local log.txt file. Write into this file. Every day, I have uploaded the same log file into the server.
To write into the log file, I have used SwiftLog(Simple and easy logging in Swift)
You need to create 2 APIs on the server where your text file is kept. One API to get the data of the text file. Once that is done, show it in a TextView and edit it.
After editing, you can call another api to send the updated data back to the server.

How to view html output in Notepad++?

How do I view my Code output in Notepad++ as a webpage or something similiar?
I have built something but I can't find a button or something like that in Notepad to view it as a webpage or something similiar.
If it is a webpage written in html:
just go where you saved it and click it.
If it is in php:
You will need a web server, save the file in the www directory. and access it like this:
http://localhost/yourfile.php
Simply, save your file with the correct extension in this case html, then click run , in the run menu click launch in, (in whichever is your browser) in my case, chrome.And it should work(:
Add this plugin in Notepad++: Preview HTML but it opens only in IE
To setup Notepad++ for testing your markup or code there are a few things to consider.
When Notepad++ launches do you want a test document opened by default?
What language do you prefer the document to be opened as?
What browser do you wish to test your test file in?
Do we want a shortcut to open test in browser?
If you do not have your local environment setup to run server-side scripts you will be limited to what the browser supports.
In my example setup I will be using .php as my language. There are some variables, but I've chosen what I believe best suit my needs. I'm also using a windows machine.
Create a new file in C:\Program Files (x86)\Notepad++ (or wherever) as php.php (or whatever). This will be the document we keep open and will remain open so long as we never close it.
In Notepad++ go to Settings > Preferences > New Document
In the bottom left there is a drop-down. Select your language (php in my case).
Open php.php in Notepad++.
Go to Run > Modify Shortcut / Delete Command and locate your desired browser (note: this may not work as expected in some browsers i.e. Internet Explorer, go figure).
Create a custom shortcut so your document can be launched to test (unless you are happy with what is already setup).
This will effectively keep your default file open in Notepad++ every time it is launched in your preferred language and allow you to quickly test your markup.
Cntrl + Alt + Shift + I(Alphabet if you want to open in Internet explorer)
I hope this will work.

Core Animation in Instruments file can't open and No Data

I hope someone enlightens me with this:
After saving a trace file (example: filename.trace) and send it via email, how come the recipient couldn't open the file?
So, I decided to compress the trace file (example: filename.trace.zip) and send it again via email, the recipient was finally able to open the file, but he can only see the Trace template I used, NO DATA FOUND (no spiky stuff). (Same thing happens with putting the trace file in dropbox and send the link.)
Btw, I'm using Core Animation Trace Template (that might have something to do with it).
Some suggestions (I have no experience with this particular file):
did you properly close the file? its possible what you are sending is a file that is not itself complete
in the past, I set some flag in the app plist that let me share files with iTunes. You could try to copy the file to the shared location (Documents folder? not sure now) at the same time you email the file (and maybe email the new file not the original), and see if the one you grab from iTunes opens, and is different from the one that gets emailed
In the end, you need to determine if what you have on the file system is byte for byte what ends up getting received in email, and if the copied file from iTunes opens. Once you find this out, if the problem is not obvious, then update your question. Good luck.

Can an iOS custom document editor return a file to the opening application?

I understand how to create an iOS application that is either a viewer or an editor of a document type. There are several good questions on how to do this:
How do I associate file types with an iPhone application?
How do I register a custom filetype in iOS
My Question is this: Once the "editor" application has received the file and made modifications to it, how does the file get back to the original application that requested the file be opened?
Restated: If application 'A' has a file that is edited by application 'Editor', then 'A' can use the UIDocumentInteractionController to open the file in 'Editor'. If I understand correctly, this causes the file to be copied into the "Documents" directory in the sandbox of the application 'Editor'. The application 'Editor' can then make modifications to that file. Once the 'Editor' is done making changes to the file, how then does application 'A' see those changes?
You could register your application as a document handler for any known file types. Then the user would 'Open in (your application)' from within the 'Editor' application once they were done making changes.
It's not ideal but it's the best I've come up with so far. I hope there's a better way.

Actionscript downloading a File using FileReference

I'm having trouble working on FileReference download(URL) function. I needed to automatically download the files in a particular space on my harddisk but the SAVE AS dialog always displays. can I make it automatically download in a certain place on my disk?
I'm going to assume "automatically download" means "save" here. Nope, If you use FileReference (or File in AIR), there's no way to automatically save without showing the Save As dialog box.
If you don't need to access the file outside of the app, then take a look at the SharedObject class: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html. By default you can create SharedObjects of up to 100KB without needing the client's permission (see the description of getLocal()), which should be fine for more simple text or xml info - you can compress it using ByteArray if you want to save space. Any more than that and a small dialog will open asking permission. Once you've given permission however, it won't ask again.

Resources