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 06-06-2014, 04:36 AM
HSA HSA is offline
Registered User
 
Join Date: Apr 2014
Posts: 21
Dymo printer SDK works with Secure crt?

Hi,

I wrote a script to print Dymo labels out of Secure crt, it works but I can only print 1 label, then I have to restart Secure crt before I can print anther label. Is it possible that the script uses some functions that won't work with Secure Crt?
Any help would be appreciated!

Code:
#$language = "VBScript"
#$interface = "1.0"
' 2014-06-02 by hsalen
' Prints dymo label

crt.Screen.Synchronous = False

Sub main
	Dim assetNr
	Dim partNr
	Dim IDymoAddIn
	Dim IDymoLabels

	Set IDymoAddIn = CreateObject ("DYMO.DymoAddIn")
	Set IDymoLabels = CreateObject ("DYMO.DymoLabels")

	IDymoAddIn.Open "C:\Users\hsa\Documents\DYMO Label\Labels\SecureCrt\Asset.label"
	assetNr = crt.Clipboard.Text
	crt.Screen.Sendkeys ("SHIFT+{F6}")
	crt.Sleep 500
	crt.Screen.Send assetNr & vbcr
	crt.Sleep 500
	partNr = crt.screen.get(4,16,4,45)
	crt.Sleep 500
	partNr = Trim (partNr)
	crt.Screen.Sendkeys ("{F3}")

	IDymoLabels.SetField "ASSET", assetNr
	IDymoLabels.SetField "PARTNR", partNr

	IDymoAddIn.StartPrintJob
	IDymoAddIn.Print 1, TRUE
	IDymoAddIn.EndPrintJob

	Set IDymoAddIn = nothing
	Set IDymoLabels = nothing
End Sub
Reply With Quote
  #2  
Old 06-06-2014, 08:40 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi HSA,

I have never used the Dymo printer SDK. We have not tested it with SecureCRT.

What version of SecureCRT are you using?

Are you able to use the SDK in a VBScript successfully outside of SecureCRT?

How are you running the script in SecureCRT?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 06-06-2014, 09:03 AM
HSA HSA is offline
Registered User
 
Join Date: Apr 2014
Posts: 21
Hi todd,

I'm running Secure Crt 7.2.5 since today, and didn't try to run it outside of secure crt. I just double click an asset nr to copy it to the clipboard and run it through a button to get the asset label printed.
Strange thing is that it works once and after I restart secure Crt it works again for 1 time ...
Reply With Quote
  #4  
Old 06-06-2014, 09:25 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi HSA,

That is confusing. Do you see the same issue if you run your script outside of SecureCRT? You will need to remove any SecureCRT specific code.

What happens if you run the script using the Script menu rather than a button?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #5  
Old 06-10-2014, 06:21 AM
HSA HSA is offline
Registered User
 
Join Date: Apr 2014
Posts: 21
Hi Todd,

I tried running the script in excel and it works fine. When I run it in secure crt with a button or from the menu it gives the same result, I can run it once and the second time, it runs the secure crt part but it doens't print anymore until I restart Secure Crt.

I'm also not very sure when to use crt.Screen.Synchronous = False or True, it's not very clear in the help pages. Do you have additional info on this?
Reply With Quote
  #6  
Old 06-10-2014, 12:58 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi HSA,

Thanks for the update. We are going to investigate the Dymo SDK/API issue. I will let you know what we find.

As to Synchronous, this is an interesting question, and one that is hard to explain. You may want to take a look at the scripting manual at the following location:
http://www.vandyke.com/support/tips/...essentials.pdf
An explanation attempt begins on page 39.

Basically, the Synchronous property allows you to prevent SecureCRT from processing data until WaitForString(), WaitForStrings() or ReadString() has a chance to check the data to see if the string that is expected appears in the data from the remote.

Does this help to explain?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #7  
Old 06-11-2014, 08:48 AM
HSA HSA is offline
Registered User
 
Join Date: Apr 2014
Posts: 21
Hi Todd,

Thanks for the Synchronous property explanation it's clear, sorry I didn't think of looking in the scripting manual.
I have been working on the script, see below, but I'm still only able to print one label and then I have to restart.

Code:
#$language = "VBScript"
#$interface = "1.0"
' 2014-06-02 by hsalen
' Prints dymo label

crt.Screen.Synchronous = False

Sub Main
	Dim tabTotal
	tabTotal = crt.GetTabCount
	If tabtotal = "1" then
		crt.Screen.SendSpecial "MENU_TAB_CLONE"
		crt.Screen.SendSpecial "MENU_TAB_PREV"
		printDymo()
	ElseIf tabTotal > "1" Then
		printDymo()
	End If
End Sub

Sub printDymo
	Dim totalTab
	Dim assetNr
	Dim partNr
	Dim IDymoAddin
	Dim IDymoLabels

	Set IDymoAddin = CreateObject ("DYMO.DymoAddIn")
	Set IDymoLabels = CreateObject ("DYMO.DymoLabels")

	totalTab = crt.GetTabCount
	Set activeTab = crt.GetActiveTab
	If activeTab.index = totalTab Then
		Set objTab = crt.GetTab(activeTab.index - 1)
	Else
		Set objTab = crt.GetTab(activeTab.index + 1)
	End If

	assetNr = crt.Clipboard.Text
	objTab.Screen.Sendkeys ("SHIFT+{F6}")
	crt.Sleep 500
	objTab.Screen.Send assetNr & vbcr
	crt.Sleep 500
	partNr = objTab.screen.get(4,16,4,45)
	crt.Sleep 500
	partNr = Trim (partNr)
	objTab.Screen.Sendkeys ("{F3}")

	IDymoAddIn.Open "C:\Users\hsa\Documents\DYMO Label\Labels\SecureCrt\Asset.label"
	IDymoLabels.SetField "ASSET", assetNr
	IDymoLabels.SetField "PARTNR", partNr
	IDymoAddin.StartPrintJob
	IDymoAddin.Print 1, TRUE
	IDymoAddin.EndPrintJob
	Set IDymoAddin = nothing
	Set IDymoLabels = nothing
End Sub
Reply With Quote
  #8  
Old 06-11-2014, 09:07 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi HSA,

I am glad to help. I will post here when we have more information about the Dymo SDK issue you are seeing, or if we need more information.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #9  
Old 06-17-2014, 04:51 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi HSA,

We need to obtain more information about this issue. Would you send an email to support@vandyke.com with a subject of Attn: Todd - Dymo label printing.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #10  
Old 06-18-2014, 02:36 AM
HSA HSA is offline
Registered User
 
Join Date: Apr 2014
Posts: 21
Hi Todd,

I had Dymo Label Software 8.5.1 installed and that seems to be the problem!
I donwgraded to the 8.3.1.14 beta I found on the dymo developers website and now it works. I'll contact Dymo so they can look what is wrong with their latest software.

Thanks anyway for the great support.

Hannes
Reply With Quote
  #11  
Old 06-18-2014, 08:44 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi HSA,

Thanks for the update. If you do need to contact us about this after speaking with Dymo, please send an email so we can get more information.

I am glad to help.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
Reply

Tags
dymo print secure script

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 01:34 PM.