how to detect programmatically when a powerpoint slideshow starts - windows

I would like to write a windows program that would enable the user to choose a ppt file. When that ppt file starts the slideshow, my program would automatically display some message in front of the slideshow. When the slideshow is over, my program would close itself. What do I need to learn to write this program?

I'm not good with VBS (which I'm sure you could use for this) but if you set your show's extensions to .PPS instead of .PPT that will force them to start playing automatically on open. Then you won't need to see when the show starts because you'll control that.
As for opening it, if you write BATCH script you can use it to prompt for a file location but it will all be manually typed because it will load from the command window. If a show opens, the command screen can stay open until that slideshow closes, then continue with the next line of script.
Depending on if these are your powerpoints that you want opened, I personally would put VBA script in them to trigger On_Open and On_Close That will get you a clean customizable popup error message.
Edit
After doing some quick searching the On_Open and On_Close is not found in PPT, you would need to install an add-in.

Related

Copy all text from Command Window programatically

This article shows the well-known way to manually copy text from a Command window.
I'm looking for a way to do this programmatically. How could the cmd script that is running select all the text in its output window, and write it to a file?
I've found tools to do a screen capture into a file, but that may miss output if it has scrolled out of view? I'm looking for a way to capture an unattended cmd script's output (without modifying the whole script to redirect every line to a file).
Possibly this could be done with the windows API by finding the cmd window, sending CTRL-A and CTRL-C keycodes, and then write the clipboard text to a file. A possible approach for clip2txt is presented in this post.
Is there any other approach that should be considered?

How to access Print dialog's 'Open PDF in Preview' in os x programmatically

I am building a Delphi application which opens an image and its metadata and prints it. For the Windows version I build a form to generate the PrintPreview, but in Mac I can use the Print Dialog's 'Open PDF in Preview' instead. When I click on it, a PDF file is generated and I can see it, its OK. The problem is I want to access this option directly from a button, so when the button is clicked, the PDF in Preview is opened and the user does not have to open the Print Dialog, then click the 'PDF' and then select 'Open PDF in Preview'. How can I do this?
I read about using Automator, apple scripts etc, but I still can't find it.
Is there any path this generated PDF Preview is stored, so maybe I can open it from there?...
TIA
Possible duplicate of Using Automator or Applescript or both to recursively print documents to PDF but I'll answer anyways.
To answer your question directly see the question I linked to. Basically you need to use System Events from applescript to accomplish that exactly
However, there's a quicker solution using /usr/sbin/cupsfilter. Check the man page for more.
You can call cupsfilter <an-image-file> and you'll get a PDF on stdout, courtesy of OSX's printing daemon. It looks quite configurable but I just learned about it a while ago.
If you want this to open for the user you can save it in a nice place or you can do it the one-shot way and do cupsfilter <your-image> | open -f -a "Preview" to open the PDF right up.

I want to prevent a window from opening when an application launches

I have a program the opens a window, reads a config file, then closes the window a fraction of a second later, then continues running in background. I want to be able to start this program one way or another without the window appearing in the first place.
Is there a way for me to launch the program (preferably on PC startup) but suppress any windows it creates?
I do not have the source code for the program in question. In that regard I am an end-user.
use a vbs script to open it:
set obj = createobject("wscript.shell")
obj.run "prog.exe",0,false
call that prog.vbs or whatever, and put it in:
"%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\startup"

how to hide cmd from appearing at the back of your .vbs application?

I am new to building apps using simple .vbs coding, whenever I build a .exe file using visual basic script command prompt opens along with the application at the background. so how to hide the command prompt from appearing??
and also how to set a background image in a pop up or input box?
To your first question, it depends on how you are calling the vbs. Windows allow to execute tasks with hidden windows. If you can not create a hidden window and you doesn't need the console, instead of using cscript as the executable for the vbs, use wscript.
Popup and input box from vbscript are standard elements of the system. AFAIK no way of change background of them.

Windows SaveAs dlg with OFN_OVERWRITEPROMPT doesn't detect file deletions?

I'm using a perfectly usual SaveAs dialog (in Delphi Win32 XE2, the system is Win 7 /64), setting OFN_OVERWRITEPROMPT (or the Delphi wrapper's equivalent dlgSave.Options := [ofPathMustExist, ofOverwritePrompt];. So if I select an existing file, the dialog asks for confirmation to overwrite the file.
Everything works as it should except for one silly thing: when I choose a file, then delete that file right in the same dialog, then press OK, the dialog still asks if it's ok to overwrite the (already deleted) file. Apparently, the dialog checks file existence against a pre-loaded list, not the file system. The problem is not specific to Delphi and can be shown very easily even in Notepad:
Run Notepad.exe
Enter some text
Save as a file
Click File Save As again, in the SaveAs dialog do:
Click on the same file to select it,
Right-click and delete the file,
click OK.
The file is no longer there, but you still get the overwrite prompt.
Can anybody please suggest a way to work around this minor but annoying Windows bug? I assume some message processing / callbacks / hooks might be required? A way of checking the file presence in code while the modal SaveAs dialog is open?

Resources