set target_name to "my_target_name"
set my_tool_arguments to "<whatever you want>"
set my_module_directory to "<whatever path you want>"
tell application "Xcode"
set my_project to project of active project document
tell my_project
set make_target to target template "Other/External Target"
set my_target to make new target with data make_target with properties {name:target_name}
set active target to my_target
end tell
tell my_target
-- you can set text field directly and not to use build settings. I need it for some other reasons
set value of build setting "TOOL_ARGUMENTS" of every build configuration to my_tool_arguments
set value of build setting "MODULE_DIRECTORY" of every build configuration to my_module_directory
end tell
end tell
tell application "System Events"
tell process "Xcode"
tell menu bar 1
tell menu bar item "Project"
tell menu 1
-- Be sure to copy unicode quotes, it's important
set menu_name to "Edit Active Target “" & target_name & "”"
click menu item menu_name
end tell
end tell
end tell
set window_name to "Target: " & target_name
set check_box_name to "Pass build settings in environment"
set need_check_box to checkbox check_box_name of scroll area 2 of splitter group 1 of group 1 of group 1 of splitter group 1 of window window_name
set pass_setting to get value of need_check_box
-- I don't need to pass build settings
if pass_setting is equal to 1 then
click need_check_box
end if
set need_scroll_area to scroll area 2 of splitter group 1 of group 1 of group 1 of splitter group 1 of window window_name
set build_tool_field to text field 4 of need_scroll_area
set args_field to text field 3 of need_scroll_area
set directory_field to text field 2 of need_scroll_area
-- I need to use gmake tool
set value of build_tool_field to "gmake"
-- as I said earlier you can set text field directly and not to use build settings. I need it for some other reasons
set value of args_field to "$(TOOL_ARGUMENTS)"
set value of directory_field to "$(MODULE_DIRECTORY)"
end tell
end tell