Create text file from AppleScript Results

Posted on 2010-01-05
Medium Priority
Last Modified: 2012-06-27
I am having a horrible time getting the results of an AppleScript to go anywhere with exception to the Results pane below in AppleScript Editor.  See the code below.  This will call the appropriate data from an application and dump a bunch of text in the Results area below...however, I actually want the results to either feed into MySQL database, Filemaker database or EVEN JUST A SIMPLE TEXT FILE ON THE DESKTOP.  It just won't do it.
set nametosearch to "(patientID LIKE '*')"

tell application "http://localhost:8100"
		set returndata to call xmlrpc {method name:"DBWindowFind", parameters:{request:nametosearch, table:"Study", execute:"Nothing"}}
		return returndata
	on error (errorname)
		return errorname
		tell application "TextEdit"
				make new document
				set text of document 1 to returndata as text
				save document 1 in "/Users/weklica/Desktop/LastUpdater.txt"
			end try
		end tell
	end try
end tell

Open in new window

Question by:weklica
  • 2

Author Comment

ID: 26187585
It basically runs the same with or wtihout the 'tell application 'TextEdit" .... material.  As if it isn't even in there after 'return errorname'..... No errors.  It runs all the same?!?!

Accepted Solution

weklica earned 0 total points
ID: 26187822
Nevermind.  Got it.

set nametosearch to "(patientID LIKE '*')"

tell application "http://localhost:8100"
      set returndata to call xmlrpc {method name:"DBWindowFind", parameters:{request:nametosearch, table:"Study", execute:"Nothing"}}
      set newFile to "/Users/weklica/desktop/testering.txt"
end tell
open for access newFile with write permission
set eof of newFile to 0
write returndata to newFile
close access newFile


Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question