Dear fellow AppleScript programmers,
I have an iOS app that has recipes. Each recipe can be organized by course or by cuisine. Each course and cuisine have their own table view and controller. I need to make sure each recipe is linked to a course and cuisine. Since a storyboard is really an XML file containing all the UI elements, I figured I could create an AppleScript that searches all the table view cells to make sure that all recipes are linked to two table view cells.
Here is my code:
When I try to run this code, I get the error "Can't get every element of {} whose name = "subviews"". I just don't get why the fourth line of code results in tableViewCells being set to nothing useful. The tag names are correct.
I could do the job myself, but I just don't want to.
I have an iOS app that has recipes. Each recipe can be organized by course or by cuisine. Each course and cuisine have their own table view and controller. I need to make sure each recipe is linked to a course and cuisine. Since a storyboard is really an XML file containing all the UI elements, I figured I could create an AppleScript that searches all the table view cells to make sure that all recipes are linked to two table view cells.
Here is my code:
Code:
set the_file to ((choose file without invisibles) as string)
tell application "System Events"
set xml_data to contents of XML file the_file
tell xml_data to set tableViewCells to every XML element of xml_data whose name is "tableViewCell"
tell xml_data to set subViews to every XML element of tableViewCells whose name is "subviews"
tell xml_data to set viewLinks to every XML element of subViews whose name is "view"
tell xml_data to set viewControllers to every XML element whose name is "viewController"
tell xml_data to set views to every XML element of viewControllers whose name is "view"
tell xml_data to set navItems to first XML element of views whose name is "navigationItem"
tell xml_data to set recipes to value of XML attribute "title" of XML element navItems
end tell
When I try to run this code, I get the error "Can't get every element of {} whose name = "subviews"". I just don't get why the fourth line of code results in tableViewCells being set to nothing useful. The tag names are correct.
I could do the job myself, but I just don't want to.