 
f = askFile("Give me a file to open", "Go baby go!")

for line in file(f.absolutePath):  # note, cannot use open(), since that is in GhidraScript
    pieces = line.split()
    address = toAddr(long(pieces[1], 16))
    print "creating symbol", pieces[0], "at address", address
    createLabel(address, pieces[0], False)


from ghidra.program.model.symbol.SourceType import *
import string

functionManager = currentProgram.getFunctionManager()

f = askFile("Give me a file to open", "Go baby go!")

for line in file(f.absolutePath):  # note, cannot use open(), since that is in GhidraScript
    pieces = line.split()

    name = pieces[0]
    address = toAddr(long(pieces[1], 16))

    try:
        function_or_label = pieces[2]
    except IndexError:
        function_or_label = "l"

    
    if function_or_label == "f":
        func = functionManager.getFunctionAt(address)

        if func is not None:
            old_name = func.getName()
            func.setName(name, USER_DEFINED)
            print("Renamed function {} to {} at address {}".format(old_name, name, address))
        else:
            func = createFunction(address, name)
            print("Created function {} at address {}".format(name, address))

    else:
        print("Created label {} at address {}".format(name, address))
        createLabel(address, name, False)

Add optional 3 option to ImportSymbolScript.py to allow importing function names.
Add optional 3 option to ImportSymbolScript.py to allow importing
function names.

Add python script to import functions and labels

Use print() instead of print

Merge ImportSymbolsScript.py and ImportFunctionAndLabels.py

Made third token optional

-  
+ 
+ from ghidra.program.model.symbol.SourceType import *
+ import string
+ 
+ functionManager = currentProgram.getFunctionManager()
+ 
  f = askFile("Give me a file to open", "Go baby go!")
  
  for line in file(f.absolutePath):  # note, cannot use open(), since that is in GhidraScript
      pieces = line.split()
+ 
+     name = pieces[0]
      address = toAddr(long(pieces[1], 16))
-     print "creating symbol", pieces[0], "at address", address
-     createLabel(address, pieces[0], False)
  
+     try:
+         function_or_label = pieces[2]
+     except IndexError:
+         function_or_label = "l"
+ 
+     
+     if function_or_label == "f":
+         func = functionManager.getFunctionAt(address)
+ 
+         if func is not None:
+             old_name = func.getName()
+             func.setName(name, USER_DEFINED)
+             print("Renamed function {} to {} at address {}".format(old_name, name, address))
+         else:
+             func = createFunction(address, name)
+             print("Created function {} at address {}".format(name, address))
+ 
+     else:
+         print("Created label {} at address {}".format(name, address))
+         createLabel(address, name, False)
+ 
Add optional 3 option to ImportSymbolScript.py to allow importing function names.
## Code Before:
 
f = askFile("Give me a file to open", "Go baby go!")

for line in file(f.absolutePath):  # note, cannot use open(), since that is in GhidraScript
    pieces = line.split()
    address = toAddr(long(pieces[1], 16))
    print "creating symbol", pieces[0], "at address", address
    createLabel(address, pieces[0], False)

## Instruction:
Add optional 3 option to ImportSymbolScript.py to allow importing function names.
## Code After:

from ghidra.program.model.symbol.SourceType import *
import string

functionManager = currentProgram.getFunctionManager()

f = askFile("Give me a file to open", "Go baby go!")

for line in file(f.absolutePath):  # note, cannot use open(), since that is in GhidraScript
    pieces = line.split()

    name = pieces[0]
    address = toAddr(long(pieces[1], 16))

    try:
        function_or_label = pieces[2]
    except IndexError:
        function_or_label = "l"

    
    if function_or_label == "f":
        func = functionManager.getFunctionAt(address)

        if func is not None:
            old_name = func.getName()
            func.setName(name, USER_DEFINED)
            print("Renamed function {} to {} at address {}".format(old_name, name, address))
        else:
            func = createFunction(address, name)
            print("Created function {} at address {}".format(name, address))

    else:
        print("Created label {} at address {}".format(name, address))
        createLabel(address, name, False)
