Task Scheduler no longer talks to Audacity

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Emerogork
Posts: 315
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

Task Scheduler no longer talks to Audacity

Post by Emerogork » Wed Oct 15, 2014 8:10 pm

I use Windows Task Scheduler to start and stop recording activity in Audacity. This has been running quite well for over two years now. I have other operations scheduled also.

I noted that my Windows/Temp folder contained 500M and 2500 files. Taking caution before I clean out the folder, I copied the files to a new one and left the empty folder as is. Now I find that the Task Scheduler no longer talks to Audacity. I copied all of the files back to the Windows/Temp folder and still no talk. Other non-Audacity scheduled operations continue work.

I cleaned out the Windows/Temp folder and uninstalled Audacity. I reinstalled it and noted that no temp files or folders were created in Windows/Temp folder.

My conclusion is that Audacity had nothing to do with the Windows/Temp Folder but the breakdown between the Task Scheduler and Audacity happened when I messed with the temp files.

Has anyone seen this? Might anyone have any suggestions?
I hear that cleaning out the temp folder is not all that uncommon.

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Task Scheduler no longer talks to Audacity

Post by steve » Wed Oct 15, 2014 11:46 pm

Emerogork wrote:I use Windows Task Scheduler to start and stop recording activity in Audacity.
How did you do that? What commands are you using?
Are you using a modified version of Audacity?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Emerogork
Posts: 315
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Emerogork » Thu Oct 16, 2014 1:49 am

Someone showed me how to do this years ago and maybe it was someone here in Audacity.
The name Edgar5 shows up in the scripts.

In short, I have scripts that are activated by the Task Scheduler.

The scripts initialize Audacity, turn on NPR programs at their airing times, instruct Audacity to record and an hour later another to stop recording. With the stop, the script sends a command to mute all tracks and reset the timeline to record the next program in a new track.

Up until lately, this would initialize Audacity but it stopped working.
Create this file in Notepad then call it from the Task Manager.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=getStJI.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author: edgar5

Script Function: open Audacity, start recording

#ce ----------------------------------------------------------------------------

; Script Start
Run ("C:Program Files (x86)Audacityaudacity.exe")
WinWaitActive("Audacity")


=======================
I now see that maybe this comment was better served in AutoIt forum. I will have to look for it again.
I will help you is you have any problems.

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Edgar » Thu Oct 16, 2014 4:56 am

Emerogork wrote:Someone showed me how to do this years ago and maybe it was someone here in Audacity.
The name Edgar5 shows up in the scripts.
There's a good chance that's my script. It's quite funny actually, last week my hard drive filled up and I did something quite similar deleting lots of things which I did not recognize – some of my AutoIt3 scripts also started to fail. Fortunately, I had backups for the ones I was relying on. Unfortunately, I do not have a copy of this script. If you have the actual script (code, It will end in .au3) and not just an executable (it would end in .exe) post it here and I will take a look at it. No promises though, it's been years since I've done any scripting with AutoIt3.

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Edgar » Thu Oct 16, 2014 5:11 am

This is the original thread in which we develop the scripts:
http://forum.audacityteam.org/viewtopic ... 38#p168238
As you can see, you started with my offering and tailored it specifically to your machine and needs but never posted the final resulting script. Please post your script here.

Emerogork
Posts: 315
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Emerogork » Thu Oct 16, 2014 5:17 am

Actually, there isn't much more to that script other than comments that show how to construct the commands for record, stop, pause, etc. All this one need to do is open Audacity and have it ready to receive a command to record. I doubt that there is anything wrong with the script as it was working last weekend.

I need a command to see if the script is actually being called.
Is there some alert that I can use to write something to the screen as a test?

Here is the entire script to get Audacity started:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=getStJI.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author: edgar5

Script Function: open Audacity, start recording


#ce ----------------------------------------------------------------------------

; Script Start
; This next line works if entered at the command prompt (Emerogork)
Run ("C:Program Files (x86)Audacityaudacity.exe")
;Run("D:audioAudacitySVNwinUnicode ReleaseAudacity.exe")
WinWaitActive("Audacity")
; WinMenuSelectItem("", "", "Transport", "Record")
;since I have not learned about menu item selection I will use keyboard shortcuts
;I set Record as <ALT + CTRL + SHIFT + R>
;and Stop as <ALT + CTRL + SHIFT + S>
; Send("!^+rr")
; note the exclamation point (!) means ALT, the carat (^) means CTRL and the plus sign (+) means SHIFT

Emerogork
Posts: 315
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Emerogork » Thu Oct 16, 2014 5:31 am

That was the au3 file. Will the XML file help? I guess it is the file generated by the Task Scheduler.
Since I do not see an option to attach a file, here it is:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2012-07-13T01:20:26.4447659</Date>
<Author>MarySteve</Author>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2012-07-13T05:01:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByWeek>
<DaysOfWeek>
<Monday />
<Tuesday />
<Wednesday />
<Thursday />
<Friday />
</DaysOfWeek>
<WeeksInterval>1</WeeksInterval>
</ScheduleByWeek>
</CalendarTrigger>
<CalendarTrigger>
<StartBoundary>2012-07-15T22:58:01</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByWeek>
<DaysOfWeek>
<Sunday />
</DaysOfWeek>
<WeeksInterval>1</WeeksInterval>
</ScheduleByWeek>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>MarySteve</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>"C:Gork__Scheduled Event ScriptsInitializeAudacityB.au3"</Command>
</Exec>
</Actions>
</Task>


When I enter the 4th to the last line using a command prompt, it is reported that: "Audacity did not recognize the file 'C:Gork__Scheduled Event Scripts]InitializeAudacityB.au3" However, Audacity does load.

Emerogork
Posts: 315
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Emerogork » Thu Oct 16, 2014 5:43 am

I just looked at the original posts and you should note that the only real thing I did was redirect the program to the path for my system. The actual commands and scripts are extremely simple.

I seriously doubt that it is a problem with the au3 scripts as they have been working for quite some time and I have not altered them at all lately.

One script has a line calling the au3 file and the other script has a line calling Audacity. Both of these seem to work if I enter them at a command prompt.

It leads me to believe that the scripts are not being called.
What is a command that I can use to write something to the screen to see if the file is actually being called?

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Edgar » Thu Oct 16, 2014 5:52 am

For me when I add the non-compiled script to the Task Scheduler Audacity starts just fine but never becomes active and thus does not start recording. I'm not sure what version of Audacity you are using, for this test I used a very recent compile of SVN HEAD – 2.0.7 Alpha. I've noticed other occasions when I have tried to start very recent versions of Audacity and it opened up in the background never getting activated/focus.

I think there's a typo in the script as presented:

Code: Select all

Send("!^+rr")
notice that there are two of the letter r; unless you have the unqualified letter r assigned to something I would expect this to add a label very near the beginning with just the letter r in it.

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Task Scheduler no longer talks to Audacity

Post by Edgar » Thu Oct 16, 2014 6:16 am

Upon further testing what I am seeing is that if the last time I closed Audacity it was maximized to full screen then starting it via the Task Scheduler causes it to fail to become active/in focus. However, if the last time I closed Audacity it was not full screen then everything works just fine.

Post Reply