Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-03-2020, 08:51 AM
Baron Baron is offline
Registered User
 
Join Date: Oct 2020
Posts: 7
Two scripting issues in 8.7.3 with Captions

I see two issues with Perl scripts with SecureCRT v8.7.3 on Windows 10, 2004.

Please bear with me, it looks simple on the surface, but there's complications that make it curious.

I have two versions of SCRT installed on the PC.
Old version is Ver. 8.5.3 (x64 build 1867)
New version is Ver. 8.7.3 (x64 build 2279)

I have been using Perl scripts happily with SecureCRT for many years.

ISSUE 1

When I upgraded to 8.7.3, the command:
Code:
$crt->window->{"caption"} = $hostname;
silently stopped working. It DOES work in 8.5.3. It sets the Window and the TAB caption.

Recap; on 8.7.3, the script runs with no error, and the tab text does not change. I see no error messages. It works fine in 8.5.3. My workaround is to keep using 8.5.3

Here's a script I use as a test. It fails to update the TAB caption on 8.7.3 and works the way I want with 8.5.3.
Code:
#$language="perlscript"
#$interface = "1.0"
use Win32::OLE;
Win32::OLE->Option(Warn => 3);
my $hostname = "TEST";
$crt->window->{"caption"} = $hostname;
exit(0);
ISSUE 2

The observant folks will immediately notice that I used 'set window caption' and not 'set tab caption'. There's an important reason for that.

In 8.5.3 (maybe earlier) the 'set tab caption' does not work for me. In 8.5.3, however, 'set window caption' DOES set the TAB caption perfectly fine.

I assume that in 8.7.3, that 'feature'/behavior was 'fixed', because in 8.5.3, 'set window caption' will set both the tab and the window caption. I don't care about the window caption at all, so I use the command to set the tab caption. I was happy.

BUT In fact, the command:
Code:
$crt->tab->{"caption"} = $hostname;
causes the entire script to fail to execute, with a failure dialog pup-up:
Code:
PerlScript Error: Error: Win32::OLE(0.1712) error 0x80020003: "Member not found" 
 in METHOG/PROPERTYGET ""
<note the ending double-double quotes is in the actual error message. I assume those would contain text of a missing command?> Also, the error points to line 6 in the test script above ("...set->tab...")

I assume that the syntax of the commands are correct, but there's not much Perl documentation for SCRT that I can find, so I've had to guess at a lot of stuff so That's my most likely error; in just guessing.
Code:
$crt->window->{"caption"} = $hostname;
Code:
$crt->tab->{"caption"} = $hostname;
I've tried to be complete in my problem definition. Please, let me know if you think I can try something. If I'm lucky, it's something stupid I'm doing.

Thanks for reading.
Baron.

Please forgive and call out any possible typos.
Reply With Quote
  #2  
Old 11-03-2020, 10:32 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,523
Hi Baron,

The differences you are seeing are from this change:

Changes in SecureCRT 8.7 (Beta 1) -- November 20, 2019
------------------------------------------------------
New features:
  • Added the ability to set window and tab captions independently in the Session Options dialog and from a script.
In SecureCRT versions prior to v8.7.x, even though two properties existed, they could not be set independently (as you noted).

For ISSUE 2, I'm not great at perl, but I think it needs to be a $tab object, not a $crt object since you are trying to specify the tab caption and not the window caption and they are now able to be specified independently.

Code:
my $tab = $crt->GetScriptTab;
$tab->{"caption"} = $hostname;
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 11-03-2020, 11:40 AM
Baron Baron is offline
Registered User
 
Join Date: Oct 2020
Posts: 7
Oh! Thank you so much! As soon as I can get a chance, I will try. Thanks for reading and responding.
Reply With Quote
  #4  
Old 11-03-2020, 02:02 PM
Baron Baron is offline
Registered User
 
Join Date: Oct 2020
Posts: 7
I can't get those to do anything. I am resorting to trial and error

Code:
my $tab = $crt->GetScriptTab;       # not working
$tab->{'caption'} = $hostname;      # not working
$crt->tab->{$hostname};             # not working
$crt->$tab{'caption'} = $hostname;  # doesn't compile
$crt->tab{'caption'} = $hostname;   # doesn't compile
$crt->tab->{'TEST'};                # not working
$tab->caption{'TEST'};              # doesn't compile
$tab->caption{$hostname};           # doesn't compile
$tab->caption{'$hostname'};         # doesn't compile
$tab->caption{"$hostname"};         # doesn't compile
$crt->tab->caption{'TEST'};         # doesn't compile

The SCRT help documentation doesn't show 'GetScriptTab' as a valid method.
'not working' means no error, but nothing happens.

I liked it better when it was broken

I'm still trying things.
Thanks again!
Reply With Quote
  #5  
Old 11-03-2020, 02:21 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,523
Hi Baron,

I posted exactly what worked for me.

See graphic below.


GetScriptTab is a method available to the Application object.

Description
Returns the tab or tiled session window from which the script was started.
Attached Images
File Type: jpg baron_myResults.jpg (95.1 KB, 107 views)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by bgagnon; 11-03-2020 at 02:24 PM. Reason: Addressed GetScriptTab
Reply With Quote
  #6  
Old 11-09-2020, 10:20 AM
Baron Baron is offline
Registered User
 
Join Date: Oct 2020
Posts: 7
Thank you so very much, bgagnon!

It works! I am happy.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 11:26 PM.