
Jdr
Members-
Posts
17 -
Joined
-
Last visited
Jdr's Achievements

Seeker (1/7)
0
Reputation
-
Yes, that's what happens. Won't "While Not" miss the beginning when the file is there? How can I get around that?
-
Yes, I admit that's pretty fast, basically it's constantly checking for the file
-
Yes, I admit that's pretty fast, basically it's constantly checking for the file
-
I'm trying to check for the existance of a file, on logon the file is there, then gets deleted and after a while recreated. I'm using this code: Sleep(100) If not FileExists($sFile) Then Sleep(150) If FileExists($sFile) Then GUICtrlSendToDummy($iDummy) What happens is this: User logs on, the file is present, or at least it usually is After about 10 seconds the file gets deleted Then after about 50 seconds the file gets created again, this is when I need the check, because now the process is finished. The above code is part of a pretty long do....until false loop running an animation. The problem is that sometimes this code fails. Without the sleep statements it didn't work at all so I think this is a timing issue. Pretty primitive code I admit, there must be a better way...
-
Terminate program based on 2 conditions not working
Jdr replied to Jdr's topic in AutoIt General Help and Support
@JLogan3o13: I tested your WMI code anyhow just to see what was causing the delays. Turns out you were right, tasklist is messing things up. If I replace the tasklist code with the WMI code all works well as admin. Unfortunately I can't use WMI because the remote call gets executed under the user's security context and thus is restricted since these are users, not admins. I found out that instead of doing a remote tasklist call I can do 2 local checks for 2 different local processes. That was pretty easy and is now working. Thanks for the guidance! -
Terminate program based on 2 conditions not working
Jdr replied to Jdr's topic in AutoIt General Help and Support
After some thought I don't think the slow tasklist is causing the problems. ProcessWaitClose($DOS) says to wait till finished. And indeed the program did wait about 6 or 7 seconds until the debug messagebox appeared. Must be a wrong order or wrong logic -
Terminate program based on 2 conditions not working
Jdr replied to Jdr's topic in AutoIt General Help and Support
Sorry Wbem won't work because needs to run under the locally logged on user in a Citrix environment. There are security restrictions in place here. How can I let the program wait for tasklist eg 5 seconds. And what about the order of this code: $DOS = Run(@ComSpec & ' /c tasklist /S server1 /U server1\admin /P password /FI "USERNAME eq ' & @UserName & '" /FI "IMAGENAME eq calc*"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) Local $Proq = StringInStr($Message, "calc.exe") It's new, wasn't originally there. Neither was if $Proq > 1 Then So I modded the original version which only checked for a local version of calc.exe and worked fine. Didn't really know where to paste the new code. I have the feeling that the order or location of the code is not correct. -
Terminate program based on 2 conditions not working
Jdr replied to Jdr's topic in AutoIt General Help and Support
This is the output I get in the Messagebox when the local calc process is not running: $aPL[0][0] = 0, not $iAmountProcesses - 1 When the local calc and remote calc are running I get the 2nd message: $Proq = 159 The tasklist thing is pretty clumsy, needs about 5 seconds to return output. Could this be a timing problem? -
I' working on this code: ;coded by UEZ build 2014-02-08, idea taken from http://codepen.io/Fahrenheit/pen/Kbyxu ;AutoIt v3.3.9.21 or higher needed! #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global Const $STM_SETIMAGE = 0x0172; $IMAGE_BITMAP = 0 ;Global $iW = 1920, $iH = 1080 Global $iW = 920, $iH = 680 ;Global $Color_white = 0x3C3C3C3C Global Const $hGUI = GUICreate("One moment...", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global Const $iPic = GUICtrlCreatePic("", 650, 350, $iW, $iH) ;Global Const $iPic = GUICtrlCreatePic("", 250, 50, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) GUISetBkColor($Color_white) GUISetState() Global $hHBmp_BG, $hB, $iPerc = 0, $iSleep = 60, $s = 0, $t, $m = 0 GUIRegisterMsg($WM_TIMER, "PlayAnim") DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0) Global $DOS, $Message = '' ;; added "= ''" for show only. Global $sProcess = "calc.exe", $iDummy = GUICtrlCreateDummy(), $iAmountProcesses = 1 Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iDummy GUIRegisterMsg($WM_TIMER, "") _WinAPI_DeleteObject($hHBmp_BG) _GDIPlus_Shutdown() GUIDelete() Exit EndSwitch $aPL = ProcessList($sProcess) $DOS = Run(@ComSpec & ' /c tasklist /S server1 /U server1\admin /P password /FI "USERNAME eq ' & @UserName & '" /FI "IMAGENAME eq calc*"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) Local $Proq = StringInStr($Message, "calc.exe") If IsArray($aPL) Then If $aPL[0][0] > $iAmountProcesses - 1 Then if $Proq > 1 Then GUICtrlSendToDummy($iDummy) EndIf Else ;$iPerc = $aPL[0][0] / $iAmountProcesses * 100 EndIf EndIf Until False The code is longer but I haven't changed it beyond here so I only am listing this part. It's the nested if statement that I think is giving a problem: if $Proq > 1 then. The program brings up an animation. The animation has to keep running until both calc.exe processes are running: one on the local computer and one on the remote computer server1. Behavior now is that the animation never stops.
-
Syntax for embedding @username in tasklist command
Jdr replied to Jdr's topic in AutoIt General Help and Support
@Jos Wow, it works! Thank you so much -
I'm using this code: #include <Constants.au3> Global $DOS, $Message = '' ;; added "= ''" for show only. $DOS = Run(@ComSpec & " /c tasklist /S server1 /U server1\admin /P password /FI " "USERNAME" & "eq" & @UserName /FI ""IMAGENAME eq notep*""", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) MsgBox(0, "Stdout Read:", $Message) But I can't get the syntax right. The tasklist command from the commandline goes like this and works: tasklist /S server1 /U server1\admin /P password /FI "USERNAME eq user1" /FI "IMAGENAME eq notep*". So everything behind the FI parameter needs quotes. I'm using the @username macro to get the logged on user. But I just can't get the syntax right.
-
GDI+ animated loading screens build 2014-06-20 (32 examples)
Jdr replied to UEZ's topic in AutoIt Example Scripts
I am trying with this code to set the canvas to a different color, eg white: _GDIPlus_Startup() Global Const $STM_SETIMAGE = 0x0172; $IMAGE_BITMAP = 0 Global $COLOR_WHITE Global $iW = @DesktopWidth, $iH = @DesktopHeight Global Const $hGUI = GUICreate("Carousel", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global Const $iPic = GUICtrlCreatePic("", 400, 350, $iW, $iH) ;Global Const $iPic = GUICtrlCreatePic("", 400, 250, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) GUISetBkColor($COLOR_WHITE) GUISetState() However GUISetBkColor doesn't seem to work very well, despite color white, it actually gives a black canvas. In fact whatever color I put in, it always gives a black canvas. -
GDI+ animated loading screens build 2014-06-20 (32 examples)
Jdr replied to UEZ's topic in AutoIt Example Scripts
One more little thing, or actually 2 I'm using this as a loading screen that covers the desktop during logon. So I need it larger. However if I just change $iW and $iH to 1920 and 1080 the animation scales too. And consumes to many resources. So I changed the "canvas" to 1920 and 1080 and kept the animation at 600 and 300. However I'd also like to change the color of the canvas to a different color than the standard MsgBox light gray. For example white or blue. Couldn't get that to work. A second request would be not to use a fixed resolution of 1920 x 1080 but full screen.