 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Sat Apr 10, 2004 3:21 am Post subject: Some Utilities |
|
|
Here are some dos utilities I use: Download by right-click / Save Target As... (93 KB)
Included in utilities.zip are:
addusers.exe
Can be used to Add, Update, or Delete Windows NT/2000/XP users on local computer or domain.
blat.exe
Can be used to send out emails via SMTP
elogdmp.exe
Windows NT/2000/XP Event Log Query Tool for local and remote PC's. Can export Event Logs to a text file for parsing.
reg.exe
Registry utility that lets you almost do anything to local and remote PC Registries.
rkill.exe & rkillsrv.exe
Remotely Kill processes by name, or PID.
sc.exe
Utility to Add, Update, Delete, Configure, Start, Stop, and Pause Windows Services.
srvany.exe
Utility to run any application as a service. This doesn't have a built in help, but if anyone is interested on how to use this let me know.
thanks,
beardboy |
|
| Back to top |
|
 |
Beastmaster Guest
|
Posted: Sat Apr 10, 2004 10:54 am Post subject: |
|
|
If you use Blat (Thx beardboy ) here's his perfect partner
GetMail
Easily download mail to your harddrive from the command line! |
|
| Back to top |
|
 |
JonTheNiceGuy
Joined: 22 Apr 2004 Posts: 18 Location: Manchester, UK
|
Posted: Mon Apr 26, 2004 11:57 pm Post subject: using SrvAny |
|
|
I've had a few problems running a script as a scheduled task in Windows 2k, (I'm guessing it's because it can't activate and de-activate the tasks) however, will this get around this problem?
Jon |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Tue Apr 27, 2004 12:10 am Post subject: |
|
|
Are you going to want to the script running all the time? Or are you going to want it to run at certain times?
thanks,
beardboy |
|
| Back to top |
|
 |
JonTheNiceGuy
Joined: 22 Apr 2004 Posts: 18 Location: Manchester, UK
|
Posted: Tue Apr 27, 2004 7:50 am Post subject: |
|
|
| Probably at a regular time each week. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Apr 27, 2004 10:04 am Post subject: |
|
|
| AHK definitely isn't designed to be run as a service, or by any scheduler that runs things in the absence of a desktop. I'd be interested to know if anyone gets such a thing working or can explain how application windows can even exist when there is no desktop. |
|
| Back to top |
|
 |
JonTheNiceGuy
Joined: 22 Apr 2004 Posts: 18 Location: Manchester, UK
|
Posted: Tue Apr 27, 2004 10:19 am Post subject: Task Scheduling |
|
|
| I'd made the assumption (probably wrongly) that you can "force" a service to interact with the desktop? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Apr 27, 2004 11:15 am Post subject: |
|
|
| Now that you mention it, I do seem to remember an option like that. If there are any server admins here, maybe they can confirm. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Tue Apr 27, 2004 2:48 pm Post subject: |
|
|
You can setup services to interact with the desktop. I had an AHK application that I had run as a service, and everything was running fine. Except for a Clipper application that I ran from the AHK service sometimes had some problems.
If you want your application to only run at a regular time each week, you could have it always running and just write in your script to kick off and do stuff at the designated time.
Here are two simple lines to add any program as a service. AHKService is the name you choice for your service, make sure to change that on both lines if you change the name. Srvany.exe can be placed anywhere I just put it in the winnt\system32 folder. And your Program which I named as AHKProgram of course can have any name and be in any folder.
| Code: | sc create AHKService binPath= c:\winnt\system32\srvany.exe type= own type= interact start= auto
reg add HKLM\system\currentcontrolset\services\AHKService\Parameters\Application=c:\winnt\AHKProgram.exe |
After you run both those commands you will have a service that will be startable. You can go into Services and change who the service logs in as, if you want it to start automaticlly, manually, etc...
If you have any questions let me know.
thanks,
beardboy |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Wed Apr 28, 2004 6:33 pm Post subject: |
|
|
an addition to ur list beardboy:
a small (25k) command line utility to view, kill, suspend/resume or set the priority and affinity of processes. (free)
http://www.beyondlogic.org/solutions/processutil/processutil.htm
btw there r some more nice utils for networks on this site. _________________
 |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Fri Sep 10, 2004 12:45 am Post subject: |
|
|
i tried srvany. i made sure that both cmds gave success messages. i tried it with with a compiled ahk script... it just had this:
| Code: | loop
{
fileappend, %A_Hour%:%A_Min%:%A_Sec%`n, c:\timer.txt
sleep, 5000
} |
nothing happened. _________________
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Fri Sep 10, 2004 1:48 am Post subject: |
|
|
| That's a little disappointing. Maybe there's something in the code that prevents AutoHotkey from launching if it doesn't have access to the desktop or the Explorer shell. Has anyone ever gotten a script, compiled or otherwise, to launch as a service and do something useful? |
|
| Back to top |
|
 |
Atomhrt
Joined: 02 Sep 2004 Posts: 128 Location: Sunnyvale
|
Posted: Fri Sep 10, 2004 2:03 am Post subject: |
|
|
| Chris wrote: | | That's a little disappointing. Maybe there's something in the code that prevents AutoHotkey from launching if it doesn't have access to the desktop or the Explorer shell. Has anyone ever gotten a script, compiled or otherwise, to launch as a service and do something useful? |
It works for me!
Here is my registry tree:
| Code: |
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService]
"Type"=dword:00000110
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):45,3a,5c,50,72,6f,67,72,61,6d,20,46,69,6c,65,73,5c,52,65,73,\
6f,75,72,63,65,20,4b,69,74,5c,73,72,76,61,6e,79,2e,65,78,65,00
"ObjectName"="LocalSystem"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService\Parameters]
"Application"="c:\\autokey\\test.exe"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService\Security]
"Security"=hex:01,00,14,80,90,00,00,00,9c,00,00,00,14,00,00,00,30,00,00,00,02,\
00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
00,00,02,00,60,00,04,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\
05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,\
00,18,00,fd,01,02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,\
00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService\Enum]
"0"="Root\\LEGACY_AHKSERVICE\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001
|
Note I used slightly different paths... And I did have to use different reg.exe parameters since it was obvious that beardboy was using a version that is not the same as mine. Here is the reg.exe command that I used:
reg add HKLM\system\currentcontrolset\services\AHKService\Parameters /v Application /d c:\autokey\test.exe
Output:
C:\autokey>cat \timer.txt
17:55:00
17:55:05
17:55:10
17:55:15
17:55:20
17:55:25 _________________ I am he of whom he speaks! |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Fri Sep 10, 2004 4:19 am Post subject: |
|
|
thanx. i'll check it out. _________________
 |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Sep 10, 2004 6:55 am Post subject: |
|
|
Sorry I never posted a tutorial on how to get this setup correctly.
First I copy srvany.exe into the system32 folder.
Then using sc.exe I would create a new service. You have to point the name of the exe for the service to srvany.exe
| Code: | | sc create AHKService binPath= c:\winnt\system32\srvany.exe type= own type= interact start= auto |
Then you have to update the registry to point to your AHK Script or EXE:
| Code: | | RegWrite, REG_SZ, HKLM, system\currentcontrolset\services\AHKService\Parameters, Application, c:\winnt\system32\AHKScript.exe |
Once both these are done if you start the service named AHKService it will start the program srvany.exe and it will start AHKScript.exe.
After you get this all setup you can modify the service to run as an administrator user instead of it being interactive and it could run even if the computer isn't logged on, and or do system tasks that don't require desktop interaction. I have a script I wrote to auto connect me to my work's VPN, and it will have me logged in and connected to the office before I even login to windows.
Let me know if anyone else has any questions.
thanks,
beardboy |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|