osXMavericks - Applescript - Current Document

After upgrading, which was a mistake, several of my scripts are suffering some issues.

This is the first time I’ve gone through an upgrade with these scripts, and I’m not sure if its bad code or something else.

I’m using this line, which no longer seems recognized, or doesn’t work well.

set theDocument to current document

Is there any reason Mavericks would not recognize this?

Which application are you targeting? Try document 1, front document, etc.

Targeting illustrator. Still having issues with both document 1 and front document.

For example one of my scripts places an image, and it is placing it in a different document than the front document, or document 1 that I’ve just opened.

Confusing

I don’t use illustrator, but with other Document apps some form of this syntax helps:


set neededFile to (path to documents folder as text) & "Cathouse:Payroll:Payroll Master.txt"
set freshDocument to open file neededFile

or to make a new one:


set freshDocument to make new document with properties {name:documentName}

In either case, you now have a variable assigned to a specific document that you can use to get the target correct.