Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-01-2008, 01:59 PM
robh robh is offline
Registered User
 
Join Date: Sep 2008
Posts: 16
Does anybody have an javascript (js) sample scripts???

Hi,

I'd like to run some commands in my shell when I log in.

Does anybody have any sample scripts written in Javascript?

I could use the vb script samples but I'd rather not

Thanks

RobH
Reply With Quote
  #2  
Old 09-02-2008, 11:11 AM
tnygren's Avatar
tnygren tnygren is offline
Registered User
 
Join Date: May 2005
Posts: 1,408
Hi RobH,

There are some sample Java scripts on our website at the following link:

http://www.vandyke.com/support/crt/s..._examples.html

Some users have also posted Java scripts on this forum also.

Was this the information needed?
__________________
Thanks,

Teresa

Teresa Nygren
Reply With Quote
  #3  
Old 09-03-2008, 04:06 AM
robh robh is offline
Registered User
 
Join Date: Sep 2008
Posts: 16
Hi,

yes thanks tnygren. That was a great help.

In case anyones interested - all I wanted to do was push some shell commands every time I login. I have to work on a fleet of machines all running zsh by default and I wanted to personalise my login.

function main()
{
crt.Screen.WaitForString( ">" );
crt.Screen.Send( "exec bash\015" );
crt.Screen.WaitForString( ">" );
crt.Screen.Send( "export PS1=['$PWD']\015");
crt.Screen.WaitForString( "]" );
crt.Screen.Send( "alias l='ls -lrt'\015");
crt.Screen.WaitForString( "]" );
crt.Screen.Send( "export VISUAL=vi\015");
};

This seems to work fine for me.

Thanks again

Rob Hynes
Reply With Quote
  #4  
Old 09-03-2008, 10:05 AM
robh robh is offline
Registered User
 
Join Date: Sep 2008
Posts: 16
There's nothing like consistency is there!

since writing the script I've found some of our hosts (xen virts) render the user with a slightly different prompt. This is the new version of the script.

RobH

function main()
{
crt.Screen.WaitForStrings( ">", "$", "%" );
crt.Screen.Send( "exec bash\015" );
crt.Screen.WaitForStrings( ">", "$", "%" );
crt.Screen.Send( "export PS1=['$PWD']\015");
crt.Screen.WaitForString( "]" );
crt.Screen.Send( "alias l='ls -lrt'\015");
crt.Screen.WaitForString( "]" );
crt.Screen.Send( "export VISUAL=vi\015");
};
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:49 AM.