"Taskkill" #IfWinExist dont Work!!

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

"Taskkill" #IfWinExist dont Work!!

24 Sep 2017, 11:26

Hey guys :)

Can some one Help me cause my Script wont Work, would be nice ^^

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



The Problem is, the Programms are open but my Programm (Cleaner) wont Start, and no its not the Programm (Cleaner) its #IfWinExist or so....
If the Code Worked click on the Arrow so all know it, its worked !!
A_AhkUser
Posts: 622
Joined: 06 Mar 2017, 16:18
Location: France

Re: "Taskkill" #IfWinExist dont Work!!

24 Sep 2017, 11:54

Hi Reloaded,


The #IfWin directives are positional: they affect all hotkeys and hotstrings physically beneath them in the script. They are also mutually exclusive; that is, only the most recent one will be in effect.

source:#IfWinActive/Exist

Use Process, Exist instead - for example:

Code: [Select all] [Download] GeSHi © Codebox Plus

for index, program in ["chrome.exe", "notepad.exe"]
{
Process, Exist, % program
if not (ErrorLevel) ; ErrorLevel to the Process ID - evaluated as true here - if a matching process exists, or 0 - false - otherwise.
return ; at least one of the program does not exist
}
; otherwise...
MsgBox,




run command wrote:Parameters
Target
A document, URL, executable file (.exe, .com, .bat, etc.), shortcut (.lnk)


In your source your program lacks its extension. Besides, if your program is not in one of the PATH folders or in the script's working directory, the full path must be specified:

Code: [Select all] [Download] GeSHi © Codebox Plus

Run, Cleaner.exe ; supposed to be in the script own directory
run, notepad ; one of the "integrated" program, in the system32
Video Game Reader
Image
github
demo
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

24 Sep 2017, 13:54

Umm... Thx for the Help but its not Work D:

But i think i make something Wrong..

Code: [Select all] [Download] GeSHi © Codebox Plus

for index, program in [dllhost.exe, SearchFilterHost.exe, sppsvc.exe, SearchProtocolHost.exe, SearchFilterHost.exe, SearchProtocolHost.exe, SearchIndexer.exe, TiWorker.exe, WMIADAP.exe, RuntimeBroker.exe]
{
Process, Exist, % program
if not (ErrorLevel)

Run, Cleaner
Sleep, 5000

return
}


I want if 1 of this Programms open it start my Programm (Cleaner) i would make it self but i cant. Cause this i ask you for Help !
If the Code Worked click on the Arrow so all know it, its worked !!
A_AhkUser
Posts: 622
Joined: 06 Mar 2017, 16:18
Location: France

Re: "Taskkill" #IfWinExist dont Work!!

24 Sep 2017, 14:39

Array elements as literal strings must be enclosed in double quotes to distinguish them from variables.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Video Game Reader
Image
github
demo
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

25 Sep 2017, 01:40

Hi!

Im so sry, its me again but when i start the Script its start "Unknow Editor"

I ReInstalled Ahk but its the same Problem but just with This Script all my other Scripts Work perfect, would be nice if you Help me :)

http://tinypic.com/view.php?pic=rtqi4g&s=9#.WcikDYy0OUm

Then i Start the Script.

http://tinypic.com/view.php?pic=a2wwb7&s=9#.WcikK4y0OUm
If the Code Worked click on the Arrow so all know it, its worked !!
A_AhkUser
Posts: 622
Joined: 06 Mar 2017, 16:18
Location: France

Re: "Taskkill" #IfWinExist dont Work!!

26 Sep 2017, 13:02

Code: [Select all] [Download] GeSHi © Codebox Plus

Run, %A_Destktop%\cleaner.lnk

instead of:
Video Game Reader
Image
github
demo
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 06:53

Hello!

Thank you !, but the Script dont work !.
If 1 of these programms are open the programm didn`t start and that´s bad :(

So the Script look like by me now.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
KuroiLight
Posts: 259
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 11:33

you don't give enough context to see whats wrong, we need the whole script
this is all I can do with what you posted
copy & paste

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 11:41

Thx to try help me ! but my problem is, i designed a (Cleaner) it close all other porgramms i didnt need, but i need to start the programm "Manuel" and i want to make a Script, if 1 of these Programms open it start the (Cleaner).

I have try it with, #IfWinExist , #IfWinActive , ErrorLevel and much more but nothing Work, maybe it help you with this Script !

Code: [Select all] [Download] GeSHi © Codebox Plus

q::
WinGet, PID, PID, A
Process, Close, %PID%
Return


Maybe you can help me and this Script be usefull for you idk.. i try my best.

Thx!
If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 11:46

If you have Discord you can yoin! I`m Onlinw now !:)

https://discordapp.com/channels/362640729023184898/362640729023184900
If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
KuroiLight
Posts: 259
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 11:52

Do you want to script to run all the time?
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 11:58

Jes
If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 11:58

Like so it Check all "1 Min" if 1 of these programms open.
If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
KuroiLight
Posts: 259
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 11:59

Here:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


I do not recommend killing dllhost or sppsvc as this can actually cause some things to crash/break, and some of these can be safely disabled altogether in services.msc, refer to my post here: https://autohotkey.com/boards/viewtopic.php?f=5&t=37303
Last edited by KuroiLight on 27 Sep 2017, 12:02, edited 1 time in total.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 12:01

Error at line 3.

Line Text: #SetWorkingDir, %A_ScriptDir%
Error: This line does not contain a recoganized action.

The programm will exit.
If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
KuroiLight
Posts: 259
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 12:02

its fixed, recopy
and if you want 1 minute, change 5000 to 60000
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 12:05

Omg! It`s Work. Thank you ! I love you now xD
If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 12:14

Hey, it`s me again, you know how to make a ImageSearch Script ? .

I asked for help in other Forum but they laughed me out cause i dont know how to make an so "Easy" Script.
If the Code Worked click on the Arrow so all know it, its worked !!
User avatar
KuroiLight
Posts: 259
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 12:28

Ive not yet used ImageSearch, but if you want help with it please make a new thread;
I think you got the reply you did because you didn't provide any code you tried, you should provide an example of what you tried and a description of what you are trying to do so the person helping will have some context for what you need.
Always start at the docs, and if you can't figure it out search for posts via google: search with keywords ahk ImageSearch
https://autohotkey.com/docs/commands/ImageSearch.htm
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



User avatar
Reloaded
Posts: 218
Joined: 25 Aug 2017, 08:48

Re: "Taskkill" #IfWinExist dont Work!!

27 Sep 2017, 12:36

Ohh, trust me, i tried so much ImageSearch codes but no one work and i dont know why, but thx i give my best and Thank you for the great Help!.

And i releas in 1H a list of very usefull Scripts for beginners maybe you can look in Scripts and Functions. ;D
If the Code Worked click on the Arrow so all know it, its worked !!

Return to “Ask For Help”

Who is online

Users browsing this forum: 1valaki1, congdantoancau, Delta Pythagorean, gregster, Joe Glines, Rohwedder and 41 guests