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: