Using Keynote, I would like slide 6 to jump back to slide 2. I found applescript code in this post that works to direct jumps:
tell application "Keynote"
tell slideshow 1
show slide 2
end tell
end tell
I don't understand how to activate this from slide 6. Can I embed this in the #6 slide?
No AppleScript needed to jump to another slide.
In this case, a picture is more than a thousand words:
If you want to re-show some slide out of sequence at another point in your presentation, the simplest obvious way would be to just duplicate that slide and place the copy where you need it. But that, of course, will probably mess with your slide numbers.
Alternatively, you could use an AppleScript similar to the one you mention in the question to run your entire presentation. This simple solution, of course, would only make sense if the presentation were more something of a slideshow, with a fixed duration per slide and without the need of manually interacting / switching between the slides:
set duration to 10 -- number of seconds per slide
set slideSequence to {1, 2, 3, 4, 5, 6, 2, 7} -- re-show slide #2 between #6 and #7
tell application "Keynote" to tell slideshow 1
repeat with slideNumber in slideSequence
show slide slideNumber
delay duration
end repeat
end tell
Related
I'm nearing the end of finishing an application that uses Google Vision to identify articles of clothing, and automatically crop to the article in Photoshop.
The first script I have goes through all of the open images and grabs their dimensions and file paths. Those are then passed to my application to do the rest of the magic.
I ran into an issue where it just kept cropping the same image over and over again. After a bit of debugging I realized that this is due to the fact that it will only crop the image that is "active" in photoshop.
So, I'm faced with the task of needing to call another script that sets the next tab as the active document in PS before hitting the crop function.
I was hoping for something easy like:
tell application "Adobe Photoshop 2020"
set currentDocs to documents
set currentDoc to next item of currentDocs
end tell
Well, that doesn't work...
tell application "Adobe Photoshop 2020"
set currentDocs to documents
-- set myList to {}
repeat with n from 1 to count of currentDocs
set currentDoc to item (n + 1) of currentDocs
end repeat
end tell
This works, but errors after the last tab because it goes out of bounds. (not sure how to stop that?) And the fact that it's in a loop doesn't help either. I just need a simple script that sets the currentDoc to the NEXT open image. Then I Can crop, move to the next image, crop, etc.
But it also needs to know the last tab so it doesn't go back through the images.
Use the repeat with loopVariable (in list) syntax instead.
Then set current document in each turn of the loop.
For example, the following loops over all open documents and crops them to 100 x 100 pixels:
tell application "Adobe Photoshop 2020"
repeat with doc in documents as list
set current document to doc
crop doc bounds {0, 0, 100, 100}
end repeat
end tell
Using AppleScript, I want to alter the x and y position of a particular image on every slide of a Keynote document. Once Keynote is running and activated, the following code works...
tell the front document
set the current slide to slide 1
tell the current slide
set thisImage to image 1
set position of thisImage to {10,10}
end tell -- current slide
end tell -- front document
... but it's too fragile. If my image is not the first one ("image 1") then I'll be changing the position of the wrong object. I can't find anything in the scripting dictionaries or in on-line examples about expressing an object specifier for a particular image. I tried several variations on things like...
set thisImage to image with file name "my-file.png"
... to no avail. Any and all advice is appreciated. Thanks!
This works in Keynote 8.2, but to be honest, I'm not sure why.
set thisImage to image {name:"my-file.png"}
However, if you want to then ask thisImage what its name is, you have to ask for its file name, e.g.…
file name of thisImage
Every time I use any presentation software, I somehow like them all less.
You have some redundancy (around 'current slide') so here is my take:
tell slide 1 of the front document
set thisImage to image {name:"my-file.png"}
set position of thisImage to {10, 10}
end tell
Finally, since your objective is to cycle through every slide in the deck, you could try this:
tell front document
repeat with i from 1 to count of slides
tell slide i to set position of image {name:"my-file.png"} to {10, 10}
end repeat
end tell
Upon further review, the earlier answer doesn't work, or no longer works. Apparently the name specifier...
set thisImage to image {name:"my-file.png"}
... doesn't actually specify a name in that manner. Here is my ugly workaround:
tell the current slide
set imageCount to the count of images
repeat with i from 1 to imageCount
set thisImage to image i
if file name of thisImage = "myTargetFile.png" then
set position of thisImage to {10, 10}
exit repeat -- Ugly programming, look away.
end if
end repeat
end tell
I need a simple AppleScript that will cause PowerPoint to move to a specified slide number. I unfortunately am not familiar enough with AppleScript to properly interpret the information in the Applescript Library for PowerPoint. I think if someone can get me started I can take it from there.
The script just needs to reference the active presentation. If I could speak to my computer I just need to tell it to "go to slide #5" or "go to slide #2", etc.
The script needs to work while in Slideshow mode as the presentation will be running on a separate screen. Thanks so much for the help, I haven't been able to find this anywhere.
my gotoSlide(2)
on gotoSlide(whichSlide)
-- whichSlide is the integer position of the slide
tell application "Microsoft PowerPoint"
activate
tell active presentation
set theView to view of document window 1
go to slide theView number whichSlide
end tell
end tell
end gotoSlide
As the title says-
Is there a way to detect what slide is showing in a keynote presentation (using applescript)?
And yes, I am aware of how to change slides with applescript, I just need to detect what slide is already active.
SOLVED! >>> SEE BELOW
(Don't have enough reputation to answer my own question, so I'll just stick it here.)
I found a way round it thanks to this guy's script: http://code.google.com/p/keynotetweet/
For each slide in Keynote you get the option to attach invisible notes (not the yellow stickies, its a text box at the bottom of the page. Change the view to "Show Presenter Notes"). Here you can store a trigger string, ie "action". So create a keynote and put "action" in the notes of one slide. Start up the applescript then the slideshow, and when the slide with "action" in the notes is visible, the applescript will pick up it up and do whatever you set it to do.
repeat
tell application "Keynote"
set slideNotes to get notes of current slide of first slideshow
if text of slideNotes is equal to "action" then
say "Is this the slide you're looking for?"
end if
end tell
end repeat
Enjoy!
tell application "Keynote"
tell slideshow 1
get current slide
end tell
end tell
gives you
slide 3 of document "Untitled" of application "Keynote"
I want to run PowerPoint slide show for only a particular slide.
After my research, I tried following but I did not get expected result.
Both of the scripts, starts slide show but from the first slide.
1)
`tell application "Microsoft PowerPoint"
activate
open "/Users/sanjeev/pppp.ppt"
set slideShowSettings to slide show settings of active presentation
set starting slide of slideShowSettings to 4
set ending slide of slideShowSettings to 4
run slide show slideShowSettings
end tell`
2)
`tell application "Microsoft PowerPoint"
activate
open "/Users/sanjeev/pppp.ppt"
set slideShowSettings to slide show settings of active presentation
run slide show slideShowSettings
go to slide slide show view of slide show window 1 number 4
end tell`
The second script gives an error also:
error "Microsoft PowerPoint got an error: slide show view of slide show window 1 doesn’t understand the go to slide message." number -1708 from slide show view of slide show window 1
I saw a question Want Applescript to change a Keynote presentation to a particular slide
But I think that works only for KeyNote.
Can anyone help?
Thanks
This seems to work. It looks buggy to me. When the script is run the screen goes black, then flashes the slide then goes black then finally displays the slide. I don't know if this is due to the script or the implementation of Applescript/ppt from Microsoft. I say the latter.
tell application "Microsoft PowerPoint"
set temp to active presentation's slide show settings
set temp's starting slide to 2
set temp's ending slide to 2
set temp's range type to slide show range
set temp's advance mode to slide show advance manual advance
run slide show temp
end tell