Recently Browsing 0 members
No registered users viewing this page.
so right now i have a small project and i wanted to print this text out every second.
i have made a random number for the sleep function. but when i want to print out with the while loop it just doesn't work.
Run("notepad.exe") Sleep(1000) Local $rndSleep = Int (Random(180000,240000,1000)) While $rndSleep <> 0 $rndSleep - 1 If Mod ( $rndSleep, 1000 ) == 0 Then Send("This note will show the sleeptime before closing the tabs, you got " & $rndSleep & " seconds left.") EndIf WEnd plis halp me
Basically i am trying to make a script that detects if the currently active window is 1920 x 1080 or bigger. If it detects a window that is active, that is indeed that size. It will do some stuff.
The problem i am having is that it is detecting my desktop whenever i click on my desktop, so it's doing stuff when i don't want it to.
So all i need to know, is how can i do a simple check to see if a window = a title.
Here is what i have so far
$wintitledesktop = WinGetTitle("[ACTIVE]") If not $wintitledesktop = "Program Manager" Then ;does stuff endif Program Manager is what my desktop is called btw.
The problem with that code is that the script is still detecting the desktop and doing the code.
In case you need the whole section of the code, here it is.
$winsizecheck1 = WinGetClientSize("[ACTIVE]") $wintitledesktop = WinGetTitle("[ACTIVE]") If WinActive("[ACTIVE]") Then sleep(100) If $winsizecheck1 >= 1920 Then If $winsizecheck1 >= 1080 Then If not $wintitledesktop = "Program Manager" Then $gamesfolderstate = WinGetState($gamesfolder) If WinExists($gamesfolder) Then If Not BitAND($gamesfolderstate, 16) Then WinSetState($gamesfolder,"",@SW_MINIMIZE) EndIf EndIf EndIf EndIf EndIf EndIf
Don't you just love it when a regular expression comes out on top?! I know I do..
Local $hTimer = 0 $hTimer = TimerInit() For $i = 1 To 10000 _IsSystemDrive_Test_1('C') Next ConsoleWrite(TimerDiff($hTimer) & @CRLF) $hTimer = TimerInit() For $i = 1 To 10000 _IsSystemDrive_Test_2('C') Next ConsoleWrite(TimerDiff($hTimer) & @CRLF) Func _IsSystemDrive_Test_1($sDrive) Local $aArray = [@HomeDrive, _ @ProgramFilesDir, _ @SystemDir, _ @WindowsDir] For $sFilePath In $aArray If StringLeft($sFilePath, 1) = $sDrive Then Return True EndIf Next Return False EndFunc ;==>_IsSystemDrive Func _IsSystemDrive_Test_2($sDrive) Return StringRegExp(@HomeDrive & '|' & @ProgramFilesDir & '|' & @SystemDir & '|' & @WindowsDir, '(?<=^|\|)(?:' & $sDrive & ')') = 1 EndFunc ;==>_IsSystemDrive I am no expert at regular expressions, but what I have managed to learn has proved very useful over the last couple of years.
I´m getting mixed up!
What´s the difference between:
While NOT Func1() AND Func2() and
While NOT Func1() AND NOT Func2() ??
I´m using lots of these and it works find,
but now that I´m rewriting my script I´m mixing things up and getting unsure.