
ShminkyBoy
Active Members-
Posts
28 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by ShminkyBoy
-
_Service_UDF v4 : Build your own service with autoit code
ShminkyBoy replied to arcker's topic in AutoIt Example Scripts
Then maybe you should read Constants.au3 before being crass, no? That is where both of those constants reside. (Scite offers a search function that will look for your terms in ANY FILE of the folder you select, I pointed it at AutoIt's \includes folder, and found them in Constants.au3) Just add #include <Constants.au3> to your script. And yes, it works, otherwise, myself and all these other people that ARE using it are imagining? hahaha Happy Holidays =) -
_Service_UDF v4 : Build your own service with autoit code
ShminkyBoy replied to arcker's topic in AutoIt Example Scripts
... You should read the rest of the first post also, it has some interesting info for writing service in autoit! -
_Service_UDF v4 : Build your own service with autoit code
ShminkyBoy replied to arcker's topic in AutoIt Example Scripts
It's impossible to tell where your error is with only what you've given us. Follow Arcker's advice, THEN come here and start a NEW topic in the HELP forum with your problem. Did you declare all vars? Do you have a function to clean up and close open handles before the script ends? Do you inform the SCM when the script is stopping? (services are different than user processes, they don't like being stopped ungracefully) Does this script run properly in application mode? At first glance, instead of testing for @compiled in Main(), test for $SERVICE_RUNNING in Main() instead. You should only be testing for @compiled at script start, not over and over again in the Main(). (once you verify that @compiled = true at script start, it can not change state during run, no?) So, sth like: $query = _Service_QueryStatus('seclogon') If Not IsArray($query) Then yourcleanupfunc() IF $query[1] <> $Service_Running then yourcleanupfunc() Then add a clean up func (ex.- sth like the cleanup routines in the arcker service example) that makes sure that all file handles are closed etc., THEN end. Cleaning up BEFORE giving the script an opportunity to stop is a Good Idea, espesially since you seem to be doing registry writes. This way when you run, the SCM can know whether the script is running or not, and if not, the script can inform the SCM, and you can clean up gracefully before exiting. Hard to help you with only what you've given us. And, this thread is for _service_UDF, please don't hijack; Start a new thread, you'll get better responses! Thanks! =) -
_Service_UDF v4 : Build your own service with autoit code
ShminkyBoy replied to arcker's topic in AutoIt Example Scripts
Is this a new API call or sth? I only have XP, I'll have to wait until I upgrade to go any further with Vista/Win 7 programming -
_Service_UDF v4 : Build your own service with autoit code
ShminkyBoy replied to arcker's topic in AutoIt Example Scripts
Here's an update v0.3 to the AServiceMenu.au3 example; this one actually works while paying a little more respect to the MSDN way though, in that the user portion of the script is run as a separate process to the service portion. That being said, in practice you will want the agent menu mode to run in the user's environment, and NOT just a run() as it is in this example, per the advice of Arker and ugdeen for security reasons. The 'agent menu' portion of the script could definitely be handled better, since the example provides an unclean way of agent menu control by the service (right now the service just kills the menu unceremoniously when a user logs off =) it really should clean things up..) You need to compile it with Arker's *updated* udf's for it to work.. Thanks Arker for updates to services.au3, this proves autoit can do ALL service functions natively!!! Edit- see first post -
Disable/Enable Local Area Connection
ShminkyBoy replied to DjDeep00's topic in AutoIt General Help and Support
Thank you, toxicvn, but archrival has already given proof that this is not the case: I think the dllcall would work, if i could learn what parameters the call was expecting; i did some googling for netshell.dll, and so i've seen mention of a thread on a forum somewhere that shows the dllcall, unfortunately the site that allegedly had this example no longer exists now =( -
Disable/Enable Local Area Connection
ShminkyBoy replied to DjDeep00's topic in AutoIt General Help and Support
As noted by archrival, this unfortunately does not work. =( nice wrapper for devcon =) I was hoping for something native Autoit, perhaps using some dll calls. After poking about i did an export of netsh.dll's functions and I tried something like this: #include <Constants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $hdll = DllOpen ('netshell.dll') MsgBox(0,'',$hdll) $value = DllCall ($hdll, 'none', 'RepairConnection') MsgBox(0,'',$value) DllClose($hdll) but this crashes autoit (I'm using 3.3.0.0).. Am I doing this dll call wrong Lar? -
thanks for that heads-up with the MSDN link, arcker! ... i did some further testing with the code and it seems the main() function [the 'non-interactive' piece] in my template is indeed firing off, just as you intended with your routines.. so it's still technically working.. just have to get the gui to be supported now.. quick question: does it make sense to change this: ;goto cleanup; DllStructSetData($tService_Status, "dwServiceType", $SERVICE_WIN32_OWN_PROCESS) DllStructSetData($tService_Status, "dwServiceSpecificExitCode", 0); to this: ;goto cleanup; DllStructSetData($tService_Status, "dwServiceType", _Service_QueryType($sServiceName)) DllStructSetData($tService_Status, "dwServiceSpecificExitCode", 0); ..in the _service_init() routine? [engine's _service_querytype() function returns the correct value, so if the service is interactive, _service_querytype() will return 0x00000110 as the return value] [...later on] I should make any changes to include the 'gui support for interactives' in the _service_servicemain() routine, correct? /me goes to read more on the msdn site this would be cool to have complete native service functionality in autoit... it looks to be quite possible on the quick scan of that page you gave me, i'm going to go read more and try! =) I've uploaded changes so far to the scripts, see first post.
-
_Service_UDF v4 : Build your own service with autoit code
ShminkyBoy replied to arcker's topic in AutoIt Example Scripts
so why does srvany.exe, runasssvc.exe et al allow the scripts to run with gui and everything using Bitor($service_win32_ownproccess,$service_interactive_process) [spelling probably not right, I'm going off memory here at work... my code is at home=)], but the 'native' autoit routines do not? also I've tried to read through and figure out my own troubles (posted in other thread), and found of MSDN that there's indeed a 'main()', and that's for console apps. .. but there's also a 'winmain()' that should be used for GUI processes? .. also if services were flat out not allowed to interact with users, what would even be the point of having a choice to interact with desktop at all? .. also in reading about services (I really am trying to contribute, but I'm in way over my head methinks).. there is indeed the SCM which handles the service proccess if it is a console app... ... but for GUI (ie- interactive) the service should use SCP? it this right? here's the thread and code I'm talking about: http://www.autoitscript.com/forum/index.php?showtopic=83099 <--- confused now. Please forgive =) -
*bump* hopefully a dllcall/dllcallback guru can help me, I suspect it's something with the callback piece... but I don't have enough knowledge to proceed, this is my first foray into using dllcall's =(
-
Hi, I've been working on an 'Au3 service with menu' type app template using a UDF that I assembled from the work of catchfish, engine, and arcker.. I can't seem to get the compiled script's menu to actually function while the script is in service mode though.. I started out with a couple of different service UDF's from the above guys (many thanks to them for that =)).. but that got the below results: If I start the compiled script from the SCM it starts the service and the icon apears. If I right click on the scripts tray icon, nothing happens.. UNTIL I stop the service again with the SCM.. then the traymenu appears... but if the tray menu is clicked on, the script ends (since the service was actually stopped by the SCM before the traymenu was "touched" I'm guessing) So I consolidated the UDFs and cleaned up the conflicts (those three UDF's shared some function names, so I took a function from catchfish's service UDF and arcker's au3-as-service functions and added them to engine's service UDF (replacing the bits arcker had borrowed from sometingwong's service UDF with the ones from engine's UDF due to fuller SCM support, but leaving the actual au3-as-service functions themselves intact, basically)... again, same results as before I assembled the UDF, so I'm back at square 1.. note: the script is configured as a BitOR($SERVICE_WIN32_OWN_PROCESS,$SERVICE_INTERACTIVE_PROCESS), arcker's original example configured the service as $SERVICE_WIN32_OWN_PROCESS.. I know that this script will successfully run as a service using srvany.exe,but I want to be able to use arcker's method and get rid of the constraint of using srvany.exe... Please help me, source code is attached =) Changes ---------- version 0.1 =) version 0.2 Got almost everything in the example script into a function Renamed the _setpriveledge function to an internal name to avoid conflicts =) Removed _Service_Status in favor of _Service_QueryStatus in _au3services _au3services.au3 AServiceMenu.au3
-
Disable/Enable Local Area Connection
ShminkyBoy replied to DjDeep00's topic in AutoIt General Help and Support
Thanks for the suggestion Lar, but I can't seem to find any documentation for the Ifmon.dll file itself, the part of netsh that I want to make use of with dllcall().. I would prefer not to have to use an external app in the script- making the dllcall() directly would be better, no? I've gone quite a bit of googling and searching the forums, with no luck =( -
Disable/Enable Local Area Connection
ShminkyBoy replied to DjDeep00's topic in AutoIt General Help and Support
is there a dll call that can be used to do this instead? Because using the Shell.Application object's functionalities will only work if a user shell is initialized, correct? ie- a user must be logged in to use this udf, since accessing the Shell.Application object requires a user logging in and activating the shell... right? Just curious, i've been all over msdn and am rather super confused as to what exactly to look for as far as attempting using dllcall() to do this instead.. The reason I ask is because I am writing a script that will be run as as service and i need to be able to control the nic to enable, disable and repair it whether there is or is not a user logged on to the PC. This doesn't appear to work unless there is a user logged in when the Shell.Application object is used. any ideas? -
Set up a network share silently?
ShminkyBoy replied to ShminkyBoy's topic in AutoIt General Help and Support
Thank you, this worked! -
Ok, new thread, same topic; hopefully someone can help me solve this =) I need to retreive the user's name *and* password to silently set up network shares. the working .bat file commands are as follows: REM V: Drive Net Use V: /Delete IF ERRORLEVEL 1 @ECHO No V: Drive to reset, continuing... Net Use V: \\10.1.0.45\Home %PASSWORD% /user:%USERNAME% IF ERRORLEVEL 1 pause Here's what I have so far in AutoIT, which fails: #NoTrayIcon #include "Misc.au3" ;` Run only one instance if _Singleton("Remap",1) = 0 Then Exit EndIf ;~ Update environment variables EnvUpdate() $Status = RemapShare("V:","\\10.1.0.45\Home",EnvGet("USERNAME"),EnvGet("PASSWORD")) If @error then MsgBox(0x41010,"COMPANY network share - Error!","Drive V: " & $Status & " - Error code " & @error & ". ",5) ;~ End exit ;~ Remap persistent net shares Func RemapShare($sDriveLetter, $sNetPath, $sUsername = "username", $sPassword = "password") $RetVal = DriveMapGet($sDriveLetter) If @error > 0 Then $RetVal = DriveMapAdd($sDriveLetter, $sNetPath, 0, $sUsername, $sPassword) If @error > 0 Then Seterror(1) return "FAILED" EndIf seterror(0) Return "MAPPED" Else If $RetVal <> $sNetPath Then SetError(2) Return "CONFLICT" EndIf $RetVal = DriveMapDel ($sDriveLetter) If @error > 0 Then Seterror(3) return "FAILED" EndIf $RetVal = DriveMapAdd($sDriveLetter, $sNetPath, 0, $sUsername, $sPassword) If @error > 0 Then Seterror(4) return "FAILED" EndIf seterror(0) Return "REMAPPED" Endif Endfunc Basically, I want the script to silently remap the drive share using the logged on user's credentials with no user intervention. I figured I could use EnvGet() to get the user password from the environment variable, but it fails at the drivemapadd() line Is this incorrect? Is there another way to do what I want?
-
Looking for a little help
ShminkyBoy replied to ScriptGuy's topic in AutoIt General Help and Support
REDACTED -
Looking for a little help
ShminkyBoy replied to ScriptGuy's topic in AutoIt General Help and Support
REDACTED -
Thanks for the heads up ptrex, I'll try this tonight, doing services without having to use srvany.exe will make for a nice portable code (I want to be able to drop the script on a workstation pc and have it self-configure as a service on first run without having to worry about support apps)
-
Understood- just wondering if autoit gained the ability to do this natively yet or not. I'm currently using srvany.exe, no need to switch away from it to sc.exe if I've already got it working.. I just wanted to know if anyone has tried to see if it can be done natively with the newer version of autoit yet =) (didn't the inability to do this come from the way autoit previously handled stdin/stdout/stderr or something like that?)
-
Not sure if this has been asked, but is it still necessary to use a program like srvany.exe etc etc in conjunction with my script to be able to run it as a service? I know that in past versions of autoit srvany.exe was required, but has the new version changed this restriction? Just curious to know whether I'd be wasting my time trying figure out how to do that natively with the new autoit, thanks!
-
Here's one that I wrote for a script i'm working on; it doesn't use do..until or any sleep and keeps track of 2 different timers at once: global $id_HostTimer, $n_HostAuditTime, $id_ServiceTimer, $n_ServiceAuditTime $n_HostAuditFrequency=3 ;~ timer1 interval is 3 minutes $n_ServiceAuditFrequency=5 ;~ timer2 interval is 5 minutes MsgBox(0,"Time limits",$n_HostAuditFrequency & @crlf & $n_ServiceAuditFrequency) inithosttimer() initservicetimer() ;~ Main while 1 $n_HostAuditTime = ((TimerDiff($id_HostTimer) / 1000) / 60) ;~ get the time for timer1 in minutes $n_ServiceAuditTime = ((TimerDiff($id_ServiceTimer) / 1000) / 60) ;~ get the time for timer2 in minutes If $n_HostAuditTime >= $n_HostAuditFrequency Then AuditHosts() Else EndIf If $n_ServiceAuditTime >= $n_ServiceAuditFrequency Then AuditServices() Else EndIf WEnd Exit ;~ Functions Func InitHostTimer() $n_HostAuditTime=0 $id_HostTimer=TimerInit() EndFunc Func InitServiceTimer() $n_ServiceAuditTime=0 $id_ServiceTimer=TimerInit() EndFunc Func AuditHosts() MsgBox(0,"Host Timer",$n_HostAuditTime) InitHostTimer() EndFunc Func AuditServices() MsgBox(0,"Service Timer",$n_ServiceAuditTime) InitServiceTimer() EndFunc EDIT: eek I didn't realize this post was from June... oh well, hope it helped =)
-
Enable SpeedHack, like CheatEngine...
ShminkyBoy replied to Info's topic in AutoIt General Help and Support
I'm probably going to get a ban for this, but I'll deal. Dude, you suck. Why? I'm a game developer for a free online FPS, and people like you make people that want to play a game for fun and relaxation... not want to play. And that makes me wanna barf. It makes us (community developers) wonder why we go through the trouble to make a free game/utility/fun new thing... So butt-munches like you can make a hack because you're too weak in the pants to learn to play the game with skill? PFFT. Get a f'n life. -
Edit a list of items! _ListEditbox.au3
ShminkyBoy replied to ShminkyBoy's topic in AutoIt GUI Help and Support
hmm. I'm doing this for a script in a production environment at work, is the beta ok for that? I've always been taught to use non-beta things in a production setting. Oh poop. /me goes and downloads the beta -
list all varibel in an array
ShminkyBoy replied to emoyasha's topic in AutoIt General Help and Support
http://www.autoitscript.com/forum/index.php?showtopic=64451 ? That lets you edit the array as well as looking at it. Hope that helps. -
Edit a list of items! _ListEditbox.au3
ShminkyBoy replied to ShminkyBoy's topic in AutoIt GUI Help and Support
yeah, I'm finding that I'm not allowed to post there yet for some reason :shrugs: thanks for the good words though =)