Rightfax COM API using VBScript

30 Jun

This is something that you hardly can find on the internet nor off the rightfax vendor site. The main reason is that most of the programming is done by programmers using C or VB.Net or some programming framework. But as an administrator of RightFax servers, sometimes its good that I can fire up vbscripts to automate some reporting on my end.

Okay, firstly you need to copy these four files into your script folder from \Program Files\Rightfax\Share Files\


The open your editor and type the following and test run it with your admin account

Set f = CreateObject(“RFCOMAPI.FaxServer”)

‘f.servername = “RIGHTFAXSERVER”

‘use this if account is integrated
‘f.UseNTAuthentication = True

f.AuthorizationUserID = “YOUR ACCOUNT”
f.AuthorizationUserPassword = “YOUR PASSWORD”

‘Don’t really need to set protocol, just a sample
f.Protocol = 4 ‘4 = tcp, 1 = name pipes
wscript.echo f.users.count

Set f = CreateObject(“RFCOMAPI.FaxServer”)
f.servername = “RIGHTFAX”
‘f.UseNTAuthentication = True
f.AuthorizationUserID = “ADMIN”
f.AuthorizationUserPassword = “xxxxx”

wscript.echo f.serverinfo.IsEnterprise

‘To send a fax and attach a file

Set oNewFax = f.CreateObject(5)

oNewFax.ToFaxNumber = “00165123456”
oNewFax.ToName = “Kelvin Wong”
oNewFax.HasCoversheet = True
oNewFax.Attachments.Add “c:\temp\myfile.txt”


I still have not figured out how to get FaxStatus property to work properly. I tried to echo “oNewFax.FaxStatus”, but got an error that the property or method is not support. I think it is obvious since the data type is an enumerated value and vb does not support enumerated datatype. The only way is to get someone to create a wrapper in VB or C or C++ to translate it to a VBScript supported datatype.


Posted by on June 30, 2010 in VBScripts, Windows


Tags: ,

13 responses to “Rightfax COM API using VBScript

  1. Jignesh Patel

    November 10, 2010 at 4:35 pm

    Hello, I am trying to read fax image file for a user’s incoming fax using COM API in C#. I see the faxes listed for a perticular user, and see all properties related to fax and attachments for fax, but how do I extract or view the TIFF image for that fax? I see the Fax.Attachments[1].FileName property set to full path to the image file, but that path does not exist anywhere on my development machine.

    Any help will be appreciated.


    • saltwetfish

      November 10, 2010 at 4:57 pm

      hmm… I am not really a developer, but can you tell me what does the filename property returns for you? I know its the full path, but what is the value and where is your image folder?

  2. Jignesh Patel

    November 10, 2010 at 6:08 pm

    The values are as below…

    Fax.FaxFilename = “AB001567”

    Fax.Attachments[1].FileName = C:\DOCUME~1\jpatel\LOCALS~1\Temp\~FX1516.TIF

    I am trying to run this from development box, not on the RightFax server. When I try to look for the above mentioned file on my local machine (C:\DOCUME~1\jpatel\LOCALS~1\Temp\~FX1516.TIF), there is no such file in the specified folder (there is in fact no .tif file there).

    • saltwetfish

      November 12, 2010 at 4:01 am

      hm… have you tried running this off the actual fax server and see what the values are? Also are you sure that you are not invoke a “new” attachment rather than trying to read the attachment off a existing fax object?

  3. Information On Email Fax

    February 12, 2011 at 4:36 pm

    Thanks for sharing your VBScript. We also sharing our website, Fax machine or online fax? This question is raised frequently in today’s business environment.Fax is an important part of business technology.The ability to instantly transmit an accepted legal copy of a document from one person to another is an expected capability for any business.The time-stamp and logging trail are important proofs when establishing the legitimacy of a transmitted document.Click here for details: | Emailing To Fax |

  4. andreabezuidenhout

    July 25, 2013 at 1:09 am

    Hi, thank you so much for this, it was very helpful. I have another problem, my sheet prints out very small, it looks like I’m setting the print area incorrectly. This is what I’m using now:
    WKS.PageSetup.PrintArea = WKS.Range(WKS.Cells(1, 1), lastCell).Address
    Lastcell being a variable I use to get the last cell of the area. It does grab the area I want to print when I manually check the file, but when it faxes it, it comes out really small on the other side. Also, how do I set it to print on one page?
    Thank you so much

    • Kelvin Wong

      July 25, 2013 at 2:29 pm

      So i think you have tried this manually already? I mean have to done this from Excel manually via File | Print (to RightFax printer)? Was it also very small? You need to try all these manually via Excel first, once it works, then figure out what functions to use.. lol

  5. Victor Ng

    June 4, 2015 at 11:13 pm

    Hi, thanks for your code. It works fine for .txt file. However, when I tried it for .docx (Word document), it faxes out funny characters. Have you ever tried faxing out .docx document? Is there any special specification required in the code? Thanks.

    • Kelvin Wong

      June 5, 2015 at 1:19 am

      For Microsoft or Office documents, you must have Office installed on the fax server so that it can translate the docx format correct. The fax server will receive the attachment, look at its extension and convert it into fax print format. Without Office or MS Word install, the fax server cannot convert the docs

  6. LienVu

    May 25, 2017 at 5:20 pm

    Hello, I want to download “rfcomapi.dll”! Can you help me?

    • Kelvin Wong

      May 25, 2017 at 7:38 pm

      Hi LienVu,

      This should be found in your RightFax installation, if the latest version still uses this DLL.

  7. Guru Raj

    August 27, 2020 at 1:05 am

    Hi.. Do you have any scripts for automating Rightfax admin tasks like user creation, user deletion, delegates, etc…..

    • Kelvin Wong

      August 27, 2020 at 10:53 am

      Unfortunately that was in my previous role and I no longer work on rightfax.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: