Jump to content

Moonwaltz

Active Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Moonwaltz

  1. I neead to make the script wait till this is done FILECOPY("%0\..\*.*", "C:\temp", 1)
  2. blockinput won't work because they have to continue to be able to work till the script prompts them to reboot. Sorry I should have included that in the original post.
  3. I finally have my script working but I would like to add one more thing. when the script is running a certain proccess I would like the user to not be able to reboot or shutdown the machine. one particular proccess I'm calling could have devistating effects if the users shut down or reboot before it is complete. Any hint's suggestions or starting points would be wounderful.
  4. that did it. Some day I promise I'll learn to do all of this on my own without getting hung up. Thanks again
  5. my script shows an icon in the system tray while it's running. any hints on how to hide it?
  6. _singleton works perfectly. Thanks once again for all the help.
  7. need to only let one instance of my script run at a time. compiled my script is called disable firewall.exe I only want one instance of the script to be active at a time but I'm having trouble figuring it out. when I make the processexist lines active the script won't run at all. everything else works as needed just need help with the script only running one at a time. CODE; Check for FIO already running ;If ProcessExists("Disable Firewall.exe") Then ; Exit ;Else ; EndIf ;check for exported file If FileExists("C:\Firewall Temp\sever.xml") Then Else ; Export current policy RunWait (@ComSpec & " /c " & '"FIO.exe O "C:\firewall temp\server.xml""', "C:\firewall temp", @SW_HIDE) EndIf ; Import zero firewall RunWait (@ComSpec & " /c " & '"FIO.exe I "C:\firewall temp\Disable.cfp" /displayProgress"', "C:\firewall temp", @SW_ENABLE) MsgBox (4096, "Sara Lee Connections", "The firewall has been disabled for 5 min", 0) sleep(300000) Runwait (@ComSpec & " /c " & '"FIO.exe I "C:\firewall temp\server.xml" /displayProgress"', "C:\firewall temp", @SW_ENABLE) FileDelete ("C:\firewall temp\server.xml") MsgBox (4096, "Sara Lee Connections", "The firewall has been Re Enabled", 0)
  8. when a user selects yes or no from a message box how do I plug that into an if then statement? here is what I have so far. I'm testing with message boxes instead of actual commands to reboot. MsgBox(4100, "Reboot Now?", "Select yes to reboot now or No to postpone") $msg = "" If $msg = 6 then MsgBox(4096, "reboot") Else MsgBox(4096, "NO reboot") EndIf
  9. I'm game. It's always better to know multiple ways to do something.
  10. Thanks.
  11. I need to use a script to import a .reg file. I tried the run command but that doesn't work, is there a way to use the reg file or am I going to have to make an entry for every reg key?
  12. Thanks for all the help. I couldn't have got it working without the help.
  13. I found this in another post and modified it some. Seems to work. Do you see anything wrong with doing it this way? Search ("c:", "APPSRV.ini");replace with your search directory and file extension required Func Search($current,$ext) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then If StringRight($current & "\" & $file,StringLen($ext)) = $ext then ;MsgBox (0, "Has the file extension " & $ext, $current & "\" & $file) ;this is where you do what you need to do FileDelete ($current & "\" & $file) Endif EndIf If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then Search($current & "\" & $file, $ext) EndIf WEnd FileClose($search) EndFunc Search ("c:", "PN.ini");replace with your search directory and file extension required Func Search2($current2,$ext2) Local $search2 = FileFindFirstFile($current2 & "\*.*") While 1 Dim $file2 = FileFindNextFile($search2) If @error Or StringLen($file2) < 1 Then ExitLoop If Not StringInStr(FileGetAttrib($current2 & "\" & $file2), "D") And ($file2 <> "." Or $file2 <> "..") Then If StringRight($current2 & "\" & $file2,StringLen($ext2)) = $ext2 then ;MsgBox (0, "Has the file extension " & $ext, $current & "\" & $file) ;this is where you do what you need to do FileDelete ($current2 & "\" & $file2) Endif EndIf If StringInStr(FileGetAttrib($current2 & "\" & $file2), "D") And ($file2 <> "." Or $file2 <> "..") Then Search($current2 & "\" & $file2, $ext2) EndIf WEnd FileClose($search2) EndFunc
  14. O.K. I still can't figure this out. I need to seach the whole hard drive for a file called APPSRV.ini and when it finds a copy of it I need to delete it. Is this possible to do?
  15. I need to search the whole hard drive. The same file exists in every users app data folder on the PC, so there could be 20 diffrent instances.
  16. I'm trying to do a search on the hard drive to delete a couple of files that resides in a couple of diffrent locations. The Locations change by username. I've tried the filefindfirst with filefindnext but it appears to want a specific path. I used the example from the help file as a start then I figured I could take out the message boxes when I got it, and I haven't started to try figure out the delete part of the script because I can't get it to find the file. I'm still a green at this forgive me. $search = FileFindFirstFile("APPSRV.ini") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) WEnd ; Close the search handle FileClose($search)
  17. I had two problems the first was %0 the second was the files I was overwriting were read only. I added setFileSetAttrib lines for them and now all is well. Thanks
  18. here is what I have ; START SCRIPT ;COPY FILES ;COPY PAL INI OVER ORIGINAL FILECOPY("%0\..\PAL.INI", "C:\PROGRAM FILES\PAL\", 1) ; COPY VPN IMAGES filecopy("%0\..\*.bmp", "C:\PROGRAM FILES\NORTEL NETWORKS\ICONS\", 1) ; START CYBER ARMOR CHANGES ; COPY SETTINGS FILES filecopy("%0\..\pcarm.ini", "C:\Program Files\CyberArmor\", 1) filecopy("%0\..\pcarmrt.ini", "C:\Program Files\CyberArmor\", 1) ; FINISHED WITH CYBER ARMOR the PAL ini copies but nothing else does, I have the script and all files in one folder that I'm pushing to a machine then executing the script from there.
  19. I can stop the service with _RUNDOS(NET STOP "CYBERGATEKEEPER AGENT") But the sc config command to disable the service does not work. I get the error sc is not internal or external
  20. ProcessClose("cgasvc.exe.exe") $PID = ProcessExists("cgasvc.exe.exe") ; Will return the PID or 0 if the process isn't found. If $PID Then ProcessClose($PID) this should work to end the process. but how do I set the startup type to disabled?
  21. I need to write a script to stop a service running on a pc and set it to disabled. Is this possible? if so what are the commands. I tried to look it up in the help file but couldn't find it.
  22. I installed the beta, added #incude <file.au3>, and copied the file.au3 from the beta folder to the 3.1 include folder and all is good. Thanks for all the help
  23. here is my code so far ; SET PATH FileChangeDir("C:\Program Files\Nortel Networks") ; SET VARIABLES $myfile = "baynet.tbk" $file = FileRead($myfile, FileGetSize($myfile)) $file = StringSplit($file, @CRLF, 1) ; NO FILE OPEN If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; IDENTIFY VALUE AND WRITE LINE for $i = 0 to $file[0] Step 1 If StringInStr($file[$i], "server=") Then _FileWritetoLine($myfile, $i, "my entry", 1) EndIf Next I pulled most of this from another similar post. I have two problems actually. 1st: the string to identify starts with server= but could have an ip or name after it that needs to be replaced with my data 2nd: _filewritetoline keeps causing an unknown function error I am running AutoIt v3
×
×
  • Create New...