Jump to content

Ravel

Active Members
  • Posts

    159
  • Joined

  • Last visited

Everything posted by Ravel

  1. Where do I find that?
  2. I trying to set up a simple filemove script that will allow me to move all files of a certain extention to from multiple destinations, and consolidate them in one destination i.e. a folder. example e:\(multiple files and folders) move the extention .txt(out of those folders in the E: drive) to a new folder named Text files. (either still on the E: drive or deposited elsewhere F: H: etc.) I have searched the forums, and most scripts that I have found are way to advanced for me. I have no problem moving folders in the top directory, but I want it to search the subdirectories too; and move them accordingly. Any help would be appreciated. Thanks.
  3. Yes I understand everything that you are saying. But what I am trying to explain is that I used the example code you provided, and it did not do what I wanted it to do. It did not respond the way you are saying. When the code was run it immediately locked the PC if the dllcall was inside the loop. If I placed it outside the loop it ran the screensaver and then when I pressed a button it locked the PC. But it would then end the script, and I would have to restart the script. The way that it is written the way I had it, it worked the way I wanted. The way I explained before. I am not saying your way didn't work... It did, but it was not the outcome that I wanted. It helped me arrive at the outcome that I wanted which is what i think the point of all of this is right?
  4. i dont want the loop to end. I want it to continue. I just want it to lock the pc and when I come back I unlock the pc and it waits for the pc to become idle again and then it will lock.... a continuous loop is what I was looking for. Check it out for yourself... you will see what I was referring too. the old tick and new tick are to start the timer on how long the pc has been idle since the screensaver has been activated. Not because once the screensaver has been activated the computer is in a idle state. when I come back and move the mouse or press a button the computer is no longer idle and then locks... basically making sure that my computer is secured.
  5. Ok this worked the way it wanted it to: HotKeySet("{Esc}", "_Quit") Global $oldtick=_Timer_GetIdleTime() Global $newtick=0 While Sleep(250) $idleTime = _Timer_GetIdleTime() If $idleTime >= 5000 Then ShellExecuteWait(@SystemDir & "\PhotoScreensaver.scr") DllCall("User32.dll","none","LockWorkStation") EndIf $newtick=_Timer_GetIdleTime() If $newtick<$oldtick Then $oldtick=$newtick EndIf WEnd DllCall("User32.dll","none","LockWorkStation") Func _Timer_GetIdleTime() ; Get ticks at last activity Local $tStruct = DllStructCreate("uint;dword"); DllStructSetData($tStruct, 1, DllStructGetSize($tStruct)); DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($tStruct)) ; Get current ticks since last restart Local $avTicks = DllCall("Kernel32.dll", "int", "GetTickCount") ; Return time since last activity, in ticks (approx milliseconds) Local $iDiff = $avTicks[0] - DllStructGetData($tStruct, 2) If $iDiff >= 0 Then ; Normal return Return $iDiff Else ; Rollover of ticks counter has occured Return SetError(0, 1, $avTicks[0]) EndIf EndFunc;==>_Timer_GetIdleTime Func _Quit() Exit EndFunc Thanks for everyones help!
  6. I didnt use the #include timers, so I am not sure if $tick will work... maybe I need include timers.au3 and take out the func _timer...
  7. this is what I have cobbled together: Global $Tick HotKeySet("{ESC}", "_Quit") While Sleep(250) $idleTime = _Timer_GetIdleTime() If $idleTime >= 5000 Then ShellExecuteWait(@SystemDir & "\PhotoScreensaver.scr"); run screensaver $tick=_Timer_GetIdleTime() EndIf if _Timer_GetIdleTime() < $tick And ProcessExists("PhotoScreensaver.scr") Then ProcessWait ("PhotoScreensaver.scr") tooltip ("console locked"); Lock console DllCall("User32.dll","none","LockWorkStation") EndIf Sleep(100) WEnd Func _Timer_GetIdleTime() ; Get ticks at last activity Local $tStruct = DllStructCreate("uint;dword"); DllStructSetData($tStruct, 1, DllStructGetSize($tStruct)); DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($tStruct)) ; Get current ticks since last restart Local $avTicks = DllCall("Kernel32.dll", "int", "GetTickCount") ; Return time since last activity, in ticks (approx milliseconds) Local $iDiff = $avTicks[0] - DllStructGetData($tStruct, 2) If $iDiff >= 0 Then ; Normal return Return $iDiff Else ; Rollover of ticks counter has occured Return SetError(0, 1, $avTicks[0]) EndIf EndFunc;==>_Timer_GetIdleTime Func _Quit() Exit EndFunc I havent tested was wondering if you can look it over first. Although I am not sure if the screensaver process actually shows up as "photoscreensaver.scr" if it doesnt then it wont matter about the processwait or processexist commands right?
  8. Cool yea that is what I realized after I saw the wait portion of the command. it worked like a charm... the only other question I had was that can i get this to recognize when the mouse is moved and then immediately send the lock command? I should add that this is the google screensaver which allows you to move the mouse and the screensaver doesnt shut off, however you can use the mouse to click exit screensaver which would then allow you to gain access to the pc
  9. Wont that code send the lock as well as start the screensaver, after the prescribed idle time has elapsed, at the same time? I think that is what I am interpreting from the code... Thats not how I want it to work.... I would like the screensaver to run until the system is no longer idle.... ie a key or button press and then the script.... sensing that.... sends the lock command. *EDIT*um wait let me see I just noticed that it was shellexecutewait and not just shellexecute. Let me try and get back to you.
  10. K I looked at the last one... and when I move the mouse it locks... good. thats what I want for that end. Now what I would like to do is have that same ending... only the script will run continuously.... starting the screensaver every time the PC is idle for a predetermined amount of time. then upon moving mouse or pressing the key board the script then sends the command to lock the pc. If the PC is locked the script stays in a paused state until I unlock it at which time it would go back to the beginning and start the process over. I am not sure if using something like the following code can work in this situation. I am in the realm of not really understanding how to get these things to work together. Please let me know if you understand what I am referring to (disregard the "messages" i dont need those this is an excerpt from another script) While 1 Sleep(1000) If _isWorksatationLocked() Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - " & "workstation locked" & @CRLF) WEnd Func _isWorksatationLocked() If StringInStr(WinGetText(""), "Program Manager") <> 0 And WinGetTitle("") = "" Then Return 1 Return 0 EndFunc;==>_isWorksatationLocked This way if it senses the workstation is locked... it can pause the script until the workstation is unlocked and resume at the beginning waiting again for the computer to be idle and then -----> start screensaver------> wait for movement/keypress ------> if movement found i.e. no longer idle------> lock workstation-----> wait for workstation to become unlocked-----> start over. This um is basically away to sercumvent the locked windows version screensaver that is currently the default for my work PC. This would allow me to use my own screensaver/lock mechanism and actually adjust the timers. Because We cant do that at work.
  11. That looks like what I am referring to. Let me try it out... Ill let you know...
  12. I wonder is there a way to set this up to were the script just pauses until the computer is "no longer idle" and then lock. That way just forgoing the processwait command altogether since I cannot verify the process that is running.
  13. I think the issue is in this line where it is looking for the idletick... What I want is to have the screensaver run until a key is pressed or the mouse is moved. If neither is interacted with then the screensaver should keep going. ie the script is paused i guess. if _Timer_GetIdleTime() < $tick And ProcessExists("PhotoScreensaver.scr") Then ProcessWait ("PhotoScreensaver.scr") tooltip ("test"); Lock console Maybe it isnt recognizing the processwait command? if photoscreensaver.scr isnt the actual process then the processwait is probably not working. The problem is I dont know how to verify the process name.
  14. Ok I tried testing it, but the screensaver started but then quit and when right to locking the pc. So I must be missing something here. It also just continued opening the screensaver repeatedly and almost locked up the pc.
  15. Cool I will test it out. Thanks.
  16. K cool. that converter.exe is pretty much a place holder. What I have been having trouble with is finding out what the actual process name is for the screensaver. Because the process only exists when the screensaver is active, but of course in order to see the process I have to deactivate the screensaver. Do you have any ideas on how to determine the process? Is it just the name of the screensaver? The name is photoscreensaver.scr.
  17. Thanks I dont think thought that that will work because I want this to be automatic. I dont need to close the screensaver it will do that itself automatically. I just need to have the screensaver start automatically when the pc is idle... i.e. no key or mouse movement... and then when the mouse is moved or a key is pressed the computer automatically locks.
  18. Can anyone help me with the following script. I am trying to use this to run a screensaver after the computer has been idle for a set amount of time. After that set amount of time it starts the screensaver.... what I would like it to do also is when i return to the computer to and move the mouse or press a key it automatically locks the PC. This is for windows vista if that helps. Thanks for the help. Global $fLocked = False HotKeySet("{ESC}", "_Quit") While 1 If _Timer_GetIdleTime() = 10000 Then Run ("C:\Users\ATCALS Maintenance\Desktop\Converter.exe"); run screensaver EndIf if _Timer_GetIdleTime() < 10000 Then ProcessWait ("Converter.exe") tooltip ("test"); Lock console EndIf Sleep(100) WEnd Func _Timer_GetIdleTime() ; Get ticks at last activity Local $tStruct = DllStructCreate("uint;dword"); DllStructSetData($tStruct, 1, DllStructGetSize($tStruct)); DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($tStruct)) ; Get current ticks since last restart Local $avTicks = DllCall("Kernel32.dll", "int", "GetTickCount") ; Return time since last activity, in ticks (approx milliseconds) Local $iDiff = $avTicks[0] - DllStructGetData($tStruct, 2) If $iDiff >= 0 Then ; Normal return Return $iDiff Else ; Rollover of ticks counter has occured Return SetError(0, 1, $avTicks[0]) EndIf EndFunc ;==>_Timer_GetIdleTime Func _Quit() Exit EndFunc
  19. Yea kerros was right I was just using that date as an example. But Either way I appreciate the help. I was able to discern what I needed from what you all provided. Thanks again!
  20. you mean like: $Count += 1 $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then Exit EndIf _FileWriteLog(); placing it here? FileClose($file)
  21. I am interested in having auto it write a line to a file such as "crashed at blah blah time" send an enter key and drop to the next line and when the script passes this point again do the same thing at the next time instance here is what I have so far: $Count += 1 $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then Exit EndIf FileWrite($file, "Line1"); <-------here is where I want it to write "reset @ sept. 12 2008" then move to the next line in the file and do it over the next time it is reset FileWrite($file, "Still Line1" & @CRLF) FileWrite($file, "Line2") FileClose($file)
  22. What i am most interested in is the portion of the script that creates the text file.
  23. Can Someone look this over to help assist me in ensuring that this script will work? I cannot test it on my PC because I do not have the ability to install Autoit at work. Any help in ensuring this works would be appreciated. Thanks.
  24. Hmm... I didnt realize that could be a problem. i will do that when I get to my home pc (at work). Because I cant download here. it sux I know. But thanks for the heads up on that. Hopefully it will solve the problem. The one I currently have installed is 3.2.0.1
  25. I have never delt with variables. I dont write a lot of auto it scripts, and none of mine have included variables or other scripts. I am still very much a noob when it comes to some of these things. Most of the time I come up here to ask for help with a script when I am trying to get it to do something specific, and I dont understand how to do it. Based on that I have tried to modify the script to do what you suggested. I am not sure if it is correct or not. Global $Paused = 0 Global $Timer = 0 Global $Count = 0 HotKeySet("{SPACE}", "TogglePause") HotkeySet('{ESC}', 'Terminate') opt ("WinTitleMatchMode",2) while 1 If WinExists("TACAN Fault Data") Then Winclose("TACAN Fault Data") Run("C:\Documents and Settings\Administrator\My Documents\Scripts\Restore Transmitter to Service2.exe") $Count += 1 if $Count>5 Then Exit EndIf if $Timer = 0 then $Timer = TimerInit() EndIf if ((TimerDiff($Timer)/1000)/60) > 10 Then $Timmer = TimerInit() $count=0 EndIf EndIf Wend $Count += 1 $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then Exit EndIf FileWrite($file, "Line1") FileWrite($file, "Still Line1" & @CRLF) FileWrite($file, "Line2") FileClose($file) Func TogglePause() $Paused = Not $Paused While $Paused Sleep (1) WEnd EndFunc Func Terminate() Exit EndFunc
×
×
  • Create New...