Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sethdowd

macrumors newbie
Original poster
Jun 30, 2011
2
0
I have a script that takes user input (date) then performs a query of the moneyworks.app then takes the resulting info and exports it to a .txt file. I am trying to insert linebreaks in between the data fields instead of tabs. Here is my script.
Code:
set dd to display dialog "Enter the date for the payments" default answer short date string of ((current date))
set theDate to text returned of dd

set dd1 to (date (theDate)) + 1 * days
set dd2 to short date string of dd1
tell application "MoneyWorks Gold.app" -- CheckDate  BankAcct  Check#  VendorNameCode  Invoice#  $AmountPaid
	set res to «event BCIIEXPO» "payments#[lookup(cashtrans, `transaction.transdate`)]	[lookup(lookup(cashtrans, `transaction.contra`), `Account.bankAccountNumber`)]	[lookup(cashtrans, `transaction.ourref`)]	[lookup(invoiceid, `transaction.namecode`)]	[lookup(invoiceid, `transaction.theirref`)]  [amount]
" given «class USRC»:"[transaction:type = `CPC` and timeposted >= '" & theDate & "' and timeposted < '" & dd2 & "'][payments.cashtrans]"
end tell
-- set the clipboard to res

set filename to "MoneyWorks Export " & (word 1 of short date string of ((current date))) & "-" & (word 2 of short date string of ((current date))) & "-" & (word 3 of short date string of ((current date))) & ".txt"

set theFilePath to (path to desktop as string) & filename
set theFileReference to open for access theFilePath with write permission
write res to theFileReference
close access theFileReference
 
Last edited by a moderator:

sethdowd

macrumors newbie
Original poster
Jun 30, 2011
2
0
ok

As in...?

Code:
	set res to «event BCIIEXPO» "payments#[lookup(cashtrans, `transaction.transdate`)]  \n
	[lookup(lookup(cashtrans, `transaction.contra`), `Account.bankAccountNumber`)]	\n
 [lookup(cashtrans, `transaction.ourref`)] \n
[lookup(invoiceid, `transaction.namecode`)] \n
 [lookup(invoiceid, `transaction.theirref`)]  [amount]
 
Last edited by a moderator:

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
Just before the closing quotes.

i.e. something like: (look for the red \n).

Code:
set res to «event BCIIEXPO» "payments#[lookup(cashtrans, `transaction.transdate`)]	[lookup(lookup(cashtrans, `transaction.contra`), `Account.bankAccountNumber`)]	[lookup(cashtrans, `transaction.ourref`)]	[lookup(invoiceid, `transaction.namecode`)]	[lookup(invoiceid, `transaction.theirref`)]  [amount] [B][COLOR="Red"]\n[/COLOR][/B]" ...

You might be better off adding code after this line that just concatenates on a "\n" to the end of res.

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.