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.
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 ----------------------------------------------------------------------------
; 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.
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.
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 ----------------------------------------------------------------------------
; 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**
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:
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.
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?
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:
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.
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.
The maximize and minimize options did nothing for me but I did find something that is much more bizarrer.
I was trying to see if the file had actually been called by the TS. In the AudacityInit.xml file, I added " echo Here I am " just before the command in the 4th to last line. The idea was to see the echo words to prove that the file had been called. No other changes were entered.
Well, although no echo comment was seen, the file now worked!!!
I remove the line, it stops. I re-enter the line, it works again.
How strange is that?
Now that Audacity initializes, I see the error statement:
“Audacity did not recognize the file 'C:Gork__Scheduled Event Scripts]InitializeAudacityB.au3”
The path is correct and the file is present. The purpose to call this script is to initialize Audacity yet it claim it cannot read the file.
Is that close square bracket between Scripts & Initialize correct, the typo introduced when writing this email or an error?
Making it work by simply adding the failing Echo statement tells me that this is almost certainly a timing problem the “wait for window to activate” command (at least in other scripting languages with which I am more familiar) occasionally fails. It’s been my experience with other scripting languages that the best solution is to wait at least 3-5 times the expected duration between launch & ready to use then search for the specific window by title.
Sleep ( delay )
Parameters
delay Amount of time to pause (in milliseconds).
WinActivate ( "title" [, "text"] )
Parameters
title The title of the window to activate. See Title special definition.
text [optional] The text of the window to activate.
Return Value
Success: Returns the handle of the window.
Failure: Returns 0 if window is not found or cannot be activated.
Remarks
You can use the WinActive function to check if WinActivate succeeded. If multiple windows match the criteria, the window that was most recently active is the one activated. WinActivate works on minimized windows. However, a window that is "Always On Top" could still cover up a window you Activated.
I see that I am a few years out of date in my AutoIt3 installation:
AutoIt v3.3.12.0 has been released.
AutoIt v3.3.12.0 – 1st June, 2014.
Yes, that was a typo. It should have been and not ]
First hurdle has been solved. Maybe the system is moving a bit faster lately and that is what may have been causing the first failure. Now I have to figure out why Audacity does not seem to want to see au3 files.
2.0.6 and it is a new installation. I uninstalled it after the problems showed up and reinstalled it to see if there was a corruption or something gone wrong. I had been running this long before the TS stopped communicating with Audacity.
As a test, I moved the script file to c: to check for a path problem but it still does not read it. I recreated the Task Scheduler event and used the browse to find the file. Still not working.
Something else going on is that the task manager is creating an instance of Audacity for each event. It is supposed to create it only for the initialize vent and only cause that instance to stop or stop recording by way of two other scripts
As it is now, when I activate the start script or stop script , it created additional Audacity instances instead.
Again, these scripts were not changed and were working before TS stopped talking to Audacity.
I did not see that it was a message from within Audacity but I guess it is. It does seem that it is trying to import a file as audio and it clearly is not. I wonder how it changed from implement to import. When I clicked on the HELP button, it does discuss types of audio files to import.