10 June 2009,
 Off

A customer requested that we add driving directions to Platypus.  This can easily be accomplished using a Scripting Command which is already built into Platypus.  Below is the example.  Enjoy!

  • Go to Maintenance – Backend Utilities – Scripting Commands
  • Verify that the “Form Name” is set to “Customer Maintenance”
  • Press the New Button
  • Enter “Driving Directions” in the Button Caption
  • Verify that the Language is set to “VBScript”
  • Verify that the Main function is set to “main”
  • Verify that the “Visible” box is checked
  • Copy and paste the command below into the “Button script” Box (starting at “sub main”, ending at “end sub”)
  • Change the Address Type to the one you want to use (“billing”,”cell”,”credit card”,”home”,”shipping”,”work”)
  • Change the “Start_Address” to your starting location
  • Press the “Compile” button.  If errors are reported, then something was mistyped.  Delete the content and try again.
  • If “Compile” doesn’t give any errors, press “Apply” followed by “OK”.
  • The script should now be available for use on the general tab of the customer form.

sub main
Address_Type=”billing”
Start_Address=”800 Louisville St, Starkville, MS 39759″

For x = 1 To AddressType.ListCount
If Trim(LCase(AddressType.List(x,1))) = Trim(LCase(Address_Type)) Then
AddressType.ListItemId = x
AddressType.InteractiveChange()
End_Address=Address.txt_addr1.value
End_Address=End_Address+”,”+Address.txt_addr2.value
End_Address=End_Address+”,”+Address.txt_city.value
End_Address=End_Address+”,”+Address.txt_state.value
End_Address=End_Address+”,”+Address.txt_zip5.value
Exit For
End If
Next

lparm=”http://maps.yahoo.com/#q1=”+Escape(Start_Address)+”&q2=”+Escape(End_Address)

set WshShell = CreateObject(“WScript.Shell”)
wshShell.Run lparm
set WshShell=nothing

end sub

Comments are closed.