
aleph01
Active Members-
Posts
343 -
Joined
-
Last visited
About aleph01
- Birthday 12/22/1957
Profile Information
-
Location
Atlanta, Georgia Metro Area (USA)
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
aleph01's Achievements

Universalist (7/7)
15
Reputation
-
Your For/Next loop looks odd. It automatically increments from 1 to $Variable_Number. You do not need to redefine Local $Loopstart = 1, and you do not need to increment with your line $Loopstart = $Loopstart + 1. The way you have it, it looks like $Loopstart will be set to 1 in every loop, then incremented to 2 if the While statement is true, then at the Next, it will increment to 3. Every loop after the first will be loop 3. You will never reach 6 and end the loop. Infinite 3rd loop if your While statement is true. If the While statement is not true, every loop will reset $Loopstart to 1 and the Next will increment it to 2. So in that case, you have an infinite 2nd loop. Somebody please correct me if I'm wrong.
-
Issue deleting MountedDevices registry entries
aleph01 replied to aleph01's topic in AutoIt General Help and Support
For future reference: I was mistaken. The above code doesn't work as intended. It runs into the same problem as any For...Next loop with a line Delete function. If it counts forward from 1 to 500, deleting as it goes, the even numbered lines in the original list don't get deleted because the list scrolls up as items are deleted. Instead of reworking it to place the mounted devices in an array and using UBound to get the size of the array and then loop backward, I chose a much simpler route. I use a script run under my user's account to RunAs a script that does the registry manipulation. That script is RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices") Sleep (1001) RegWrite ("HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices") After running, my MountedDevices list consists of the default entry only and Windows is able to recognize USB drives. Thanks -
Issue deleting MountedDevices registry entries
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Nevermind. Simple error. I had $i in my RegDelete line instead of &sVar. Code above is working fine. -
This script doesn't seem to be doing it: #RequireAdmin For $i = 1 To 100 $sVar = RegEnumVal("HKEY_LOCAL_MACHINE\System\MountedDevices", $i) If @error <> 0 Then ExitLoop RegDelete("HKEY_LOCAL_MACHINE\System\MountedDevices", $sVar) Sleep (101) Next The above script apparently has no affect. Setting is a library. When the MountedDevices list becomes large (due to patrons using thumb drives) it seemingly becomes corrupted and Windows stops recognizing USB drives. Clearing the list manually resolves the issue. Now I would like to automate the process. Does anyone see my error? I'm running this on my laptop where I am an administrator. The script runs, but no registry deletions occur. Thanks,
-
Tittle isn't actually accurate. WinZip is an option, as is any free unzip program. Wife for her job needs to unzip a file and then be able to access it. I though Shellexecute would do the job, but it seems to want an executable, not .zip file. I'm searching, but I thought I would put this in the forum and get (maybe) a solution or pointed in the right way. namaste
-
need to get users to start an elevated command prompt
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Thanks, orbs. I'll look at subinacl.exe. Right now I have it working with running an elevated .bat file. To suggest a change now that it's been rolled out and is working would be a non-starter. It might even get me into hot water working on an already approved solution, since I'm not supposed to work on any scripts off company time and we've got a solution in place. I appreciate yours and all the other responses. I still need to wrap my head around Jos' code. I think I looked at it fleetingly, and didn't see how it was helping my issue. Thanks to all. May you all code more elegantly than ever before. I know I am, thanks to y'all. (SE US, got to use the vernacular.) _aleph_ -
Cmd does Not Close when Run Shorcut (.lnk)
aleph01 replied to naru's topic in AutoIt General Help and Support
Alternately, Run(@ComSpec & " /c " & "C:\myapp.lnk") Send ("exit {ENTER}") perhaps? -
need to get users to start an elevated command prompt
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Rethinking my approach, I've found a way to make this work. I couldn't seem to get an elevated command prompt, so I run an elevated .bat flie. #include <Misc.au3> _Singleton("startRFIDServiceBat.exe", 0) Opt("MustDeclareVars", 1) Opt("WinTitleMatchMode", -2) Local $1 = 0 $1 = MsgBox (4,"Restart Service", "Do you wish to restart the RFID service?") If $1 = 6 Then RunAs ("administrator", @ComputerName, "password", 0, "C:\startRFID.bat", "", @SW_MAXIMIZE) Else Exit EndIf and the .bat file is simplicity: net start "ewSystemMonitor" net start "EnvisionWare RFIDLink" exit I stopped the RFID service at one of our Ask Us Desk stations and the user there was able to restart it using the compiled script. This problem is history. Thanks, -
need to get users to start an elevated command prompt
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Thanks for the try, Jos, but Func RunReqAdminDosCommand leaves me scratching my head. It looks like a bunch of FileWriteLines with some FileDeletes thrown in. I can't make the connection that will let me see how it can help me. Still searching for code that will allow a standard user to start a service when they are normally not able to start or stop services. -
need to get users to start an elevated command prompt
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Thanks, Jos. I'll try that function when I get a chance, probably tomorrow. If I have trouble with it, I'll post back for advice. If successful, I'll post my working code. -
need to get users to start an elevated command prompt
aleph01 replied to aleph01's topic in AutoIt General Help and Support
I believe there is a GPO that will allow me to let users toggle services. I can let them toggle the RFID service through a script on their desktops, so they don't even need to know they have access to services. Is this a flaw with RunAs? It would be better to not have to enable access to services for my users. -
need to get users to start an elevated command prompt
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Yes, I've tried all the options. -
need to get users to start an elevated command prompt
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Jos, Option 2 is a left-over remnant of when I was trying to get it to run with network admin credentials. Is 0 the preferred option? AspirinJunkie, your solution pops up a UAC prompt with or without #RequireAdmin. The RFID service crashes from time to time for no apparent reason. I've tried an infinite loop of net start commands, but couldn't get it to work consistently on our staff computers. -
This script doesn't seem to be doing it: #include <Misc.au3> Local $1 = 0 $1 = MsgBox (4,"Restart Service", "Do you wish to restart the RFID service?") If $1 = 6 Then RunAs ("administrator", @ComputerName, "password", 2, "C:\Windows\system32\cmd.exe", "", @SW_MAXIMIZE) WinWait ("cmd.exe") Send ("net start ewSystemMonitor {ENTER}") Send ("net start Envisionware RFIDLink {ENTER}") Sleep (301) Send ("Exit {ENTER}") Else Exit EndIf The above script apparently runs the command prompt without elevating it. Does anyone have a simple helpful tip for me? Thanks,
-
Clean up an array or text file
aleph01 replied to aleph01's topic in AutoIt General Help and Support
Thanks, iamtheky, works like a charm. Thanks everybody for their contributions. Danny35d, I don’t understand your use of StringRexExp, and I have a question, though: In the line $file = StringRegExp(FileRead('C:\Temp\nodes.txt'), '\\\\.*', 3) Why is the second parameter ‘\\\\.*’ when the regular expression to match is “\\:” or “\\ ”? The code works, I just don’t understand how. Thanks, _aleph_