AutoHotkey Community

It is currently May 26th, 2012, 8:21 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: July 25th, 2009, 12:52 am 
Offline

Joined: January 27th, 2007, 8:24 pm
Posts: 30
Location: Canada
Hi.
I have an external app (Juice, a podcast aggregator). As it completes each download, it does a command line call to my AHK script, passing some variables.
My script uses FFMpeg to convert the files to mpegs (which I play at my tv using a MediaMVP and GB-PVR application).
Its sorta like my little IPTV system.

Problem is.. if I use #singleinstance Off , as each new download completes, it keeps spawning new instances of my script (FFMpeg takes a bit of time). Eventually, the computer bogs down. I cant use #singleinstance Ignore or Force obviously.
My current 'solution' for this, is to only allow one thread at a time for downloading in Juice. That way, once my script is done it closes its own window, then the cmd.exe window (called from the Juice) closes, and the next file downloads.
The drawback is.. it would be nice to be downloading the next file while the current one processes. I just cant figure out how.

Anyone run into a window handling situation like this ?



Code if its needed to looksee..
Code:
#singleinstance off
SetTitleMatchMode, 2
WinMinimize, cmd.exe
TimeStamp = A_Now
FormatTime, TimeStamp,,ddd`,MMMd  h:mm:ss
IniRead, Ext, %A_ScriptDir%\mpegmaker4juice.ini, General, Ext
IniRead, FFopt, %A_ScriptDir%\mpegmaker4juice.ini, General, FFopt
IniRead, DelOrig, %A_ScriptDir%\mpegmaker4juice.ini, General, DelOrig
IniRead, FFShow, %A_ScriptDir%\mpegmaker4juice.ini, General, FFShow
;
JuicePathtoFile = %1% ; full path from drive letter to .ext
JuicePodcastName = %2% ; just folder name it seems
;
Splitpath, JuicePathtoFile,,Filedir,FileExt,FilenameNoExt,
If FileExt not in %Ext%
   {
   Goto, Filetypenotinlist
   }
Runwait, ffmpeg.exe -i "%JuicePathtoFile%" %FFopt% "%FileDir%\%FilenameNoExt%.mpeg" ,,%FFShow%
If (DelOrig = "True")
   {
   FileDelete, %JuicePathtoFile%
   }
FileAppend, %TimeStamp% %JuicePathtoFile% converted and deleted (used string %FFOpt%)`n, %A_Scriptdir%\mpegmaker4juice.log
Exit
;
Filetypenotinlist:
Msgbox, 16, mpegmaker4juice, Filetype does not exist in ini file, 8
FileAppend, %JuicePathtoFile% : filetype not in .ini list`n, %A_Scriptdir%\mpegmaker4juice.log
Exit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2010, 6:16 pm 
Offline

Joined: May 17th, 2008, 5:00 am
Posts: 39
Location: Dallas, TX
Use the process command to watch for existing FFmpeg & wait instead for it to close
Code:
Loop, 600
{
Process, WaitClose, FFmpeg.exe, 5
if !ErrorLevel ; The PID no longer exists.
    break
}

Hope this helps.

Cheers,
Shawn[/code]


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Pulover, SKAN, StepO, Yahoo [Bot] and 59 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group