topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 5:39 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Movie Mode  (Read 15868 times)

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
IDEA: Movie Mode
« on: December 08, 2010, 01:48 PM »
Whenever my daughter and I watch movies on my PC (or I am playing a fullscreen game), I end up having to first close a bunch of applications I normally have running, because they either make sounds or have popup alerts that distract us and spoil our enjoyment of the movie.

It would be nice if I had utility that I could supply a list of the full paths to all the programs that interfere, that may or may not be running. It would go down the list and check if those apps are running; and if they are, add them to a relaunch list before closing them. Then when I am finished watching my movie, it could relaunch all the apps for me...but only the ones on the relaunch list. This way nothing that wasn't running before would end up getting launched, and I could provide a more extensive list of applications that interfere.

NOTE: At least one of the applications I need to close has to be relaunched with command line parameters.

JavaJones

  • Review 2.0 Designer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,739
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #1 on: December 09, 2010, 02:17 AM »
Would it not be easier to have something that mutes all apps but the foreground one (movie player) and is "always on top"? Seems that might also be fairly easy to code and more generally useful.

- Oshyan

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #2 on: December 09, 2010, 05:30 AM »
No, because it's not only sound that causes distractions. Popup alerts and other activities also cause distractions.

This would be fairly easy to code as I described it, and normally it would be the kind of thing I'd make myself, but I am just not in the right frame of mind to be able to do it.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #3 on: December 09, 2010, 08:29 AM »
I would be willing to add such a feature to Process Tamer.

JavaJones

  • Review 2.0 Designer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,739
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #4 on: December 09, 2010, 11:12 PM »
Yeah, I figured the "always on top" bit would take care of the pop-ups. But fair enough. I guess a better way to say it is *I'd* find a more general version to be useful. But I don't want to hijack your request thread. :)

- Oshyan

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #5 on: December 09, 2010, 11:21 PM »
could any of the offending apps suffer data loss on being closed?

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #6 on: December 09, 2010, 11:29 PM »
could any of the offending apps suffer data loss on being closed?

No.

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #7 on: December 10, 2010, 12:15 AM »
Just to be sure, before it relaunches the programs, it should check to make sure the programs are not already running.  You may have closed a program without realizing you just minimized it to the tray, or there was some dialog that you had to click on before closing.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #8 on: December 25, 2010, 10:55 PM »
i have a script to do this before launching a game but the apps to be closed/relaunched are manually added to the list. that's why there is a "pre" and "post" button. i'll clean up the code a bit and post it if you're interested.


SleepingWolf

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 118
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #9 on: February 07, 2011, 10:54 AM »
You could check out EndItAll by PC Magazine at pcmag.com
-------------------------------------------

Question everything, use a fact-checker.
Respect yourself and respect others.
Peace out!

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #10 on: February 07, 2011, 12:45 PM »
You could check out EndItAll by PC Magazine at pcmag.com

Thanks for the suggestion but...

Here are the 2 key points to what I want:

  • I do not want to have to select a bunch of things to kill each and every time.
  • I need it to be able to restart everything it kills later on.

EndItAll can not do that and neither can its successor, TaskPower 2.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #11 on: February 07, 2011, 04:50 PM »
Annoyed with constant popup requesters from people who want to be your Facebook friend?
Find that the latest Nigerian Prince has interrupted your movie watching by offering you a once in a lifetime offer to get wealthy?
Do dings, bells, chimes and buzzes make you miss that once in a million Call of Duty: Black Ops headshot?
Constantly find yourself openning the door for salesmen?  (Sorry, got carried away  :-[ )

Well, your prayers are answered!*

Try ***Movie-ize***, (catchy name, huh).

Comes with a money back guarantee!**

Instructions:
1) Put it anywhere
2) Run it
3) Marvel at the Tray icon
3) Select Preferences to edit the ini file, it's pretty self-explanatory: one line per program, full path required, increment the key number as you go, (ie. Program11, Program12, etc).  It throws Skype in as an example entry.

I should note that all it does is close the process, if the process pops up a requester asking for confirmation, it won't get it from this program.

EDIT: Crap!  Didn't see the command line parameter bit  :-[
I'll have a look at that.  Can you send me an example command line for it?

Removed, see post below.


* Maybe
** Disclaimer: All waranties void if this software proves useful or not.  Liability also not accepted for damage to eyesight through increased movie watching or DVT from failing to move from chair.  Warranty also considered to be void if it's used on a system it wasn't designed for, ie. mine.
« Last Edit: February 07, 2011, 08:35 PM by 4wd »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #12 on: February 07, 2011, 06:19 PM »
Can you send me an example command line for it?

This is the parameters for launching the particular version of xchat that I run, that sets the settings folder somewhere other than the default location on my system drive:

-d "E:\Programs Installed\xchat-pu70\settings"

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #13 on: February 07, 2011, 06:38 PM »
Thanks, got an idea how to go about it - other than that, is it suitable for intended purpose?

eg. The method it uses to kill programs tends to leave their icons in the SysTray until you wander your mouse over them, is this a problem?

Of course, if it is a problem I don't know what I'm going to do about FIXED

While I'm at it, when running programs from command line do you want the CLI window to be open/closed/optional ?

EDIT: Try this one.

Delete the old ini file, it'll create a new one with a couple of examples.
Main things to notice are:
1) Prefix DOS, (or CLI run programs), with the '>' character;
2) Match the parameters with the programs, ie. Param1 is for Program1, etc;

Oh, if it wasn't obvious in the first post, it can handle more than 10 programs - just keep incrementing the program and parameter number.
« Last Edit: March 07, 2011, 01:00 PM by 4wd »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #14 on: February 08, 2011, 01:02 AM »
The method it uses to kill programs tends to leave their icons in the SysTray until you wander your mouse over them, is this a problem?

Sounds good to me so far and the tray icons won't be a problem.

While I'm at it, when running programs from command line do you want the CLI window to be open/closed/optional ?

There is no extra CLI window when I launch XChat that way.

other than that, is it suitable for intended purpose?

Can't answer that yet, but I'll configure and test this later, when I am fully awake and not busy. (woke up to a ton of work in my inbox)


4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #15 on: February 08, 2011, 01:24 AM »
Sounds good to me so far and the tray icons won't be a problem.

I'm afraid I fixed that, so you'll have to download it again from above post  :-[

I also gave it an obligatory random version number so I can keep up with myself.

There is no extra CLI window when I launch XChat that way.

Oh well, I've left in the option of leaving the output window open.

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #16 on: February 08, 2011, 09:42 AM »
The closing of everything works great.

The relaunching has an issue: nothing with command line parameters is being relaunched.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #17 on: February 08, 2011, 05:04 PM »
The relaunching has an issue: nothing with command line parameters is being relaunched.

Could you post or PM the ini file, (blank anything you don't want seen) ?

Ah, I think my handling of quotes was a little skewiff.

Try this one, it seems to work OK with the specific example you gave above - might need to rework it for more complicated quoting.

Have also removed the option to leave open the output CLI, (just to make the parameters in the ini file a little simpler), but if anyone wants it back, say something.

Code: AutoIt [Select]
  1. ; Filename: Movie-ize.au3
  2. #NoTrayIcon
  3. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  4. #AutoIt3Wrapper_icon=popcorn-32x32.ico
  5. #AutoIt3Wrapper_UseUpx=n
  6. #AutoIt3Wrapper_UseX64=n
  7. #AutoIt3Wrapper_Res_Icon_Add=popcorn-32x32.ico
  8. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  9.  
  10. #include <_SysTray.au3>
  11. #include <Process.au3>
  12. #include '_OsVersionInfo.au3'
  13.  
  14. Global $inifile = 'Movie-ize.ini', $tempini = 'Movie-tmp.ini', $_state = False, $_term = False
  15.  
  16. ;--- Start Tray menu stuff
  17. Opt("TrayMenuMode", 1)
  18. Opt("TrayOnEventMode", 1)
  19.  
  20. $movieon = TrayCreateItem('Movie-ize',-1,-1,1)
  21. TrayItemSetOnEvent(-1, '_movieOn')
  22. $movieoff = TrayCreateItem('De-Movie-ize',-1,-1,1)
  23. TrayItemSetOnEvent(-1, '_movieOff')
  24. $prefs = TrayCreateItem('Preferences',-1,-1,0)
  25. TrayItemSetOnEvent(-1, '_prefs')
  26. $about = TrayCreateItem('About',-1,-1,0)
  27. TrayItemSetOnEvent(-1, '_about')
  28. $exit = TrayCreateItem('Exit',-1,-1,0)
  29. TrayItemSetOnEvent(-1,'_Exit')
  30. TraySetIcon('Movie-ize.exe', 4)
  31. TraySetToolTip("Get out the popcorn 'cause it's movie time!")
  32. TrayItemSetState($movieoff, 129)
  33. TrayItemSetState($movieon, 64)
  34. ;--- End Tray menu stuff
  35.  
  36. If Not FileExists($inifile) Then
  37.         _CreateBaseIni()
  38. $kill = IniReadSection($inifile, 'Programs')
  39. $kparam = IniReadSection($inifile, 'Parameters')
  40.  
  41. If $CmdLine[0] > 0 Then $_term = True
  42. If $_term Then
  43.         _RunAndExit()  ;--- If there's a CLI argument then Run and Exit
  44.         _Initialise()  ;--- Otherwise, check for Movie-tmp.ini and initialise to movieOn state
  45.  
  46.         Sleep(1000)    ;--- Twiddle thumbs
  47.  
  48.  
  49. Func _Initialise()
  50.         If FileExists($tempini) Then
  51.                 $xterm = IniReadSection($tempini, 'Start')
  52.                 For $i = 1 To $kill[0][0]
  53.                         $kill[$i][0] = $xterm[$i][1]
  54.                 Next
  55.                 $_state = True
  56.                 TrayItemSetState($movieon, 129)
  57.                 TrayItemSetState($movieoff, 68)
  58.                 TrayItemSetState($prefs, 128)
  59.                 TraySetToolTip('System Movie-ized')
  60.         EndIf
  61.  
  62. Func _Exit()  ;--- If not Run And Exit, checks to see if in MovieOn mode and asks user if they really want to exit
  63.         If Not $_term Then
  64.                 TrayItemSetState($exit, 4)
  65.                 If $_state And (MsgBox(49, 'Movie-ize', 'System currently Movie-ized!' & @CRLF & 'Do you want to quit in this state?') = 2) Then Return
  66.         EndIf
  67.         Exit
  68.  
  69. Func _about()
  70.         TrayItemSetState($about, 4)
  71.         MsgBox(64, 'Movie-ize', 'Movie-ize v0.22')
  72.  
  73. Func _prefs()  ;--- Load the ini into users default editor and wait for exit, then re-read ini
  74.         TrayItemSetState($prefs, 4)
  75.         If Not $_state Then  ;--- If in MovieOn mode then killed program state will be lost if user edits ini....so don't! >:^(
  76.                 ShellExecuteWait($inifile)
  77.                 Sleep(1000)
  78.                 $kill = IniReadSection($inifile, 'Programs')
  79.                 $kparam = IniReadSection($inifile, 'Parameters')
  80.         Else
  81.                 MsgBox(48, 'Movie-ize', 'System currently Movie-ized,' & @CRLF & 'Preferences will be unavailable.')
  82.         EndIf
  83.  
  84. Func _movieOn()  ;--- Cycles thru program array, if there's a process match it kills it and sets corresponding element to 1
  85.         Local $i, $guineapig
  86.         If Not $_term Then
  87.                 TrayItemSetState($movieon, 129)
  88.                 TrayItemSetState($movieoff, 64)
  89.                 TrayItemSetState($prefs, 128)
  90.         EndIf
  91.         $_state = True
  92.         For $i = 1 To $kill[0][0]
  93.                 If $kill[$i][1] <> '' Then
  94.                         $guineapig = StringMid($kill[$i][1], StringInStr($kill[$i][1], '\', 0, -1) + 1)
  95.                         If ProcessExists($guineapig) Then
  96.                                 ProcessClose($guineapig)
  97.                                 $kill[$i][0] = 1
  98.                         Else
  99.                                 $kill[$i][0] = 0
  100.                         EndIf
  101.                 EndIf
  102.         Next
  103.         _RefreshSystemTray()
  104.         If Not $_term Then TraySetToolTip('System Movie-ized')
  105.  
  106. Func _movieOff()  ;--- Cycles thru program array looking for 1 element, if found tries to restart the associated program
  107.         Local $i, $exec, $wdir, $execcmd
  108.         If Not $_term Then
  109.                 TrayItemSetState($movieon, 64)
  110.                 TrayItemSetState($movieoff, 129)
  111.                 TrayItemSetState($prefs, 64)
  112.         EndIf
  113.         $_state = False
  114.         For $i = 1 To $kill[0][0]
  115.                 If $kill[$i][0] = 1 Then
  116.                         If StringLeft($kill[$i][1], 1) = '>' Then
  117.                                 $exec = StringMid($kill[$i][1], 2)
  118.                                 $wdir = StringMid($kill[$i][1], 2, StringInStr($kill[$i][1], '\', 0, -1) - 2)
  119.                                 $execcmd = '"' & $exec & '" ' & $kparam[$i][1]
  120.                                 Run(@ComSpec & ' /c "' & $execcmd & '"', $wdir, @SW_HIDE)
  121.                         Else
  122.                                 Run($kill[$i][1])
  123.                         EndIf
  124.                         Sleep(500)
  125.                 EndIf
  126.         Next
  127.         If Not $_term Then
  128.                 TraySetToolTip("Get out the popcorn 'cause it's movie time!")
  129.                 FileDelete($tempini)
  130.         EndIf
  131.  
  132. Func _CreateBaseIni()  ;--- Creates a basic ini file first time it's run
  133.         Local $i
  134.         IniWrite($inifile, 'Programs', 'Program1', 'C:\Program Files\Skype\skype.exe')
  135.         IniWrite($inifile, 'Programs', 'Program2', '>C:\Program Files\xchat\xchat.exe')
  136.         IniWrite($inifile, 'Parameters', 'Param1', '')
  137.         IniWrite($inifile, 'Parameters', 'Param2', '-d "E:\Programs Installed\xchat-pu70\settings"')
  138.  
  139. Func _TempIni()  ;--- For Run And Exit, writes a temporary ini file with initial program states, (QaD)
  140.         Local $i
  141.         For $i = 1 To $kill[0][0]
  142.                 IniWrite($tempini, 'Start', 'Start' & $i, $kill[$i][0])
  143.                 IniWrite($tempini, 'Programs', 'Program' & $i, $kill[$i][1])
  144.                 IniWrite($tempini, 'Parameters', 'Param' & $i, $kparam[$i][1])
  145.         Next
  146.  
  147. Func _RunAndExit()  ;--- If the temporary ini exists, assumes already run once and refills array with correct values before calling _movieOff
  148.         Local $i        ;--- otherwise call _movieOn then _TempIni to write list of killed programs
  149.         If FileExists($tempini) Then
  150.                 $xterm = IniReadSection($tempini, 'Start')
  151.                 $kill = IniReadSection($inifile, 'Programs')
  152.                 $kparam = IniReadSection($inifile, 'Parameters')
  153.                 For $i = 1 To $xterm[0][0]
  154.                         $kill[$i][0] = $xterm[$i][1]
  155.                 Next
  156.                 _movieOff()
  157.                 FileDelete($tempini)
  158.         Else
  159.                 _movieOn()
  160.                 _TempIni()
  161.         EndIf
  162.         _Exit()
  163.  
  164. Func _RefreshSystemTray()  ;--- The magic that clears the SysTray of dead icons courtesy of a UDF by Tuape & Erik Pilsits
  165.         $count = _SysTrayIconCount()
  166.         For $i = $count - 1 To 0 Step -1
  167.                 $handle = _SysTrayIconHandle($i)
  168.                 $visible = _SysTrayIconVisible($i)
  169.                 $pid = WinGetProcess($handle)
  170.                 $name = _ProcessGetName($pid)
  171.                 $title = WinGetTitle($handle)
  172.                 $tooltip = _SysTrayIconTooltip($i)
  173.                 If $pid = -1 Then _SysTrayIconRemove($i)
  174.         Next
  175.  
  176.         If _OsVersionTest($VER_GREATER_EQUAL, 6, 1) Then
  177.                 $countwin7 = _SysTrayIconCount(2)
  178.                 For $i = $countwin7 - 1 To 0 Step -1
  179.                         $handle = _SysTrayIconHandle($i, 2)
  180.                         $visible = _SysTrayIconVisible($i, 2)
  181.                         $pid = WinGetProcess($handle)
  182.                         $name = _ProcessGetName($pid)
  183.                         $title = WinGetTitle($handle)
  184.                         $tooltip = _SysTrayIconTooltip($i, 2)
  185.                         If $pid = -1 Then _SysTrayIconRemove($i, 2)
  186.                 Next
  187.         EndIf

UPDATE: v0.22 - Cleaned up some stupid typos, removed some stuff that I forgot.
                        - Now sets the tray menu items to disabled/enabled so you don't call things twice, (why didn't I think of that before?).
                        - Added ability to run and exit, just call it with a command line argument (writes a temp ini when it kills programs, deletes it after relaunching them).
                        - Added some comments to source, ('cause mouser told me I should).
« Last Edit: February 09, 2011, 02:27 AM by 4wd »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #18 on: February 08, 2011, 07:42 PM »
Thank you! That works.  :)

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Movie Mode
« Reply #19 on: February 08, 2011, 07:55 PM »
Thanks April, source added to post above.