Search found 299 matches

by pneumatic
18 Aug 2017, 21:47
Forum: Ask For Help
Topic: Reliability of FileExist() at windows startup
Replies: 0
Views: 291

Reliability of FileExist() at windows startup

My script runs at windows startup with admin privileges via Task Scheduler, and at startup I would like to check whether a list of files exist. Is it safe to do this, or is there a chance that windows is in some sort of not fully initialised state and may have not initialised access rights or someth...
by pneumatic
18 Aug 2017, 20:55
Forum: Bug Reports
Topic: StrSplit() returns an array of unexpected capacity
Replies: 34
Views: 7320

StrSplit() returns an array of unexpected capacity

For some reason the StrSplit method returns a larger array "capacity" than if the elements are manually added. I'm guessing there is some technical reason for this, but it doesn't appear to be documented. String := "1,2,3,4,5,6" Array := StrSplit( String, "," ) MsgBox % "Array.GetCapacity(): " Array...
by pneumatic
18 Aug 2017, 18:21
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

Exaskryz wrote:WinClose, % "ahk_id " Instances%A_Index% should work. The space after the d is important.
Thanks.
by pneumatic
17 Aug 2017, 23:14
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

Can anyone advise me on how to do the double reference so the last line works without having to store it in another variable first. #SingleInstance Off #DetectHiddenWindows On RunAsAdmin(){ If !( A_IsAdmin ) { Run , *RunAs %A_ScriptDir%\MyScript.exe, ,UseErrorLevel ExitApp } Else { SetTitleMatchMode...
by pneumatic
17 Aug 2017, 22:36
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

For anyone who might find this thread through a search in future, the previous code is STILL not good enough (UAC strikes again!). With UAC turned off and "run as administrator" unticked for my script.exe (not compiled) the program for some reason launches in admin mode on the first run which then b...
by pneumatic
21 Jul 2017, 00:21
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

lexikos wrote: SendMessage must find the window and be able to send a specific message to it.
Whoops lol, I forgot that Wintitle must be present in PostMessage :) For some reason I thought the message number was the unique identifier.

In that case I'll just stick with WinExist(ahk_id).

Thanks again.
by pneumatic
19 Jul 2017, 08:45
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

I was going to go the easy route and just ExitApp if there was already another instance running, but I think it would result in a race condition [...] I think what you're saying is that the new (admin) instance may exit because it sees the old instance still running. That's easily solved by telling...
by pneumatic
18 Jul 2017, 01:02
Forum: Ask For Help
Topic: Is this code risky?
Replies: 1
Views: 463

Re: Is this code risky?

<bump>
by pneumatic
17 Jul 2017, 22:34
Forum: Ask For Help
Topic: DllCall: adjust memory priority of script Topic is solved
Replies: 9
Views: 2555

Re: DllCall: adjust memory priority of script Topic is solved

Thanks. Looks like Windows 10 sets the priorities right. Must be a bug in Windows 7 or something specific to my machine causing it. The only thing I notice is the "task version" tag is 1.4 vs 1.2, maybe they changed it in between.
by pneumatic
17 Jul 2017, 11:46
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

Cheers I'll give it a go.
by pneumatic
17 Jul 2017, 09:56
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

Hmm, actually I think the race condition might still be a problem regardless. Because it can't close other instances prior to the above code, because it doesn't yet have admin privileges at that point in the script. So the check for other running instances has to be done AFTER the above lines of cod...
by pneumatic
17 Jul 2017, 09:51
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

Re: SingleInstance Force issue Topic is solved

Great answer as always, thanks. I was going to go the easy route and just ExitApp if there was already another instance running, but I think it would result in a race condition because of: If !( A_IsAdmin ) { Run , *RunAs "%scriptPath%" ;if the current instance is still running at the time the new i...
by pneumatic
17 Jul 2017, 08:30
Forum: Ask For Help
Topic: DllCall: adjust memory priority of script Topic is solved
Replies: 9
Views: 2555

Re: DllCall: adjust memory priority of script Topic is solved

With a simple task that's "configured for Windows 10": above normal process priority (10), normal I/O priority (both Process Hacker and Process Explorer say "Normal" here) and normal page priority (5) Thanks, I'm getting the same values here on Win7. But, when I set <Priority>4</Priority> I'm getti...
by pneumatic
17 Jul 2017, 01:47
Forum: Ask For Help
Topic: DllCall: adjust memory priority of script Topic is solved
Replies: 9
Views: 2555

Re: DllCall: adjust memory priority of script Topic is solved

I should also mention that calling Reload is equivalent to calling Process, Priority, ,N , which doesn't affect I/O priority or Memory Priority (or pagefile priority as you have called it). So the way I am doing it: XML_out .= "<Priority>2</Priority>" ;On my Win7x64 this results in I/O Priority = No...
by pneumatic
17 Jul 2017, 01:04
Forum: Ask For Help
Topic: SingleInstance Force issue Topic is solved
Replies: 14
Views: 3493

SingleInstance Force issue Topic is solved

In the case where a script is already running as admin, and the user manually double-clicks a new instance of the script, the new instance fails to take its place and displays an autohotkey error message. I presume this is because the new instance doesn't have admin privileges and isn't allowed to c...
by pneumatic
16 Jul 2017, 23:27
Forum: Ask For Help
Topic: DllCall: adjust memory priority of script Topic is solved
Replies: 9
Views: 2555

Re: DllCall: adjust memory priority of script Topic is solved

Using <Priority>4</Priority> in the XMLs for the two AutoHotkey scheduled tasks I have here on my Windows 10 system has always worked fine for me (they start with normal process priority, normal I/O priority and normal page priority). Still, if you want to have a go at setting them yourself for the...
by pneumatic
16 Jul 2017, 05:35
Forum: Ask For Help
Topic: DllCall: adjust memory priority of script Topic is solved
Replies: 9
Views: 2555

Re: DllCall: adjust memory priority of script Topic is solved

I tried getting the SeDebugPrivilege per the dll example in the Process documentation, but it's not working. The whole access rights API is way over my head and I would need to take at least a 3 day seminar to understand it :lol: In the meantime here is how I am scheduling the script as a task with ...
by pneumatic
15 Jul 2017, 22:49
Forum: Ask For Help
Topic: DllCall: adjust memory priority of script Topic is solved
Replies: 9
Views: 2555

DllCall: adjust memory priority of script Topic is solved

When launching a script at windows startup via task scheduler, there is a problem where Windows treats it as a background task and the script's process receives lower CPU and memory priorities, which affects performance of the script significantly. Any other processes run by it also receive these lo...
by pneumatic
14 Jul 2017, 06:26
Forum: Ask For Help
Topic: OCR Help
Replies: 3
Views: 701

Re: OCR Help

If the number is part of a GUI control element of that program, you may be able to read the value directly into a variable. Use the included Window Spy utility to see if a reference can be gotten to the control - if yes, use one of the built in functions starting with the word "Control" such as "Con...
by pneumatic
14 Jul 2017, 04:11
Forum: Ask For Help
Topic: Is this code risky?
Replies: 1
Views: 463

Is this code risky?

FileDelete ,someFile.txt ;sleep here? If (FileExist("someFile.txt")) destroyTheWorld() I need to be 100.000% certain that once FileDelete is finished that the file system knows for certain the file doesn't exist. Should I put a sleep in between to give the file system some time to update itself or ...

Go to advanced search