Get components (path and filename) of POSIX filepath

Just ask Finder he knows how to do it :)

tell application "Finder"
     set parentpath to POSIX path of (parent of (path to me) as string)
     set filename to name of (path to me)

     display dialog parentpath
     display dialog filename
 end tell

This should work:

-- This script returns the full path to the directory that this script is running in

-- get the full path to be split
set pathToMe to POSIX path of (path to me as text)

-- get the path to the directory
set script1 to "dirname '" & pathToMe & "'"
set dirPath to do shell script script1

-- get the file name
set script2 to "basename '" & pathToMe & "'"
set fileName to do shell script script2

-- display the results
display dialog "Directory Path: " & dirPath & return & return & "File Name: " & fileName