

Some Utilities
Started by
beardboy
, Apr 10 2004 02:21 AM
34 replies to this topic
posting the relevant sections from that script would help!

#16
-
Posted 10 September 2004 - 06:55 AM

CleanNews.in : Bite sized latest news headlines from India with zero bloat
From my vpn connecting script?
Here is the basis of it:
thanks,
beardboy
Here is the basis of it:
Loop { Loop, HKEY_LOCAL_MACHINE, SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces, 1, 1 { RegRead, value if a_LoopRegName = DhcpDomain { domain = %value% } } if domain <> workdomain.com { IfNotExist, \\computeratoffice\c\ { RunWait, VPNClient.exe } } Sleep, 100 }The full script is over 380 lines long. With tooltips, traytips, changing icon in the system tray for when I am connected vs. not connected, etc...
thanks,
beardboy
#17
-
Posted 10 September 2004 - 07:28 AM

i thought maybe u've converted the service creation procedure to ahk script... but its ok.
#18
-
Posted 10 September 2004 - 12:11 PM

CleanNews.in : Bite sized latest news headlines from India with zero bloat
Sorry I never posted a tutorial on how to get this setup correctly.
First I copy srvany.exe into the system32 folder.
I did not have to do this, it ran fine straight from my Program files\Resource Kit directory. Using XP SP1. As long as the full path to srvany is in the ImagePath registry key, it should work.
#19
-
Posted 10 September 2004 - 05:52 PM

I am he of whom he speaks!
Correct, I just put that on there for people that might download it off of the web and not install it with Resource Kit, it just needs to be in a folder that is specified in the path. Or a direct path needs to be specified.I did not have to do this, it ran fine straight from my Program files\Resource Kit directory. Using XP SP1. As long as the full path to srvany is in the ImagePath registry key, it should work.
Nope sorry, it was just easier to use sc.exe and reg.exe to quickly add a service.i thought maybe u've converted the service creation procedure to ahk script... but its ok.
thanks,
beardboy
#20
-
Posted 11 September 2004 - 06:46 AM

How do I use your srvany.exe utility? When I open srvany.exe the dos window just quickly flashes. I need to use that utility to turn an application into a service.
#21
-
Posted 09 February 2006 - 10:23 PM

First you need to create a service using SC.exe
Let me know if you have any more questions.
thanks,
beardboy
sc.exe create MyService binPath= c:\windows\system32\srvany.exe type= own type= interact start= autoThen after you create the service you need to modify the program you want srvany to start and stop for you using REG.exe
reg.exe add HKLM\system\currentcontrolset\services\MyService\Parameters\Application=notepad.exeThe only things you need to change are the service name if you want it different "MyService", the program you want to run "notepad.exe", and the location of srvany.exe if you have it located somewhere else.
Let me know if you have any more questions.
thanks,
beardboy
#23
-
Posted 10 February 2006 - 01:00 AM

Is there a way to configure the service to run at a particular time instead of running when a user logs into the Windows 2003 system? Thank you.
Let me just summarize my problem: I have programmed my scripts and compiled them into executables. I then used Windows Scheduler to schedule my execuatbales for a particualr time. Everything worked great until I tried to run my scheduled tasks while my screen was locked. I am hoping this issue will be resolved by making my scripts into services instead of appliactions. What are your thoughts on this issue? Thank you.
Let me just summarize my problem: I have programmed my scripts and compiled them into executables. I then used Windows Scheduler to schedule my execuatbales for a particualr time. Everything worked great until I tried to run my scheduled tasks while my screen was locked. I am hoping this issue will be resolved by making my scripts into services instead of appliactions. What are your thoughts on this issue? Thank you.
#24
-
Posted 10 February 2006 - 04:02 PM

My suggestion would be to have your compiled exe's just run your needs at a particular time. Setup a compiled exe that only runs what you want to run at specific times (within your ahk code, if time = this time run this...). Then you have that exe started as a service, it will always be running even if you aren't logged into the computer.
thanks,
beardboy
thanks,
beardboy
#25
-
Posted 10 February 2006 - 04:28 PM

Do you have any example code for the function if Time = ?
Also, I am having trouble starting my test service. Heres what I did:
1) I created a quick test script that has the following code:
Run, Notepad.exe
WinWait, Untitled - Notepad,
IfWinNotActive, Untitled - Notepad, , WinActivate, Untitled - Notepad,
WinWaitActive, Untitled - Notepad,
Send, test
Sleep, 100
2) I compiled the script called notepad2.exe and copied it along with the sc.exe and sryan.exe into the /system32 directory
3) I ran the following commands in the command line:
sc.exe create Notepad2 binPath= c:\windows\system32\srvany.exe type= own type= interact start= auto
reg.exe add HKLM\system\currentcontrolset\services\Notepad2\Parameters\Application=notepad2.exe
4) I tried to manually start my service and I got the following error message:
The Notepad2 service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, Performance Lof and Alerts service.
Do you know how I can prevent the service from automatically stopping? Thank you so much for all of your help!
Also, I am having trouble starting my test service. Heres what I did:
1) I created a quick test script that has the following code:
Run, Notepad.exe
WinWait, Untitled - Notepad,
IfWinNotActive, Untitled - Notepad, , WinActivate, Untitled - Notepad,
WinWaitActive, Untitled - Notepad,
Send, test
Sleep, 100
2) I compiled the script called notepad2.exe and copied it along with the sc.exe and sryan.exe into the /system32 directory
3) I ran the following commands in the command line:
sc.exe create Notepad2 binPath= c:\windows\system32\srvany.exe type= own type= interact start= auto
reg.exe add HKLM\system\currentcontrolset\services\Notepad2\Parameters\Application=notepad2.exe
4) I tried to manually start my service and I got the following error message:
The Notepad2 service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, Performance Lof and Alerts service.
Do you know how I can prevent the service from automatically stopping? Thank you so much for all of your help!
#26
-
Posted 10 February 2006 - 05:17 PM

Is your windows directory "c:\windows" or "c:\winnt"?
The other thing is if you are running XP, XP comes with a newer version of Reg, which might have setup the registry key wrong. I suggest putting the reg.exe that you downloaded here and put it in a specific folder on your computer then runing the reg.exe command you listed from that directory.
thanks,
beardboy
The other thing is if you are running XP, XP comes with a newer version of Reg, which might have setup the registry key wrong. I suggest putting the reg.exe that you downloaded here and put it in a specific folder on your computer then runing the reg.exe command you listed from that directory.
thanks,
beardboy
#27
-
Posted 10 February 2006 - 05:22 PM

I use Winnt put I did remember to edit that before I hit enter on the command line.
Let me make sure I understand what you are saying. Do you want me to do the following:
Step 1) Take the reg.exe that I downloaded from your Utilities.zip directory and copy it to C:\Winnt\System32
Step 2) Take the reg.exe that I downloaded from your Utilities.zip directory and copy it to a directory of my choice
Step 3) Double click and run the reg.exe from Step 2
Thank you so much for all the help.
Let me make sure I understand what you are saying. Do you want me to do the following:
Step 1) Take the reg.exe that I downloaded from your Utilities.zip directory and copy it to C:\Winnt\System32
Step 2) Take the reg.exe that I downloaded from your Utilities.zip directory and copy it to a directory of my choice
Step 3) Double click and run the reg.exe from Step 2
Thank you so much for all the help.
#28
-
Posted 10 February 2006 - 05:32 PM

Try this for me instead.
sc.exe start Notepad2
And let me know what it says.
thanks,
beardboy
sc.exe start Notepad2
And let me know what it says.
thanks,
beardboy
#29
-
Posted 10 February 2006 - 07:22 PM

This is what it says:
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.
C:\>sc.exe start Notepad2
SERVICE_NAME: Notepad2
TYPE : 110 WIN32_OWN_PROCESS (interactive)
STATE : 3 STOP_PENDING
(STOPPABLE,PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 3492
FLAGS :
Thank you so much for all the help.
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.
C:\>sc.exe start Notepad2
SERVICE_NAME: Notepad2
TYPE : 110 WIN32_OWN_PROCESS (interactive)
STATE : 3 STOP_PENDING
(STOPPABLE,PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 3492
FLAGS :
Thank you so much for all the help.
#30
-
Posted 10 February 2006 - 07:26 PM
