Scripting the Terminal

I am trying to write simple script for terminal application :lol:
Need to write script commands to open in the same terminal window.
script looks like this:

tell application “Terminal”

do script with command "cd ibjts"

end tell
tell application “Terminal”

tell window 1
	do script with command "java -cp jts.jar:jcommon-0.9.0.jar:jfreechart-0.9.15.jar jclient.LoginFrame ."
end tell

end tell

Problem IS, i am getting an error with second command line:

Terminal got an error: NSInternalScriptError

Any help appreciated…

I’m sorry, this is off-topic, but I just wanted to comment that the only thing that makes a “newbie” a newbie is using a subject line that says “Newbie needs something,” as opposed to a descriptive subject that says something like “Terminal app commands.” This allows those who know something about the Terminal application to immediately see your posting and assist, while guys like me who know nothing about the Terminal app can move on to other postings.

Think of it in terms of marketing: you’re trying to get the right people with the right knowledge to help you, but your “ad campaign” is aimed only at those who like helping “newbies,” whether or not they know how to help.

Arthur is right about the subject line. Think people. As to the question, try this:

tell application "Terminal"
	delay 1 --wait until Terminal is frontmost
	do script "cd ibjts"
	delay 1
	do script "java -cp jts.jar:jcommon-0.9.0.jar:jfreechart-0.9.15.jar jclient.LoginFrame ." in window 1
end tell

Or this:

tell application "Terminal"
	do script "cd ibjts; java -cp jts.jar:jcommon-0.9.0.jar:jfreechart-0.9.15.jar jclient.LoginFrame ."
end tell

Or even this:

return do shell script "cd ibjts; java -cp jts.jar:jcommon-0.9.0.jar:jfreechart-0.9.15.jar jclient.LoginFrame ."


Sorry Admiral, your reply has merit, my apologies, subject should have been " Newbie needs simple script for Terminal app."
As I am new to this forum, and scripts, i was careless…
never took marketing though
did not mean to waste your time.
Can you and Jon be a little more condescending?
Seems to me Admiral, you may have spent more time responding, than simply to move on. i think you were more irritated than sorry.

Jon, thanks so much for your patience, your solution works perfectly.

Thanks for the advise.