Jump to content

fu2m8

Active Members
  • Posts

    79
  • Joined

  • Last visited

fu2m8's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. You could probably use something like _FileReadToArray with a loop to do what your after. #include <File.au3> Dim $lines $search = InputBox("Enter Search String", "Enter the string your looking for...") _FileReadToArray(@ScriptDir & "\testFile.txt", $lines) ;<-- needs a file called testFile.txt in the same directory as the script For $x = 1 To $lines[0] ;loops through each line in the text file If StringInStr($lines[$x], $search) Then ;reads each line of the file for the search MsgBox(64, "Match Found", "Found a match on line " & $x & ". The line is: " & @CRLF & $lines[$x]) ;prompt showing line number and full line EndIf Next
  2. Definately doable but not up to par with bash myself (not yet ). Plenty of bash scripting resources out there though and my fav atm is http://linuxcommand.org/ might have something useful to get you started.
  3. Try checking out the registry keys located under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall sometimes there'll be an uninstall string for your particular app here.
  4. Hmm i know the Irfanview image freeware app lets you make an .exe file from a list of images. Not sure how secure these are. Maybe you could use it in conjunction with an AutoIT script to stop print screen being pressed or something along those lines.
  5. a few more examples: $userTempPath = EnvGet("TEMP") ;stores the users temp directory i.e C:\Documents and Settings\username\Local Settings\temp MsgBox(0, "Example 1", "Users temp path is: " & $userTempPath) ;example 1 using a variable MsgBox(0, "Example 2", "Your computer name is: " & EnvGet("COMPUTERNAME")) ;example 2 calling the function directly DirCreate($userTempPath & "\test123") ;creates a folder called test123 under the users temp directory
  6. EnvGet is what your after I think assuming by system you mean environment variables. Copied from the helpfile: $var = EnvGet("PATH") MsgBox(4096, "Path variable is:", $var)
  7. hmm thought i was getting the same thing as you originally but I just ran the following and line 3 (i.e the one starting with 2: ...) seemed to have the correct output. Running v3.2.4.0 . I may have misunderstood what links you were after which is why i took out the help file related ones in the script I posted above. This version should return 351 links. #include <IE.au3> Dim $oIE = _IECreate ("http://www.trade-ideas.com/SingleAlertType/SD/Offer_stepping_down.html", 0, 0, 1, -1) $oTable = _IETableGetCollection($oIE, 4) $oLinks = _IETagNameGetCollection($oTable, "a") $iNumLinks = @extended Dim $strLinks = "", $i = 0 For $oLink In $oLinks ; If StringInStr($oLink.href, "http://www.trade-ideas.com/SingleAlertType") Then $strLinks &= $i & ": " & $oLink.href & @LF $i += 1 ; ConsoleWrite("Match Found - " & $oLink.outerText & " : " & $oLink.href & @LF) ;EndIf Next MsgBox(0, 0, $strLinks) ConsoleWrite("TOTAL MATCHING LINKS FOUND: " & $i & @LF) Good luck with it
  8. hey not sure if i understood what you meant but the following seems to be close to what your after: #include <IE.au3> HttpSetProxy(0) Dim $oIE = _IECreate ("http://www.trade-ideas.com/SingleAlertType/SD/Offer_stepping_down.html", 0, 0, 1, -1) $oTable = _IETableGetCollection($oIE, 4) $oLinks = _IETagNameGetCollection($oTable, "a") $iNumLinks = @extended Dim $strLinks = "", $i = 0 For $oLink In $oLinks If StringInStr($oLink.href, "http://www.trade-ideas.com/SingleAlertType") Then ;checks the link to make sure its one of the proper links not the help file ones $strLinks &= $i & ": " & $oLink.href $i += 1 ConsoleWrite("Match Found - " & $oLink.outerText & " : " & $oLink.href & @LF) EndIf Next ConsoleWrite("TOTAL MATCHING LINKS FOUND: " & $i & @LF) Was it just the middle column links that you were after in that table? The above code returns 175 links which seems pretty close.
  9. Thanks I overlooked ProcessList this seems to be a much better way of doing it! Now i just gotta work out a way of tracking how long each process has been open for and closing it if it goes over a certain time. Hopefully should get a chance to play with this a bit more today.
  10. Hmm think i may be getting a bit closer the following code will keep 3 instances of notepad open (as long as they aren't closed to fast). I think one of the problems may have been I never updated the test condition in the loop. I've never had to iterate through an array backwards before. How would it help me out here? I'm guessing it just works the same way but i would start the loop at Ubound($arrayPID) - 1 and the step would be -1? #include <Array.au3> Dim $arrayPID[1] For $i = 1 To 10 $localPID = Run("notepad.exe") ;ConsoleWrite($localPID & @LF) _ArrayAdd($arrayPID, $localPID) $test = UBound($arrayPID) - 1 ConsoleWrite($test & @LF) While $test >= 3 Sleep(1000) For $x = 1 To UBound($arrayPID) - 1 If ProcessExists($arrayPID[$x]) Then ;ConsoleWrite($arrayPID[$x] & " - Exists" & @LF) Else ;ConsoleWrite($arrayPID[$x] & " - Doesnt Exist" & @LF) _ArrayDelete($arrayPID, $x) EndIf Next $test = UBound($arrayPID) - 1 WEnd Next
  11. Hey All, I was wondering if anyone might have any suggestions for a script I'm trying to improve at work. Long story short I have Script A that will ping a certain range of IP addresses if a ping is successful it then runs the remote execuatable program psexec to that IP address which copies another AutoIT script (Script B ) that does some auditing information on that machine and then copies the .txt files it generates back to the workstation Script A was run from. For the most part this works great however for some reason psexec sometimes seems to just sit there doing nothing and the script will continue to wait for psexec to finish before continuing to audit the next machine (i was originally using RunWait() on psexec with a For loop, looping through each machine). I was hoping to come up with a way where I could instead open several instances of psexec (say 8 at once) using Run() and then let the script sit there till less than 8 instances of psexec exist and if less than 8 exist start auditing another machine. Ideally if a process has existed for to long that process should be terminated freeing up another spot for another psexec process to start up. So far i've got rough code that is trying to create an array of PID's for each instance and pause it if the number of elements are greater than 3 (3 for testing) but it keeps crashing out with array subscripts dimensions exceeded and I think it's because im either trying to delete an element (a PID that has finished) that isn't there or loop through the wrong number of elements but I'm not to sure. I'm pretty sure i might be turning this into something that is harder than it should be so if anyone has any ideas on how to do this more simply/efficiently it would be greatly appreciated. Here's what I have so far (relevant stuff): For $i = 1 To 8 ;will ping IP address from 1 to 8 in the given subnet $pingtest = Ping($subnet & "." & $i, 200) ;pings the subnet and value of $i which will be each host IP to try, and will wait 200 milliseconds for a response If $pingtest Then ;means the ping was successful $localPID = Run("C:\Audit\psexec.exe \\" & $subnet & "." & $i & " -u " & $SOE2user & " -p " & $SOE2pass & " -n 90 -c C:\Audit\localaudit.exe " & @IPAddress1 & " " & $subnet) _ArrayAdd($arrayPID, $localPID) $test = UBound($arrayPID) - 1 While $test > 3 Sleep(3000) For $x = 1 To UBound($arrayPID) - 1 If ProcessExists($arrayPID[$x]) Then ConsoleWrite($arrayPID[$x] & " - Exists" & @LF) Else ConsoleWrite($arrayPID[$x] & " - Doesnt Exist" & @LF) _ArrayDelete($arrayPID, $x) EndIf Next WEnd EndIf Next ;goes and tries the next IP address
  12. May need more info or example scripts to see what you've done but you could use something like _FileListToArray to retrieve an array of your shortcuts and do something with it from there. #Include <File.au3> #Include <Array.au3> $shortCuts = _FileListToArray(@ScriptDir, "*.lnk", 1) If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($shortCuts, "$shortCuts") I didn't follow what you wanted to do with the $var stuff.
  13. Check out the following Registry Key HKEY_USERS\.DEFAULT\Control Panel\Desktop - Wallpaper and see if theres a value in there, a lot of companies use that to set the background picture before a user logs in (also shows up if you ctrl + alt + del but probably wouldnt do that on home/single machine) sounds like something may be set there.
  14. Check out TimerInit and TimerDiff in the Helpfile. Pretty sure thats what your after. The following example just moves the mouse back and forth for 5 seconds. $begin = TimerInit() $timeToDoIt = 5000 ;time in Milliseconds to run for Do ;actions to do MouseMove(50, 100, 5) MouseMove(500, 100, 5) $dif = TimerDiff($begin) Until $dif >= $timeToDoIt
×
×
  • Create New...