newbie question...
newbie question...
- Subject: newbie question...
- From: Warwick Hall <email@hidden>
- Date: Fri, 4 Jun 2010 08:20:57 +1000
Hello,
I want to create a applescript which calls an applescript command in a third party application library (MYOB FirstEdge v4). The script is top secret so here it is...
on run argv
-- Set myob_company_file
set myob_company_file to alias "Macintosh HD:Path:to:Company:File.myo"
-- Set myob_data_file
set myob_data_file to (item 1 of argv) as POSIX file
set myob_data_file to myob_data_file as alias
-- set myob_import_type
set myob_import_type to (item 2 of argv)
-- Set myob_companyfile_password
try
set myob_companyfile_password to (item 3 of argv) as text
on error
set myob_companyfile_password to "" as text
end try
-- do the import!...
tell application "FirstEdge" -- meaning MYOB FirstEdge v4
-- Run tell application
activate
open myob_company_file password myob_companyfile_password with verify file
(* PROBLEM LINE *) import cards of type myob_import_type from myob_data_file password myob_companyfile_password separated by tabs first record is header duplicates are update existing record identify by card id with automatch
quit
end tell
end run
I run the script from a shell script (/bin/sh) or terminal using osascript command like utility:
% osascript <path to above script> <path to csv data file> customer 'foobarblaz'
All well and good, except it does not work. here is the library definition of the import cards command:
import cards v : Import card data into MYOB
import cards
of type customer/supplier/employee/personal : type of card to import
from alias : file to import from
password text : password for datafile
[separated by tabs/commas] : default is tabs
[first record is header/data] : default is header
[duplicates are reject them/update existing record/add them] : default is reject them
[identify by card name/card id/record id] : default is card id
[automatch false/true] : default is false; only used when first record is header
→ list of list : list containing records imported without errors, skipped and imported with warnings
Now in my script on the (* PROBLEM LINE *) if I put 'customer' or 'supplier' where 'myob_import_type' is, it works like a charm. BUT I WANT TO PASS A COMMAND LINE ARGUMENT INTO IT!!! WHY WON"T IT LET ME??? _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden