Page 1 of 1

TC passing iInitialCommand to Terminal Emulator possible?

Posted: 2011-08-17, 13:23 UTC
by gap
Hello,

first of all I'm a big fan! I loved TC for WinMobile and was so happy using it on Android for the first time again!

Now my question: is it possible to set the "intent" "iInitialCommand" via parameters options?
see github[dot]com/jackpal/Android-Terminal-Emulator/wiki/Launching-Android-Terminal-Emulator-from-another-App (sorry can't post links)

I allready tried various variations (using "Start program (main)" or sth. - "Programm starten (Hauptfunktion)" in german):

Code: Select all

extra:iInitialCommand:echo x
extra:iInitialCommand:"echo x"
extra:jackpal.androidterm.iInitialCommand:echo x
extra:jackpal.androidterm.iInitialCommand:"echo x"
and i believe i also tried all of te above with "stream:"

PS: actually I want to set the command to be "cd %P" instead of "echo x" which is just for testing ;)

Posted: 2011-08-18, 12:05 UTC
by ghisler(Author)
No, unfortunately not - the "extra:" option adds the parameter as "android.intent.extra.name", e.g. "android.intent.extra.iInitialCommand". Currently it's not possible to pass parameters without this name prefix. I will consider it.

Posted: 2011-08-22, 23:36 UTC
by gap
Hi again, I don't want to be annoying, so if you want just ignore this post ;)

I think
2011-08-19 Added: Button bar, new paremeter "Extra0:": like "Extra", but no prefix "android.intent.extra." is put in front of the name
from the changelog is what you implemented for my needs :) , but I still can't get it to work.
I tried all of the samples from above again. Is it just me?

Thank you again for your great work on TC, Android RC1 is great so far :)

Posted: 2011-08-25, 09:01 UTC
by ghisler(Author)
Here is the code I'm using:

Code: Select all

if (paramline.startsWith("extra0:")) {
				        		paramline=paramline.substring(7);
				        		int content=paramline.indexOf(':');
				        		if (content>0) {
				        			String xtra=paramline.substring(0,content);
				        			paramline=paramline.substring(content+1);
				        			myIntent.putExtra(xtra,paramline);
				        		}
				        	}


According to your link, you need to use:
extra0:jackpal.androidterm.iInitialCommand:echo x

Then Total Commander will call
myIntent.putExtra("jackpal.androidterm.iInitialCommand","echo x");

However, TC currently only supports parameters for VIEW and SEND, but not for MAIN. You can check whether it works for VIEW (View file with program). If not, I will have to add parameter support for MAIN too. It's very unusual that a program expects parameters in the MAIN action.

Posted: 2011-08-25, 09:31 UTC
by gap
Hi,

thank you for your reply!
Unfortunately neither VIEW nor SEND does work with the Terminal. It starts and closes again instantly. (Tried with both a selected folder or file)

For the moment I use the internal command 122 to copy the path to the clipboard and insert it after opening the terminal as a workaround.

Posted: 2011-08-25, 09:46 UTC
by ghisler(Author)
OK, I will add parameter support for the MAIN command, although this isn't normally used on Android.

Posted: 2017-12-22, 11:10 UTC
by SkipR
gap wrote:Hi,
For the moment I use the internal command 122 to copy the path to the clipboard and insert it after opening the terminal as a workaround.
Thanks for the tip. Is passing args to Term Emulator app still not working?