Jump to content

Airwolf

Active Members
  • Posts

    420
  • Joined

  • Last visited

About Airwolf

  • Birthday 07/03/1984

Profile Information

  • Member Title
    Software Dev Engineer II @ Dell | Author
  • Location
    Saint Charles, MO
  • WWW
    http://www.oreilly.com/catalog/9780596515126/
  • Interests
    Programming, Video Games, Movies, DIY

Airwolf's Achievements

Universalist

Universalist (7/7)

5

Reputation

  1. Dexto is correct - there is a bug in UnixTimeStampToTime - it's off by 4 days. Rather than try to reinvent the wheel, I just used one line of code and the Date.au3 library to perform the conversion: #include <Date.au3> $time = _DateAdd("s",$UnixTimeStamp,"1970/01/01 00:00:00")
  2. I think you are misunderstanding the purpose of the flags. If you get the result you want with flag 2, why would you try a different flag? The flags will determine the output of the function.
  3. Not sure why, but this line - $html = StringReplace($text, "£", "&pound;") - is the culprit. AutoIT does not like that symbol. It is breaking the conversion process.
  4. Just use two conditions. While 1 If _IsPressed("A2",$hDLL) AND _IsPressed("41",$hDLL) Then ; Do Stuff EndIf WEnd
  5. Look at _IsPressed() in the help document. You can use a loop to determine the threshold in which you want something to happen.
  6. I've never been a fan of using keyboard or mouse input during installation routines, as a user will always figure out a way to interrupt the script. Is there a silent installation command for the application? If not, is there any identifiable progress bar text that stays constant or is it just a blank progress bar? If there is something like "Installing..." on the progress bar, you could always identify the window by WinExists("Groove Virtual Office","Installing...").
  7. I'm missing the problem. Does it not work if you get rid of the Sleep(36000) and just have it wait for the 3rd window? Identifying the 2nd is not necessary if it disappears before the 3rd spawns. You also don't want to sleep for 36 seconds inside of a loop. You should set the sleep to 250 or 500ms, otherwise you've got a potential 36 second wait before that loop exits when the window no longer exists.
  8. I just tested your script on my XP SP3 box, and resizing was instantaneous.
  9. This is a visualization of what a For...Next loop does: N 1 2 3 4 5 6 7 8 9 10 If you have a loop For $N = 1 To 10, then it will move down the line until it hits 10 - you know, $N = 1 then 2 then 3 then 4, and so on.
  10. Select...Case still won't be as efficient as a For...Next loop. That's what I meant earlier when I was talking about using a database. Good constructive feedback, Reaper.
  11. For the record, I don't think your code is very "sloppy". It may be a little more simplistic, and therefore lengthy, than it could be... but the structure isn't bad.
  12. Correct - if they are declared Dim or Local (if you don't specify, Dim is default - which is local when inside a function). If you declare a variable globally, you can change it inside functions. Just try to stay away from declaring global variables inside of functions - that can cause problems. It actually looks like you may be better off keeping a lot of the string data in a database. You could then pull the data out based on the database structure. I see a lot of repetition with string variables such as "Royal Gardens Cypress 2 CuFt". You can simply create an XLS document and pull the data out with the ExcelCOM UDF library - this would cleanup the code quite a bit. You'll still need to grasp the For...Next concept. I know it's frustrating, but try reading through the help documentation and searching around the forums for examples. I'd cleanup the code for you, but I don't have enough time on my hands at the moment.
  13. Read up on arrays and loop statements (For...To...Step...Next, While...WEnd, Do...Until) in the help file. You can get rid of the repetitive If statements by looping through an array of variables with a single If statement inside the loop.
  14. Then the rest of your code isn't calling the function properly. Try this - you will see a message box stating "5": MsgBox(0,"",getUpcGeneralCheck(5)) Func getUpcGeneralCheck($digits) Dim $i, $checkSum, $strLen, $getUpcGeneralCheck $strLen = StringLen($digits) For $i = 1 To $strLen If Mod($i, 2) = 1 Then $checkSum = $checkSum + Int(StringMid($digits, ($strLen - $i + 1), 1)) * 3 Else $checkSum = $checkSum + Int(StringMid($digits, ($strLen - $i + 1), 1)) EndIf Next $getUpcGeneralCheck = Mod($checkSum, 10) If $getUpcGeneralCheck <> 0 Then $getUpcGeneralCheck = 10 - $getUpcGeneralCheck Return $getUpcGeneralCheck EndFunc
  15. Here's my AutoIt-ified version of what I believe this function is doing: Func getUpcGeneralCheck($digits) Dim $i, $checkSum, $strLen, $getUpcGeneralCheck $strLen = StringLen($digits) For $i = 1 To $strLen If Mod($i, 2) = 1 Then $checkSum = $checkSum + Int(StringMid($digits, ($strLen - $i + 1), 1)) * 3 Else $checkSum = $checkSum + Int(StringMid($digits, ($strLen - $i + 1), 1)) EndIf Next $getUpcGeneralCheck = Mod($checkSum, 10) If $getUpcGeneralCheck <> 0 Then $getUpcGeneralCheck = 10 - $getUpcGeneralCheck Return $getUpcGeneralCheck EndFunc
×
×
  • Create New...