Jump to content

Bartokv

Active Members
  • Posts

    163
  • Joined

  • Last visited

Everything posted by Bartokv

  1. What kind of information are you wanting to get from the comspec window? Most DOS commands allow redirecting to a file or pipe, so it may be easier to just dump the output to a log file. I'd actually recommend redirection over screen-scrapes, since some apps may flush/overwrite the current screen. ...Just something to keep in mind.
  2. I'm not sure why you'd want the script to never end, but since most of the code is repetative I'd probably do something like the following: Dim $colors = StringSplit("D098B0,0085EC,B5B3B3,22AC53,C0FFFF,43F0FF,FF3737,FF8965,03AF03,D4D0C8",",") Dim $flag = 0 WinWaitActive("Shimlar - Microsoft Internet Explorer") While 1; This routine will never end... PixelSearch ( 493, 262, 691, 283, 0x00FF50, 1 ) If Not @error Then Sleep(4500) MouseClick("left", 544, 271 ) $flag = 1 Else MouseClick("left", 780, 168 ) Sleep(2000) For $i = 1 to (ubound($colors) - 1) PixelSearch ( 518, 208, 821, 825, 0x & $colors[$i], 1 ) If Not @error Then $flag = 1 ExitLoop Else Sleep(100) EndIf Next EndIf If ($flag = 1) Then Sleep(4500) MouseClick("left", 780, 168 ) Sleep(5500) MouseClick("left", 594, 195 ) $flag = 0 EndIf WEnd You could also place all of the search colors/areas within different arrays and make the code even more compact. Please keep in mind that this code has not been tested, and I'm a little rusty with AutoIt script as of late. Hope this helps!
  3. My post was just provided as an fyi to fabio's request for help within the Windows NT environment. I wanted to provide an example that I have used with great success within the NT, 2000, and XP environments.
  4. I've noticed that on a few different platforms that the IE browser executable "iexplore.exe" doesn't always reside within the system paths. So calling "iexplore http://www.google.com" doesn't always work. Likewise, URL formatting isn't always recognized by all mime-type librarys; so using a url by itself will also occasionally result in an error. Just FYI...
  5. The standard input statement allows a default value to be specified. If you're wanting to have a custom input box with a different look, then you'd need to create your own with AutoIt GUI. I made an example script for another user a few weeks back that may prove helpful. I didn't really worry about error-checking the date format, so there's some bugs around the logic - however feel free to take a look at the post. Hope this helps!
  6. Another way is to use the computer's registered browser: $Browser = "rundll32 url.dll,FileProtocolHandler" $URL = "http://www.google.com" $Launch = "START /MIN " & $Browser & " " & $URL Run(@ComSpec & " /c " & Chr(34) & $Launch & Chr(34), "", @SW_HIDE)
  7. AWicons Lite is a great Freeware icon editor. Here's the homepage.
  8. My recommendation would be to go to the logitec website and download the correct drivers for the device. Their drivers may have an auto-correct feature to handle the changing environmental noise levels. (Or a way to disable the feature all together.) You could build a policing script that monitors the registry values for the microphone volume and ensure that they're changed back to a preset (of your choosing) after a second delay... But this method isn't recommended, and may have some undesired effects.
  9. Check the following key: HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics Hope this helps!
  10. I could be wrong, but I don't believe that AutoIt supports multi-threaded processes. ...At least not the current stable release.
  11. Since you're using Symantec Antivirus, I'm assuming that you have administrator rights on the system. There is another package called Symantec System Center that allows system administrators the ablity to create, deploy, and lock down security features so that your users are not able to change the configuration settings. Hope this helps! Edit: ( Symantec AntiVirus Features)
  12. These other keys will also help to lock the system down a bit more: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer] "NoActiveDesktopChanges"=dword:00000001 "NoSetActiveDesktop"=dword:00000001 "NoNetHood"=dword:00000001 "NoFind"=dword:00000001 "NoRun"=dword:00000001 "NoChangeStartMenu"=dword:00000001 "NoFolderOptions"=dword:00000001 "NoRecentDocsMenu"=dword:00000001 "NoRecentDocsHistory"=dword:00000001 "NoSetTaskbar"=dword:00000001 "NoTrayContextMenu"=dword:00000001 "NoFileMenu"=dword:00000001 "NoViewContextMenu"=dword:00000001 "NoMSAppLogo5ChannelNotify"=dword:00000001 ...Although these keys help to secure the system, please keep in mind that some would-be attackers are very determined and could still gain control of the box. It would also help to make sure that people don't have physical access to the power cord, floppy/cd drives, or USB/network ports on the system. BTW: Good job on the script!
  13. My bad.. Sorry for being an idiot.
  14. Sounds like a good idea... But to be honest, I'm having a little difficulty understaning how this could be accomplished for a complied script (without significan bloat).
  15. The #include statement does not include another script for execution... (Run may be used to launch compiled scripts.) When you #include "somefile.au3", you are basically telling your script to look within "somefile.au3" when you reference a function that is not defined within the current file. If the referenced function resides within the "somefile.au3" file, then it will call that routine instead of throwing an error. The #include functionality allows you to build your own User Defined Library (UDF) of common functions so that you don't have to keep adding the same code snippets to each new script. The help file contains examples for most commands/statements, and additional examples may be found within the FAQ area of the help file. You could also browse the v3 Scripts and Scraps area on this site, or Search the forums for related topics. Hope this helps!
  16. It's been a while since I've used v2, but I believe that you may specify "" (two double quotes) for the value parameter to obtain the key name. You may also try using Sysinternal's RegMon, or TianWei's RegShot to help spot the keys in question. I belive that no further development plans are slated for AutoIt v2, so I'd also recommend checking into AutoIt v3. I find Version 3 a lot easier to code, as well as more powerful. Anyway, I hope this helps!
  17. I'm not sure that I completely understand your question. I'm assuming that Send is unable to pass the specified text, while ControlSetText is able to. Some characters have special meaning within the Send command, and this may be what is causing the problem. I would suggest reviewing the Send command syntax within the help documentation. Don't forget that you can also wrap braces ({ and }) around all characters within the Send command, and you could also specify the ASCII value: Send("{" & Chr(65) & "}") Hope this helps.
  18. Try adding a Sleep command after each MsgBox line. This will help to prevent the script from running too fast after the MsgBox lines are commented/removed. You may need to tweak the values, but 500 should be a safe bet.
  19. Here's a slightly more complicated script for three values: ; Define some variables Dim $AppTitle="My App" Dim $Default="Some text" Dim $IniFile=@ScriptDir & "\MyFile.INI" Dim $IniText[4] For $count = 1 To 3 ; Prompt user for text $Value = InputBox($AppTitle, "Please enter some text below:", $Default, "", -1, -1, -1, -1, 10) ;Write data to INI file IniWrite($IniFile, $AppTitle, "Text" & $count, $Value) Next For $count = 1 To 3 ;Read data from INI file $IniText[$count] = Chr(34) & IniRead($IniFile, $AppTitle, "Text" & $count, "Not value specified") & Chr(34) Next ; Display results MsgBox(4096, $AppTitle, "Values entered: " & @CR & $IniText[1] & @CR & $IniText[2] & @CR & $IniText[3])
  20. Ah, then perhaps your best/easiest way would be to use an INI file. (The registry is also a good alternative, but isn't recommended for the inexperienced...) Here's a very simple example: ; Define some variables Dim $AppTitle="My App" Dim $Default="Some text" Dim $IniFile=@ScriptDir & "\MyFile.INI" ; Prompt user for text $Value = InputBox($AppTitle, "Please enter some text below:", $Default, "", -1, -1, -1, -1, 10) ;Write data to INI file IniWrite($IniFile, $AppTitle, "Text", $Value) ;Read data from INI file $IniText = IniRead($IniFile, $AppTitle, "Text", "Not value specified") ; Display results MsgBox(4096, $AppTitle, "Value entered: " & Chr(34) & $IniText & Chr(34)) ExitHope this helps!
  21. There are several ways to pass information from one program to another: ini files, registry values, command-line arguments, environmental variables, etc. If both programs are called within the same comspec environment (ie: from a batch file) you could also use environmental variables, or errorlevels. I can't really say that one way is better than another without knowing how much information you're wanting to pass, and how you're calling/using each program. Describe your situation a little more, and we may be able to help.
  22. I had to go with probably, even though I'd love to say yes... The big-wigs of my Corporation refuse to recognize AutoIt as a viable programming/scripting environment, despite the fact that I've repeatedly pointed out the advantages of using it. I have the feeling that AutoIt will run into similar opposition from all of the other know-nothing PHB's (pointy-haired-bosses) that are in charge of most work environments.
  23. AutoIt will stop execution whenever a message box or input box is displayed. However, you may specify a timeout like in my example below: $string = "Sample text" $text = InputBox("Window Title", "Enter some text below.", $string, "", -1, -1, -1, -1, 5) MsgBox(4096, "Message", "You entered: " & Chr(34) & $text & Chr(34)) (The -1 values tell the command to use the default options) Hope this helps!
  24. Sorry, I forgot to throw in comments... StringStripCR removes all carriage return characters from a given string. The script would still technically work, although the output could contain an extra blank line after each entry. If you have questions over any of the other commands, feel free to check out the help file for more detailed information: $HelpDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\HiddenSoft\AutoIt3", "InstallDir") If $HelpDir = "" Then ShowError() $HelpFile = Chr(34) & "START " & $HelpDir & "\AutoIt.chm" & Chr(34) Run(@ComSpec & " /c " & $HelpFile) Exit Func ShowError() MsgBox(48, "Help File", "Unable to determine AutoIt install path.") Exit EndFunc
  25. If the script isn't too big, post what you have made so far within this thread and we'll try to help. FYI: Keeping all relevant posts within the same original thread also helps some with following issue continuity. Also, don't get too bogged down with loops. Remember that you can create and call functions from within themselves, and/or other functions. I find it useful to create a variable that I can use as a flag when I find something... Then if the flag is set, each loop/function will know to exit without wasting more ticks. I've also thrown together some snippets from the help doc to make the following example for you: Dim $UserList[1] $DataFile = "names.txt" ScanFile($DataFile) $Output = "" For $user = 1 to (Ubound($UserList) - 1) $Output = $Output & $UserList[$user] & @CR Next MsgBox(4096, "User List", $Output) Exit ; Generates a listing of unique names Func Check($name) $Found = 0 $Len = Ubound($UserList) - 1 For $pos = 1 to $Len If StringInStr($UserList[$pos], $name) Then $Found = $pos ExitLoop EndIf Next If $Found = 0 Then $NewDim = $Len + 1 ReDim $UserList[$NewDim + 1] $UserList[$NewDim] = $name EndIf EndFunc ; Opens a file, and passes each line to Check() Func ScanFile($FileName) $file = FileOpen($FileName, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop Check(StringStripCR($line)) Wend FileClose($file) EndFunc Hope this helps! Edit: Oops... Didn't see the last post when I started working on this one.
×
×
  • Create New...