Sunday, December 06, 2009

check if Bookmark or Name is exists in Word/Excel application

I did not have tasks with export data from LN to word/excel/pdf for 1 years probably. My today's task was easy, I had to export data from LN to xml, processed it using xsl, walk through resulting xml and export everything to word/excel. Then I had to copy values from resulting xml to word/excel's temlpate using bookmarks (in excel it is names).

Here is an example how to check bookrmark/names in word/excel (because before I did not have experience with Excel's names)

excel approach I got from this link

Function NameExists(TheName
as String, obj, formType as String) As Boolean

NameExists = False

Select Case formType
Case "word":
if obj.activedocument.Bookmarks.Exists(TheName) Then
NameExists = true
End If
Case "excel"
On Error Resume Next
NameExists = Len(obj.names(TheName).Name) <> 0
End Select

End Function

Friday, December 04, 2009

I'm looking for testing tools for LN. Does anybody know couple?

I'm interested in test tools that can automate testing of LN application.
Just found new one that I've never seen before. What do you think about it? Does anybody has experience with this tool? If somebody could share some experience about it would be great.

here is link to their product, there is also flash demo there.
http://smart-toucan.com/

Please advice if somebody has good approach for testing in LN.

p.s.
that's is not an advertisement. I just want to find at least 1 tool that can help us to do automate testing for LN application.

How to emulate F9 key

Sometimes F9 makes good staff for us, so here is an example (I really don't remember where I got it).

'F9
Declare Function VkKeyScan Lib "User32.dll" Alias "VkKeyScanA" ( Byval char As Integer ) As Integer
Declare Function MapVirtualKey Lib "User32.dll" Alias "MapVirtualKeyA" ( Byval wCode As Long, Byval wMapType As Long ) As Long
Declare Sub keybd_event Lib "User32.dll" ( Byval Virtual As Integer, Byval OEMScan As Integer, Byval Flags As Long, Byval ExtrInfo As Long )
Const KE_KEYDOWN& = 0
Const KE_KEYUP& = 2 

Sub F9
  On Error Goto errorproc

  Dim vk As Long
  Dim sc As Integer

  vk = &H78

  sc = Cint( MapVirtualKey( vk&, 0 ) )

  Call keybd_event( Cint( vk& ), sc%, KE_KEYDOWN&, 0 )
  Yield
  Call keybd_event( Cint( vk& ), sc%, KE_KEYUP&, 0 )
  Yield

  endofsub:
    Exit Sub
  errorproc:
    Msgbox "Error #" & Err & " on line " & Erl & " in function " & Lsi_info(2) & " : " & Error, 48, "Runtime error"
  Resume endofsub 
End Sub

Thursday, December 03, 2009

Online JS validator

I have never used JS validator before (just because I did not think about it previously) . Today I decided to use one of them. I looked around and found JSLint. It is really good tools for validation of JS. I like it ! I recomend to use it to everybody, it gives very good results.

http://www.jslint.com/

Wednesday, December 02, 2009

Re-open document using @Formula

Need to update document using re-open approach?

here is easy way:
...
@Command([FileSave]);
@Command([SwitchForm]; currentForm)


I like this approach, especially because I've never thought about such way.