Trying to find out if app.execMenuItem() was a success

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

26-11-2008

Hello,



I'm trying to build a save and close button and want the close to only work if the save was successful.



I'm hitting 2 problems:

-app.execMenuItem("Save") doesn't seem to work, I would liek it to but could use app.execMenuItem("SaveAs") as that does work

-I cannot find out if the save was successful, I can only get it to return "undefined". Does this mean it has no value, or that it just can't read what it is returning?



Many thanks,



Tom

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

26-11-2008

You cannot do an automatic save ....security is stopping you from doing so. You can do a SaveAs and you know it worked because the user sees a dialog.

Avatar

Avatar
Boost 5
Level 4
George_Johnson
Level 4

Likes

21 likes

Total Posts

234 posts

Correct reply

27 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 4
George_Johnson
Level 4

Likes

21 likes

Total Posts

234 posts

Correct reply

27 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
George_Johnson
Level 4

26-11-2008

You should use the doc.saveAs method instead, but there are security restrictions that you have to deal with. It will throw an error if unsuccessful. For closing, use the doc.closeDoc method.



George

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

27-11-2008

Ah, it will throw an error, so a "catch (e)" will work?



Tom

Avatar

Avatar
Boost 5
Level 4
George_Johnson
Level 4

Likes

21 likes

Total Posts

234 posts

Correct reply

27 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 4
George_Johnson
Level 4

Likes

21 likes

Total Posts

234 posts

Correct reply

27 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
George_Johnson
Level 4

27-11-2008

Yes.