#1
|
|||
|
|||
Input Locking While Running?
Good day! I am wondering if there is a way to keep SecureCRT from accepting keystrokes or right clicks while it is running a script. We have sensitive processes running and if someone accidentally types something or right clicks (pasting the clipboard contents)... it can at best crash the script, at worst inadvertently cause unintended commands to execute. Thank you...
![]() |
#2
|
|||
|
|||
Hi mschaafs,
There is! Changes in SecureCRT 8.3 (Beta 1) -- September 21, 2017 ------------------------------------------------------- - Added the ability to script session locking from the Session object. Lock Description Locks the current session (or all sessions). Remarks All the parameters are optional. The default for prompt is false. If prompt is true, the Lock Session dialog will be displayed. The default for password is the empty string ("") and the default for lockallsessions is false. Syntax As an example you could use:object.Lock([,prompt [,password, [,lockallsessions]]]) Code:
crt.Session.Lock <your code> crt.Session.Unlock Does this give you the functionality you're looking for?
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 Last edited by ekoranyi; 12-18-2017 at 03:46 PM. |
#3
|
|||
|
|||
![]()
Hello! Thank you... that is fantastic. Do dialog boxes work while the Lock is in place? Such as crt.Dialog.MessageBox and crt.Dialog.Prompt?
|
#4
|
|||
|
|||
Hi mschaafs,
They sure do, I've included some example code to demonstrate this. Code:
# $language = "VBScript" # $interface = "1.0" crt.Session.Lock strInput = crt.Dialog.Prompt("Please enter some input", "Test Prompt", "") crt.Dialog.MessageBox strInput crt.Session.Unlock
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#5
|
|||
|
|||
![]()
I am getting a failure on this... in Javascript on version 8.3.1:
crt.Session.lock(); crt.Session.unlock(); "Microsoft JScript runtime error Error: Object doesn't support this property or method" Please help? Thank you. |
#6
|
|||
|
|||
Hi mschaafs,
This feature became available in SecureCRT 8.3 (Beta 1). What version of SecureCRT are you running (Help > About SecureCRT)?
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#7
|
|||
|
|||
As I mentioned... I am running Javascript on SecureCRT version 8.3.1 (x64 Build 1537)
|
#8
|
|||
|
|||
Hi mschaafs,
I apologize I missed the version. It's interesting, I created a .js file with the following: Code:
crt.Session.lock(); crt.Sleep(3000) crt.Session.unlock(); Can you provide the full script you are attempting to run and the full error message including the line the error is occurring on?
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#9
|
|||
|
|||
![]()
So, yeah, I created a small script and was able to make it work... however, when I copy that same line to my larger script, I get the error, no matter it's placement in the script. The only difference I can see between them is that the one with the error has a session being launched via Excel Macro:
Code:
nResult = objShell.Run( _ Chr(34) & securecrt_path & Chr(34) & " /SCRIPT " & script_init_path & _ " " & arguments & _ " " & protocol & " /PASSWORD " & strPassword & _ " " & strUsername & "@" & host, 5, True) |
#10
|
|||
|
|||
![]()
Apparently, when I ran the upgrade to 8.3.1, it didn't remove the 8.0.4 version... which is the one Excel is launching. Thank you very much for the help and for the new feature! It is a beautiful thing! Happy holidays and New Year!
|
#11
|
|||
|
|||
![]()
I was able to run it now... but I found that with it Locked and running, Crtl-C doesn't stop it, nor can I just close the session to do so. I was able to stop it via the Task Manager, but that is not elegant for an application. Is there a way to halt execution or create a way for a user to unlock the session in an emergency?
|
#12
|
|||
|
|||
Hi mschaafs,
I'm glad to hear you were able to get it up and running. The user can always right click on the sessions tab and choose Unlock Session. Does this allow you to use it in the way you would like?
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#13
|
|||
|
|||
Nice!
Boom! That is perfect. Thanks again!
|
#14
|
|||
|
|||
mschaafs,
I'm glad to have been able to help. Have a great rest of the day.
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
![]() |
Tags |
error , input locking , javascript , scripting , stop script |
Thread Tools | |
Display Modes | Rate This Thread |
|
|