Messages - skrommel [ switch to compact view ]

Pages: prev1 ... 4 5 6 7 8 [9] 10 11 12 13 14 ... 187next
41
:) Added an option to play sound files 0.wav, 1.wav... 23.wav on the hour if they exist in the program's folder, mouser.

Or just 0 through 12, it checks if files >12 exists, and if not it chooses the earlier ones.

42
:) Added an option to play the sound multiple times on the hour, nogojoe.

I could maybe add a second sound file to make the clock sound reverb on the last chime. Or maybe 12 separate files?

Skrommel

43
:) Made just for you, stisev!

It's was a quick hack, so I forgot to put code in the browse button! Updated the code on top. I also uploaded an .exe-file.

Skrommel

44
ClosedBy could easily be modified to watch if a file's size has stopped changing. :)

Or maybe you are referring to the CPU activity of the process? Or network activity?

Skrommel

https://www.donationcoder.com/forum/index.php?topic=43907.new

45
ClosedBy closes a program when a file contains a word. :)

ClosedBy.jpg

Download and install AutoHotkey to run the script.
Save the script to ClosedBy.ahk and doubleclick to run.

10.07.2017: Added a timeout. Corrected a bug when selecting a file to watch.

Skrommel

;ClosedBy.ahk
; Closes a program when a file contains a word
;Skrommel @ 2017

#NoEnv
#SingleInstance,Force

Gosub,INILOAD
Gosub,GUI
Return


GUI:
;Menu,Tray,NoStandard
Menu,Tray,Add,&ClosedBy,SHOW
Menu,Tray,Add
Menu,Tray,Add,&Show...,SHOW
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Default,&ClosedBy
Menu,Tray,Tip,ClosedBy

Gui,1:Add,Text,,Program to close:
Gui,1:Add,Edit,XM Y+2 W300 Vprogram,% program
Gui,1:Add,Button,X+5 W50 GPROGRAM,&Browse
Gui,1:Add,Text,XM,File to search:
Gui,1:Add,Edit,XM Y+2 W300 Vfile,% file
Gui,1:Add,Button,X+5 W50 GFILE,&Browse
Gui,1:Add,Text,XM,Word to look for:
Gui,1:Add,Edit,XM Y+2 W300 Vword,% word
Gui,1:Add,Text,XM,Delay between searches:
Gui,1:Add,Edit,XM Y+2 W50 Vdelay Limit4,% delay
Gui,1:Add,UpDown,Range1-9999
Gui,1:Add,Text,X+5 W150,seconds
GuiControl,1:,delay,% delay
Gui,1:Add,Text,XM,Timeout before closing program:
Gui,1:Add,Edit,XM Y+2 W50 Vtimeout Limit4,% delay
Gui,1:Add,UpDown,Range1-9999
Gui,1:Add,Text,X+5 W150,seconds
GuiControl,1:,timeout,% timeout
Gui,1:Add,Button,X+100 W50 GRUN +Default,&Run
Gui,1:Add,StatusBar,GWEBPAGE,1HourSoftware.no
SB_SetIcon("1HourSoftware.ico")
Gui,1:Show,,ClosedBy

Gui,2:+AlwaysOnTop
Gui,2:Add,Progress,XM W300 Vcountdown Range0-%timeout%,% timeout
Gui,2:Add,Button,XM W100 +Default GCLOSE,&Close the program
Gui,2:Add,Button,X+5 W50 GABORT,&Abort
Return


RUN:
Gui,Submit
Gosub,INISAVE
Loop
{
  abort=0
  close=0
  Process,Exist,%program%
  If ErrorLevel>0
  {
    FileRead,lines,% file
    IfInString,lines,% word
    {
      Gui,2:Show,NoActivate,ClosedBy
      countdown:=timeout
      Loop,% timeout
      {
        If close=1
          Break
        GuiControl,2:,countdown,% countdown
        countdown-=1
        Sleep,1000
      }
      If abort=1
        Continue
      Process,Close,% program
      Gui,2:Hide
    }
  }
  Sleep,% delay*1000
}
Return


CLOSE:
close=1
Gui,2:Hide
Return


ABORT:
abort=1
Gui,2:Hide
Return


PROGRAM:
Gui,1:Submit,NoHide
FileSelectFile,program,3,% program,Select a program,Programs (*.exe)
IfExist,% program
{
  SplitPath,program,program
  GuiControl,1:,program,% program
}
Return


FILE:
Gui,1:Submit,NoHide
FileSelectFile,file,3,% file,Select a text file,Text files (*.txt)
IfExist,% file
  GuiControl,1:,file,% file
Return


SHOW:
Gui,1:Show
Return


INILOAD:
IniRead,program,ClosedBy.ini,Settings,program
IniRead,file,ClosedBy.ini,Settings,file
IniRead,word,ClosedBy.ini,Settings,word
IniRead,delay,ClosedBy.ini,Settings,delay
IniRead,timeout,ClosedBy.ini,Settings,timeout
If program=ERROR
  program=Calc.exe
If file=ERROR
  file=C:\Output.txt
If word=ERROR
  word=FINISHED
If delay=ERROR
  delay=10
If timeout=ERROR
  timeout=30
Return


INISAVE:
IniWrite,% program,ClosedBy.ini,Settings,program
IniWrite,% file,ClosedBy.ini,Settings,file
IniWrite,% word,ClosedBy.ini,Settings,word
IniWrite,% delay,ClosedBy.ini,Settings,delay
IniWrite,% timeout,ClosedBy.ini,Settings,timeout
Return


WEBPAGE:
Run,http://www.1HourSoftware.no,,UseErrorLevel
Return


GuiClose:
EXIT:
Gosub,INISAVE
ExitApp

Pages: prev1 ... 4 5 6 7 8 [9] 10 11 12 13 14 ... 187next
Go to full version