Thursday, May 23, 2013

Read the XML in Lotus Notes

Really very hard to understand the structure of the Notes XML parsing classes. Still I need to understand more. Actually I tried to read the xml file for some requirement.

Initially I thought it is an easy job but after an half of the day had gone, I realized it is difficult one.

If someone has nice trick please share to me...

    Dim session As New NotesSession
    Dim domparser As NotesDOMParser
    Dim domdoc As NotesDOMDocumentNode
    Dim domlist As NotesDOMNodeList
    Dim domlist1 As NotesDOMNodeList
    Dim domele As NotesDOMElementNode
    Dim stream As NotesStream
    Dim node As NotesDOMNode
    Dim node1 As NotesDOMNode
    Dim x As String   
    x= "D:\javap\Test.xml"
    Set stream = session.CreateStream()
    Set domParser = session.CreateDOMParser(stream)
    Set domdoc = domparser.Document
    Set domele = domparser.Document.DocumentElement
    Set domlist = domele.GetElementsByTagName("TagName")
    Set node =  domlist.GetItem(1)
    Msgbox node.FirstChild.NodeValue

Monday, May 20, 2013

Windows Run Command

For lazy users like me, sometime our job will be get bored because we need to do the same job for as many time. Also we need to interact with the windows frequently. Probably we can create macro or agent for doing the particular job for as many times. However we can not do this for all cases. The below are the interesting stuff. These are the Run Commands in windows. I hope this will be very useful. I found this in the following site...

To Access…Run Command
Accessibility Controls access.cpl
Accessibility Wizardaccwiz
Add Hardware Wizardhdwwiz.cpl
Add/Remove Programs appwiz.cpl
Administrative Toolscontrol admintools
Adobe Acrobat (if installed)acrobat
Adobe Designer (if installed)formdesigner
Adobe Distiller (if installed)acrodist
Adobe ImageReady (if installed)imageready
Adobe Photoshop (if installed)photoshop
Automatic Updateswuaucpl.cpl
Bluetooth Transfer Wizardfsquirt
Certificate Managercertmgr.msc
Character Mapcharmap
Check Disk Utilitychkdsk
Clipboard Viewerclipbrd
Command Promptcmd
Component Servicesdcomcnfg
Computer Managementcompmgmt.msc
Control Panelcontrol
Date and Time Properties timedate.cpl
DDE Shares ddeshare
Device Managerdevmgmt.msc
Direct X Control Panel (if installed)*directx.cpl
Direct X Troubleshooterdxdiag
Disk Cleanup Utilitycleanmgr
Disk Defragmentdfrg.msc
Disk Managementdiskmgmt.msc
Disk Partition Managerdiskpart
Display Propertiescontrol desktop
Display Propertiesdesk.cpl
Display Properties (w/Appearance Tab Preselected)control color
Dr. Watson System Troubleshooting Utilitydrwtsn32
Driver Verifier Utilityverifier
Event Viewereventvwr.msc
Files and Settings Transfer Toolmigwiz
File Signature Verification Toolsigverif
Firefox (if installed) firefox
Folders Propertiesfolders
Fontscontrol fonts
Fonts Folderfonts
Free Cell Card Gamefreecell
Game Controllers joy.cpl
Group Policy Editor (XP Prof)gpedit.msc
Hearts Card Gamemshearts
Help and Supporthelpctr
Iexpress Wizardiexpress
Indexing Serviceciadv.msc
Internet Connection Wizardicwconn1
Internet Exploreriexplore
Internet Properties inetcpl.cpl
Internet Setup Wizardinetwiz
IP Configuration (Display Connection Configuration)ipconfig /all
IP Configuration (Display DNS Cache Contents)ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents)ipconfig /flushdns
IP Configuration (Release All Connections)ipconfig /release
IP Configuration (Renew All Connections)ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS)ipconfig /registerdns
IP Configuration (Display DHCP Class ID)ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID)ipconfig /setclassid
Java Control Panel (if installed)jpicpl32.cpl
Java Control Panel (if installed)javaws
Keyboard Propertiescontrol keyboard
Local Security Settingssecpol.msc
Local Users and Groupslusrmgr.msc
Logs You Out Of Windows logoff
Malicious Software Removal Tool mrt
Microsoft Access (if installed)msaccess
Microsoft Chatwinchat
Microsoft Excel (if installed)excel
Microsoft Frontpage (if installed)frontpg
Microsoft Movie Makermoviemk
Microsoft Paintmspaint
Microsoft Powerpoint (if installed)powerpnt
Microsoft Word (if installed)winword
Microsoft Syncronization Toolmobsync
Minesweeper Gamewinmine
Mouse Propertiescontrol mouse
Mouse Propertiesmain.cpl
Nero (if installed)nero
Netmeeting conf
Network Connectionscontrol netconnections
Network Connectionsncpa.cpl
Network Setup Wizardnetsetup.cpl
Nview Desktop Manager (if installed)nvtuicpl.cpl
Object Packagerpackager
ODBC Data Source Administratorodbccp32.cpl
On Screen Keyboardosk
Opens AC3 Filter (if installed)ac3filter.cpl
Outlook Expressmsimn
Password Propertiespassword.cpl
Performance Monitorperfmon.msc
Performance Monitorperfmon
Phone and Modem Options telephon.cpl
Phone Dialerdialer
Pinball Gamepinball
Power Configuration powercfg.cpl
Printers and Faxescontrol printers
Printers Folderprinters
Private Character Editoreudcedit
Quicktime (If Installed)QuickTime.cpl
Quicktime Player (if installed)quicktimeplayer
Real Player (if installed)realplay
Regional Settings intl.cpl
Registry Editorregedit
Registry Editorregedit32
Remote Access Phonebookrasphone
Remote Desktop mstsc
Removable Storagentmsmgr.msc
Removable Storage Operator Requestsntmsoprq.msc
Resultant Set of Policy (XP Prof)rsop.msc
Scanners and Camerassticpl.cpl
Scheduled Taskscontrol schedtasks
Security Center wscui.cpl
Shared Foldersfsmgmt.msc
Shuts Down Windowsshutdown
Sounds and Audio mmsys.cpl
Spider Solitare Card Gamespider
SQL Client Configuration cliconfg
System Configuration Editorsysedit
System Configuration Utilitymsconfig
System File Checker Utility (Scan Immediately)sfc /scannow
System File Checker Utility (Scan Once At The Next Boot)sfc /scanonce
System File Checker Utility (Scan On Every Boot)sfc /scanboot
System File Checker Utility (Return Scan Setting To Default)sfc /revert
System File Checker Utility (Purge File Cache)sfc /purgecache
System File Checker Utility (Sets Cache Size to size x)sfc /cachesize=x
System Informationmsinfo32
System Properties sysdm.cpl
Task Managertaskmgr
TCP Testertcptest
Telnet Clienttelnet
Tweak UI (if installed)tweakui
User Account Managementnusrmgr.cpl
Utility Managerutilman
Windows Address Bookwab
Windows Address Book Import Utilitywabmig
Windows Backup Utility (if installed)ntbackup
Windows Explorerexplorer
Windows Firewallfirewall.cpl
Windows Magnifier magnify
Windows Management Infrastructurewmimgmt.msc
Windows Media Playerwmplayer
Windows Messengermsmsgs
Windows Picture Import Wizard (need camera connected)wiaacmgr
Windows System Security Toolsyskey
Windows Update Launcheswupdmgr
Windows Version (to show which version of windows)winver
Windows XP Tour Wizardtourstart
Wordpad write

Wednesday, February 27, 2013

How do we find the size of a rich text field in Lotus Notes?

I am facing an issue, Its peculiar but still IBM is not fixed this issue,

My database is very old. It is created on 1998. Now my database's version is 6.5.1. So my case everything has its own limit. After a long time, I seen like my db usage is 98% after the completion of compacting. So whenever my document exceeds 32K it can be old or new, the document became spam. Like we can not access the document. We can not open the document. We can not see the property of the document. I had some agents that will take all the documents one by one. Because of this issue, the agent stopped and thrown the error like "field is too large 32k or view's column & selection formulas are too large". I could not find the reason why it is happening.

eg:- If my already existing document has more than 32k of size. I have gone and edited the document. And saved it. The document size exceeds 32k, and it became spam what I mentioned above. If my new document exceeds 32k, I attained the same issue.

I was confused. I tried the following steps.

1. I changed the Text to Summary for all items. Nothing happened.
2. As of Notes constraints, document can have any number of size less than 64GB(about db size). But less than 6 It has some limitation. I guess. Sorry if it is wrong. Number of field should not exceed 3000. So I checked the document size. And tried to reduce that. I deleted contents of the fields and made the document to less than 64K. Same problem came.
3. I created a lot of field. The form had thousands of field. So I removed many field. I counted as a child and made it to 1000 exactly including reserve fields. Like $Revisions.  -  32K error. :(
4. I know that the limitation of RTF(Rich Text Field)  is 1gb. So I ignored.
5. I found the $UpdatedBy field is exceeding 32K of size. So I limited the number of entries for this.

Finally, I found that the issue from Rich text field. I deleted the attachments and reduced the document size less than 32k. and saved it. I got satisfied.

So I planned to restrict the document size to the user. I want to avoid the 32K error in future documents. Better I can stop the attachment size should not exceeds 15k. So I want to fetch the size of the RTF. I found the better solution for that. t refers NotesRichTextItem.

        Set t = doc.GetFirstItem("body")
Dim newdoc As NotesDocument
Set newdoc = db.CreateDocument()
Call t.Copyitemtodocument(newdoc, "reasonType")
Msgbox newdoc.Size

Also I can count the current document size. One funny thing is, our Notes rich text field contents like copy and pate images not an attachments can not be taken without saving the document.

Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim t As Variant
Call uidoc.FieldSetText("SaveOptions","0")
Call uidoc.Save()
Set db = session.CurrentDatabase
Set doc = uidoc.Document
        msgbox doc.size

But my question to IBM, Why the hell this much big issue can not be solved?

Once the 32K error document has been created then we have to delete the replica copy and take a new replica copy from the source server. This is the only solution for deleting the 32K error documents. You can not delete these document manually.

Thursday, January 10, 2013

Get Image from Excel- VB Script

I was trying to get the picture from excel and trying to save it in my local HD. But unfortunately I did not aware of some Excel Sheet methods. I googled. Whatever I tried finally I can put the picture into excel. But I did not find the way to take the picture. So  I copied and pasted the 100's of images from my Excel sheet.

After a day later, I have fresh mind. I tried to find a easy way. Finally I got the easiest way. I found the function.

Lotus Script:-

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlwb=xlApp.Workbooks.Open("File Path")
Set xlsheet =xlwb.Worksheets(1)   Call xlSheet.Shapes(0).copy()
    VB Script :-

appExcel = New Excel.Application
xlsBook = appExcel.Workbooks.Open("File Path")
xlsSheet = xlsBook.Worksheets("Sheet1")
Call xlSheet.Shapes(0).copy()
You can get all the images by using for all or far each condition.