Mixing Apple Script, Excel and a network
Mixing Apple Script, Excel and a network
- Subject: Mixing Apple Script, Excel and a network
- From: Courtney Moore <email@hidden>
- Date: Tue, 19 Aug 2003 09:08:05 -0500
------ Forwarded Message
From: Courtney Moore <email@hidden>
Date: Mon, 18 Aug 2003 13:20:11 -0500
To: David Wignall <email@hidden>
Subject: Re: Mixing Apple Script, Excel and a network
On 8/15/03 8:46 PM, "David Wignall" <email@hidden> wrote:
>
on 16/8/2003 10:06 AM, Courtney Moore at email@hidden
wrote:
>
>
> When using the syntax, mentioned below, to open a file in
>
> Microsoft Excel I have no problems when using my machine that is not
>
> authenticating. When I try the syntax on my networked machine I get the
>
> following error:
>
> "Microsoft Excel got an error: "pathToFile" doesn't understand the
OpenText
>
> message."
>
> Not quite sure what the deal it, does anyone have any ideas?!!
>
>
>
>
>
>
>
> Syntax:
>
> Tell application "Microsoft Excel"
>
> Activate
>
> OpenText "pathToFile" Orgin xlMacintosh StartAtRow 1
>
>
Here's the problem. pathtoFile is a string that doesn't mean anything to
the
>
script. It needs to be a string that represents a valid file path.
>
>
As Paul Berkowitz said in his reply to your Importing to Excel message:
>
>
set TextFileToImport to "Macintosh HD:Users:courtney:Desktop:AStest.txt"
>
>
Or as both Kai and I have mentioned you can use the choose file command in
>
the script to locate the file needed, assuming that level of interaction
was
>
within the scope of the project. However, if you run the one line script
>
'choose file' in your script editor of choice you should be able to copy
the
>
file path from the result window, or console window or what have you.
Sorry I was not more clear. I had put "pathtoFile" as a generic form of
what I really had put since I didn't think that my path would mean anything
to you. Sorry for the confusion. Thank you so much for your help. This is
one stubborn brick wall I have hit : )
When I run the script below I get the error 3Microsoft Excel got an error:
3Users:courtney:Desktop:spreadsheet.txt2 doesn9t understand the OpenText
message.2 I am assuming that this error has something to do with the path
and being on a networked computer (my home directory lives on another
computer). The reason I have come to this conclusion is because when I use
an non networked computer it runs smoothly! EEEEEKKKKKK. I have also tried
just 3Open2 instead of 3OpenText2 and I still get the same error. Another
odd thing is that if I record the procedure on my other computer it records
beautifully but when I record it on this computer it only records the
opening of Excel and any movements I make with the window. I am using OS
10.2.6 and according to System Profiler I am using Microsoft Excel 10.1.0.
I also did try replacing 3OpenText var....2 with 3OpenText (choose
file)....2 This did allow me to choose a file but then it gave me the error
3Microsoft Excel got an error: alias
3Users:courtney:Desktop:spreadsheet.txt2 doesn9t understand the OpenText
message. EEEKKK AGAIN!! : )
If you or anyone else has any insight that would be great. I have
underlined and put in bold the buggy part of the script. Thanks again!
On a happy note I did get the copy and paste part to work!! Thanks everyone
for your help with that!
tell application "FileMaker Pro"
set cellVal to cell "z_yearMonthSpreadsheet"
end tell
set the clipboard to cellVal
tell application "BBEdit"
activate
paste
save text window 1 to file "Users:courtney:Desktop:spreadsheet.txt"
quit
end tell
set var to "Users:courtney:Desktop:spreadsheet.txt"
tell application "Microsoft Excel"
Activate
OpenText var Origin xlMacintosh StartAtRow 1 DataType xlDelimited
TextQualifier xlDoubleQuote FieldInfo {{7.0, 1.0}, {2.0, 1.0}, {3.0, 1.0},
{4.0, 1.0}, {5.0, 1.0}, {6.0, 1.0}, {7.0, 1.0}} with CommaDelimiter without
TreatConsecutiveDelimitersAsOne, TabDelimiter, SemicolonDelimiter,
SpaceDelimiter and Other
Select Range "C5"
set NumberFormat of Selection to "0.000000"
Save ActiveWorkbook In "Users:courtney:Desktop:spreadsheetend.xls" As
xlExcel4 Password "" WriteReservedPassword "" without ReadOnlyRecommended
and CreateBackup
Close every Workbook
Quit
end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.