Ich bin zu doof für das ganze :) (Programm per exe schließen)

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Ich bin zu doof für das ganze :) (Programm per exe schließen)

Re: Ich bin zu doof für das ganze :) (Programm per exe schließen)

Post by White_DE » 05 Jan 2018, 15:33

Jo Danke für die schnelle Hilfe :) Scheint alles zu funktionieren, falls noch was ist melde ich mich.

Re: Ich bin zu doof für das ganze :) (Programm per exe schließen)

Post by Gerdi » 05 Jan 2018, 10:41

nach dem Start von Garrys Skript musst Du noch mindestens eine der Tasten F1 bis F4 drücken.

Re: Ich bin zu doof für das ganze :) (Programm per exe schließen)

Post by garry » 05 Jan 2018, 04:09

Beispiele zu process close

Code: Select all

;- F1 = run 2 programs
;- F2 = close active window
;- F3 = close notepad
;- F4 = close calc

#warn
#NoEnv
#SingleInstance Force
setworkingdir,%a_scriptdir%
DetectHiddenWindows, on


F1::
;- run notepad.exe and then calc.exe
pr1=notepad
sc1=ahk_exe Notepad.exe
IfWinNotExist,%sc1%
   {
   Run, %pr1%,,,pid1
   WinWait,%SC1%
   }

pr2=calc
sc2=ahk_exe calc.exe
IfWinNotExist,%sc2%
   {
   Run, %pr2%,,,pid2
   WinWait,%SC2%
   }

IfWinNotActive ,%SC1%,,WinActivate,%SC1%
    WinWaitActive,%SC1%
;- now ready to send something to notepad
send,test send to notepad`r`n
return
;---------------------------------------------


;- processx  close active window
F2::
WinGet, Path, ProcessPath, A
SplitPath, Path, ProcessName
If ProcessName = explorer.exe
  return
msgbox, 262436,CLOSE PROCESS %processname%,Want you really close ? =`n%Path%`n%ProcessName%
ifmsgbox,NO
  return
Process, Close, %ProcessName%
return


F3::
xx=notepad.exe
process,exist,%xx%
pid:=errorlevel
if pid<>0
{
msgbox, 262208, ,Process %xx% with errorlevel=%pid% will close in 5 seconds,5
Process, Close, %pid%
return
}
msgbox, 262208, ,%xx% ist not running
return


F4::
xx=calc.exe
process,exist,%xx%
pid:=errorlevel
if pid<>0
{
msgbox, 262208, ,Process %xx% with errorlevel=%pid% will close in 5 seconds,5
winget,list,list,ahk_pid %pid%
loop % list
    {
    hwnd:=list%A_Index%
    winclose ahk_id %hwnd%
    }
return
}
msgbox, 262208, ,%xx% ist not running
return

Ich bin zu doof für das ganze :) (Programm per exe schließen)

Post by White_DE » 04 Jan 2018, 23:03

Hi,
ich bin komplett neu hier und möchte AutoHotkey erstmal nur benutzen um mir eine exe Datei zu erstellen, die das momentan geöffnete Fenster schließt. (Ich brauche das, weil ich grade dabei bin meinen PC über Amazon Echo sprachzusteuern, ich kann zwar durch ein anderes Programm Anwendungen öffnen aber eben nicht schließen, deswegen brauche ich diese Datei um sie per Sprachbefehl zu öffnen um andere Fenster zu schließen).
Ein paar Sachen habe ich schon ausprobiert, aber mein größter Erfolg dabei war, dass die exe Datei einmal funktioniert hat nachdem ich sie per Sprachbefehl gestartet habe, danach aber nicht mehr.
Falls das nicht zu viel verlangt ist würde ich mich sehr darüber freuen wenn mir jemand dieses (wahrscheinlich) einfache Skript schreiben könnte :)

Mit freundlichen Grüßen

"White"

Top