How to know if power point was alreadylaunched using apple script?

A

arifali_007

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

Hi,
I want to convert PPTX to PPT, using apple script
following script works fine for me but I have two problems.

1. I want to know if power point was already launched, if yes
I do not want to close it.

2. How can I make power point invisible,even though I am saying
set visible to false, it's not working, I can see visually powerpoint is
launching , opening the presentation and then doing save as

--------------

to MakeHFSPath(aPath)
set thePosixPath to aPath as text
return (POSIX file thePosixPath) as string
end MakeHFSPath

tell application "Microsoft PowerPoint"
set alreadyLaunched to get visible
set PresentationName to MakeHFSPath("/Users/asaiyed/Desktop/Textures.pptx") of me
open PresentationName
set visible to false
set savePath to MakeHFSPath("/Users/asaiyed/Desktop/Presenta.ppt") of me
activate presentation PresentationName
save presentation PresentationName in savePath as save as presentation
if (not alreadyLaunched) then
quit saving no
else
set PresentationName to MakeHFSPath("/Users/asaiyed/Desktop/PPSX.ppsx") of me
open PresentationName
end if
end tell
 
W

William Smith [MVP]

1. I want to know if power point was already launched, if yes
I do not want to close it.

If you don't want to see it then how do you want to be told that
PowerPoint is already launched?
2. How can I make power point invisible,even though I am saying
set visible to false, it's not working, I can see visually powerpoint is
launching , opening the presentation and then doing save as

Whenever you use the "activate" verb then the application or file will
come to the front. This line is probably not necessary in your script.

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>
 
A

arifali_007

Hi bill,
thanks for your reply,

Solution to problem 1 :

my problem 1 is resolved using "running"
I can get the status.

like this

tell application "Microsoft PowerPoint"
if running
set wasAlreadyRunning to true
else
set wasAlreadyRunning to false
endif

// do what I want

if (not wasAlreadyRunning)
quit saving no
 
W

William Smith [MVP]

My problem 2 is still not resolved
even after removing the activate :(

I don't have the ability to test your script but you might want to put
in something like

display dialog "line 4"

between lines so that you can step through your script. This would at
least let you discover which action in the script is bringing the
application forward.

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top