Batch Job: how to play a sound, and auto-close the confirmation window at end of sync?

Get help for specific problems
Posts: 4
Joined: 30 Apr 2020

cagross

Hello. I have real time sync to automatically carry out a sync whenever a file is changed. When the sync is complete, I would like a small sound to be played, and the confirmation window at end to be auto-closed. How can I do that?

In the 'Save as batch job' dialog box, there are two checkboxes:

* run minimized
* auto-close

I tried all four combinations of checking/unchecking those boxes, and none did what I want. The best I can get is for the sound to play, but the confirmation window to remain open (I have to click 'ok' to close it).

Do I have to instead play the sound by automatically executing a command line command after every sync?

Thanks in advance.
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

The "sync complete" sound only plays if the results dialog is shown. If you want to play a sound unconditionally you could come up with an appropriate command line and place it into the "on completion" box in FFS's sync settings.
Posts: 4
Joined: 30 Apr 2020

cagross

OK thanks for that. The 'on completion' box is here (screenshot: Image). But what kind of command do I need to enter into that box?

Let's say that I open a command prompt in Windows, and successfully run a command to play a short sound. Would I then enter that same command into the 'on completion' box?
User avatar
Posts: 2451
Joined: 22 Aug 2012

Plerry

See e.g. here.
For a simple bell sound try entering
powershell -c echo `a
for a wav.system sound try entering
powershell -c (New-Object Media.SoundPlayer "C:\Windows\Media\notify.wav").PlaySync();
In the latter case, make sure you specify the correct path and name of the sound file you want to play.
Posts: 4
Joined: 30 Apr 2020

cagross

Hi, thanks for your help, and so sorry for the delay. I gave your suggestion a try, but can't seem to get any sound to play upon completion. Here's what I did.

* As a test, open Windows PowerShell and execute the command you gave: powershell -c echo `a This did indeed play a system sound.

* In my .ffs_gui file, I edited my settings, and added this command to the 'Run a command' input field (screenshot: Image).

* I then made an edit to a file, and synced it, from with the FFS GUI (by clicking the green 'Synchronize' button). The sync completed, but no sound was played.

Thoughts? Did I misunderstand something? Are we sure that the 'Run a command' input field can accept a PowerShell command? That's all I can think of :-/
User avatar
Posts: 2451
Joined: 22 Aug 2012

Plerry

It seems the command handling in FFS has changed.
See here.
It may be that the FFS command is presently not using/aware of the default path definitions.
Try adding the full path to powershell.exe .
Posts: 4
Joined: 30 Apr 2020

cagross

>> Try adding the full path to powershell.exe .

I gave that a shot, and entered the following into the 'Upon completion' 'run a command' input field:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe echo `a

I then saved my .gui file, made an edit to a file in the source directory, clicked the 'Compare' button, then clicked the 'Synchronize' button. The synchronization occurred, but still no sound was played. Thoughts? Am I not allowed PowerShell commands here?

I tried both backslashes and forward slashes in the path, but to no avail.

As a test, I replaced my command with simply 'notepad' then carried out a sync. As expected, after the sync completed, the Notepad program was opened.
Posts: 3
Joined: 29 Nov 2021

MadBat

It's insane that this is how it has to be done. I'd expected a simple option to enable or disable the notification sound despite the auto-close being set.

However, for those that still need this like me, this is the correct command to run on completion:
powershell.exe -c "& {(New-Object Media.SoundPlayer 'C:\Program Files\FreeFileSync\Resources\gong.wav').PlaySync();}"

Replace the string between single quotes ' ' with the path to your wav file.