Sign in to follow this  
Followers 0
Diana (Cda)

[Resolved(...)] Process that while a certain script is running doesn't allow

2 posts in this topic

#1 ·  Posted (edited)

I know how to periodically detect a process and halt it [if ProcessExists(unwanted process.exe) THEN ProcessClose(unwanted process.exe)] but is there an AutoIt command that can be used by a script to restrict an app from running at all to begin with (while the script itself is working, of course)?

i.e., think of it as, "while this script is running, don't allow this "unwanted process.exe" to run at all" ...

The ProcessExists/ProcessClose above works well in many cases but it does permit an app to function for some time because there is a time lag between when it is invoked and when it shuts down the process, which actually works well. That's the purpose of using that code. But I have a special case where total suppression is needed but not having much luck in the help file because I don't know what term to look for. <g>

Thanks.

:D

Edited by Diana (Cda)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I was private-messaged after posting this question. I'm glad I was otherwise I wouldn't have known why there were no responses. I don't think like a virus writer so it never occurred to me I was asking a difficult question. The poster of the private message believed I wasn't someone trying to write some sort of malware and said that they would help me if I gave more information which I immediately did. Though I never received a response to that, even if I had, it forced me to try to go a different route. I think I've managed to circumvent the whole "close down a process thing" and still work <fingers crossed>.

The app in question was an AutoHotKey function that controls volume. I have a script in my voice reminder folder that reminds me about taking some new meds that I just don't hear; I am missing it all the time due to low volume. I wanted to know how to temporarily suppress AutoHotKey from running while this script was engaged so that I could fix the volume control while the reminder was running. The immediate way of doing this was what I was asking about. No answer, understandably in hindsight if everyone leapt to the conclusion that I was trying to write a virus or something ... which I'm not, of course <g>.

Fortunately, after a few days of mulling this over, I came up with a workaround that _seems_ to be working. I replaced the AutoHotKey volume prompt script in my reminder folder with a preliminary AutoIt one that first checks to see that a temporary text file isn't open. If it isn't, _then_ the script is launched and adjusts the volume as per normal. I then modified the reminder script itself. This approaches seems to be doing the job.

1. To the new temporary AI volume-checking script I added this:

;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

$FileCheck = @ScriptDir & "\zzz- VolumeControl_AHK.txt"

;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

If NOT WinExists($FileCheck) THEN ShellExecute(@ScriptDir & "\PUACvolume- VOLUME, adjust re players.ahk")

2. And to script that needs volume jacked up while it's running, I modified with these lines:

;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

$file2write = @ScriptDir & "\zzz- VolumeControl_AHK.txt"

If FileExists($file2write) THEN FileDelete($file2write)

FileWrite($file2write, "TemporaryFile")

ShellExecute($file2write, "", "", "Open", @SW_MINIMIZE)

;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

$Folder2LevelsUp = StringLeft(@ScriptDir, StringInStr(@ScriptDir, "\", 0, -2))

ShellExecute($Folder2LevelsUp & "\AutoHotKey\APP- AutoHotKey v1.0.47.04\0- Scripts\Vol\VolumeSet - set level (075).ahk")

;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

But at the end of this script, I had to add the following to return things to the previous state so that the AutoHotKey volume script runs as per normal every x number of seconds:

;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

WinClose($file2write)

If FileExists($file2write) THEN FileDelete($file2write)

;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

So this question seems to be resolved. I'm pleased with this one. If it works correctly then I'll have been able to finally figure out a complex AutoIt solution completely on my own. 'bout time, too! <g>

Cheers,

:D

Edited by Diana (Cda)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0