Example: When recognition step is needed as a validity of a transaction, the system will send an SMS which usually it is a series of numbers that is usually called a PIN. PIN is what will be inputted as validation that the transaction is valid.
This time, I will explain how to send an SMS with Powerbuilder scripts. Impure all using Powerbuilder scripts, because there is a third-party library that will be used, namely m-Core SMS Component of Logix Mobile.
What you should prepare:
- Download the trial version of m-Core SMS Component of the official website Logix Mobile
- A GSM modem which supported by m-Core Component SMS. You can see it in the list http://logixmobile.com/Products/mcore/gsm_modem.asp If you do not have a GSM modem, you can use your GSM mobile phone, as long as the cell phone support AT-COMMAND. I myself use the Nokia E71 for this trial.
- An active GSM Sim card with SMS Send and Receive capability
- Powerbuilder version 6.5 and above
Noteworthy:
- m-Core SMS Component trial version has its limitations compared to the full version. One of the limitations is that there will be "ad" each time sending SMS. For a full comparison of features and price of each version, you can see it in http://logixmobile.com/Products/mcore/prices.asp
- You will get the license information if you buy the component. This license will be used inside the script to recognize that you are using the LITE or PRO version, not TRIAL version. At least, you will receive 3 variables of license information when you buy LITE or PRO version: Company, LicenseType and Key.
- GSM modem is usually connected via a cable to the PC / Server, either a serial or USB cable. You can also use a Bluetooth connection if you are using a GSM mobile phone
- Make sure the GSM Modem or GSM mobile phone you use, it is perfectly connected and get 1 COM Port recognition. You can see in Device Manager, which COM Port the modem is connected. You can also use the Query Modem in the Phone and Modem settings, to diagnose and to make sure that your modem is actually already recognized by your PC.
Using SendSMS function, we will try to send a SMS message.
1: OleObject objSMS
2: Integer i
3:
4: objSMS = CREATE OleObject // Create an Ole Object
5:
6: i = objSMS.ConnectToNewObject("mCore.SMS") // Connecting to mCore SMS Object
7:
8: // If you buy LITE / PRO version, put the 3 lines script below, otherwise remove if you are using TRIAL version
9: objSMS.License.Company = '' // company license information
10: objSMS.License.LicenseType = '' // license type
11: objSMS.License.Key = '' // key license information
12: // end of Licensing Information
13:
14: objSMS.Port = "COM3" // COM Port Number information that your GSM Modem is connected
15: objSMS.BaudRate = 115200
16: objSMS.Parity = "N"
17: objSMS.DataBits = 8
18: objSMS.StopBits = "1"
19:
20: // Trying to connect to GSM Modem
21: objSMS.connect()
22:
23: If objSMS.IsConnected() Then
24: // if connected, try to send a SMS
25: objSMS.SendSMS(<your destination number>, <your message, max 160 chars>, False) // 3rd parameter (FALSE) is setting OFF the flash message
26: messagebox('Status','SMS sent')
27: Else
28: // something wrong, displaying the error message
29: MessageBox(String(objSMS.ErrorCode),String(objSMS.ErrorDescription))
30: End If
31:
32: // Destroy the OLEObject for memory concern
33: DESTROY objSMS
Tak sedot gan ... tks
ReplyDelete