Page 1 of 1

Open a text file with notepad on android

Posted: August 25th, 2017, 10:05 am
by jodapecol
Hi, a query I want to open a text file.
For example I want to open "lista.txt"
I've tried this:

Dir_existe02 = pathname (Application) + "Lists \" + "listing.txt";
1. execsystem (maketext ("app: com.example.android.notepad"));
2. execsystem (maketext ("app% s", dir_existe02));

Trying to execute the "1" was not executed and therefore neither the "2".

Re: Open a text file with notepad on android

Posted: August 25th, 2017, 10:13 am
by josh
When you use app: with execsystem there is no way to specify an argument. It will only launch the application. Instead you can use view: with the name of the file. Then, based on the extension of the file, Android will launch the appropriate to view that type of file (kind of like when you double click on a file in Windows). So if you have notepad installed and it knows how to open .txt files then when you use execsystem with view it will launch the file in notepad or if there are multiple programs on your Android device that know how to open .txt files it will ask you which one you want to use and you can choose notepad.

The code would be:

execsystem(maketext("view:%s", dir_existe02));

Re: Open a text file with notepad on android

Posted: August 28th, 2017, 3:50 am
by Yana
Is it possible to run (.bat) files in Cspro? when I write out the logic to run it opens file explorer in Windows rather than executed the .bat file.

Re: Open a text file with notepad on android

Posted: August 28th, 2017, 8:21 am
by Gregory Martin
You can run batch applications (on Windows). I've used this code to run a batch application:
execsystem(maketext('"%sCreate Deployment.bat"',pathname(Application)),wait);
I would look into whether your DOS batch file is written properly. If you double-click on it in Explorer, does it run properly?

Re: Open a text file with notepad on android

Posted: August 28th, 2017, 9:20 pm
by josh
It usually opens Windows explorer when the path or filename of the bat file you are launching is incorrect. I bet that you don't have the filename or path correct in your call to execsystem.