Jump to content

daashag

Active Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by daashag

  1. I need to do something similar. Seeing I have limited programming skills, I found using send keys works pretty well for manipulating the gui. For instance the following code will open a database in access and run a query. Run(@ComSpec & " /c " & '\\Cypress\Database\OldCopiesofDatabses\scrapbookmatesdb1.mdb', "", @SW_HIDE) Sleep(500) Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("Microsoft Access","") If Not WinActive("Microsoft Access","") Then WinActivate("Microsoft Access","") WinWaitActive("Microsoft Access","") ;Navigate to Objects Panel Send("{TAB}m{ENTER}") ;Make sure Querries is selected Send("{TAB}q{ENTER}") ;Run specifide query Send("RetailerSalesSumm{ENTER}") I know it's not sexy but it works.
  2. Thanks guys appreciate your help. The script works beautifully.
  3. I appreciate your concern. however it doesn't help me a whole lot. I was doing some research on udfs, and from what I understood they are code snippets that you can use in scripts by just including the .au3. So if I saved your script as delfiles.au3 and included it in another script, I could just call the function remove files and pass it parameters. Is that correct?
  4. Thanks herewasplato for the reply. I still don't understand the usage of this script. Can I call the the udf and pass arguments to it like path and age, if so what is the syntax for that, or do I need to edit the script and hardcode the age and path of files I want to delete?
  5. Please excuse my newbiness but is the above link the udf.
  6. Little confused here. Do the files exist on local drives or on network drives?
  7. Couldn't you just call the script in your login script?
  8. As a fellow newby I can only say try to avoid using the recorder. For instance if you want to open a program on the desktop you could use the Run()command, then use send() commands to manipulate your windows. The helpfile and forums will get you a long way. Cheers daashag
  9. That totally worked. It was adding a blank space in the front of the string. Just curios as to why this code didn't work though. Local $s_path = StringStripWS ($aArray[0],1) Do WinWaitNotActive("Create Backup", "") Until FileExists($s_path) Thanks a ton. Never would have figured this out without your help.
  10. Ok not exactly sure what you were doing there. So if you search for a file with a variable it fails but if you search for a file with a path it finds it. So are you thinking this is some kind of limitation in the FileExist function? Thanks
  11. Thanks for the reply. Heres the code that will work. But I can't explicitly give the path because the path changes everyday. ;Wait for backup to finish Do WinWaitNotActive("Create Backup", "") Until FileExists("x:\exactglobe\backups\20061208-scrapbook mate.ebu") MsgBox(0, "Example", "Found file")
  12. Thanks for your response Kandie, Actually the space before the x is just a cut and paste thing. Sorry about that. I tried your code and it passes the value of $aArray to $s_path but FileExist function still does not work unless I explicitly give the path of "x:\exactglobe\backups\20061117-scrapbook mate.ebu" Thanks
  13. I am able to grab the text as the output of CODE$WinText = WinGetText('Create backup')$aArray = _StringBetween($WinText, '001', 'TROON', -1, 1) If IsArray($aArray) Then MsgBox(64, 'Info', $aArray[0]) Gives me " x:\exactglobe\backups\20061118-scrapbook mate.ebu" But the following code doesn't work. It only works if I hard code the value of $aArray[0], it won't work with just using $aArray CODE;Wait for backup to finishDo WinWaitNotActive("Create Backup", "") Until FileExists($aArray[0]) If I use Until FileExist("x:\exactglobe\backups\20061118-scrapbook mate.ebu") it works fine MsgBox(0, "Example", "My variable is ") My question is how to I use the $aArray[0] with the FileExist function? Thanks
  14. Sorry for the delayed response, I haven't been able to work on this for awhile. Your code worked great. Thanks
  15. Appreciate your help Joon, you got me pointed into the right direction. I am able to make this work with two scripts. The first script logins in using the following code. Run('mstsc.exe "d:\\test\Server1.rdp"') On the Server1.rdp I have it execute the second script upon logging in. You can set that in your options of your .rdp file.
  16. The following code will open a RDP then run notepad on the the on the computer that is executing the script. How do I make it so it will run notepad on the RDP computer "Server1" Run('mstsc.exe "' & @MyDocumentsDir & '\Connect\Server1.rdp"') WinWait("Server1 - Server1 - Remote Desktop","") If Not WinActive("Server1 - Server1 - Remote Desktop","") Then WinActivate("Server1 - Server1 - Remote Desktop","") WinWaitActive("Server1 - Server1 - Remote Desktop","") Run("Notepad.exe", "", @SW_MAXIMIZE) Thanks
  17. Thanks for your reply, My application is GUI Based. It will work if I am RDP when the scheduled task runs even If I have the window minimized. Is it possible to first RDP in then run the autoit script. Basically have a script that RDP in and then executes another script. I don't need to worry about logging off as I reboot the server everynight anyway. Thanks
  18. Is there a way around this other than leaving someone logged into the box at all times?
  19. The way I am trying right now is with no logged in user. Thanks
  20. Is it possible to run a script as a schedule task? I apologize for re-posting on the same topic, but I have asked this question before but have yet to get a clear answer. I have searched the forums and have found threads where this is being attempted but none with a solution. I have tried to run it as service according to Q4 of FAQ, ControlClick(), ControlSend(), and regualar window controls. I tried using RDP to login and then run the script. Has anyone been able to accomplish this? Would appreciate any feedback on this. Thanks
  21. Is this possible? Does anyone know how to do this? Appreciate any help on this.
  22. Appreciate your help Lar, Yeah I am running the task with administrator credentials. The PC in this case is a server so if remote Desktop in and just minimize the window instead of logging off it will run. But if I am logged off it won't. Do you think if I had a script RDP in and then run the task that would work. I have got it so I can RDP in, I am just not sue how to give focus to the remote desktop for control commands. Thanks
  23. I want to run a script as a schedule task. The script runs fine when I initiate the script manually while logged in. The script needs to open a program go through some selections than close the program. All it does is open the program when ran as scheduled task. Thanks
  24. Appreciate your response Lar, But how do you do this? I already tried the RunAsSet() command to no avail. Also how do I get the task to be able to interact with the desktop? Thanks
  25. Either it doesn't work or I am doing something wrong. I modified your script so it doesn't require a code to lock the PC, then I set up both your script and and a winzip install script to run as a scheduled task. Of course your script runs first to lock the PC. I then logged out and waited for the tasks to run. When I log back in both scripts are running according to the processor table, the PC is locked, and the winzip install script is stalled at the first setup window. Here are the two modified scripts. lock PC #include <GuiConstants.au3> #include <File.au3> #include <misc.au3> #notrayicon $version = "2.0" Opt("WinTitleMatchMode", 4) Global $blockingKey = "111" ;Global $codeGiven = False, $inputCode Global $splash = 0 HotKeySet("!{TAB}", "doNothing") HotKeySet("{TAB}", "doNothing") HotKeySet("{ESC}", "doNothing") ;HotKeySet("{F9}", "code") HotKeySet("{F9}", "OnAutoItExit") ; STRG+ALT+F9 Sofort-Exit $safeGUI = GUICreate('') GUISetState($WS_EX_TRANSPARENT, $safeGUI) $blockGUI = GUICreate(" *Mega*", @DesktopWidth, @DesktopHeight, -1, -1, -1, -1, $safeGUI) GUISetState() WinMinimizeAll() WinSetTrans(" *Mega*", "", 1) $dll = DllOpen("user32.dll") WinSetOnTop(" *Mega*", "", 1) ; The scriptyou want to run $startPath = "c:\Downloads\AutoIt-Skripte\Entwicklung\ForumTests\MegaBlock\NotePadTut.exe" While 1 For $i = 1 To 91 If _IsPressed($i, $dll) Or _IsPressed("0D", $dll) Then doNothing() EndIf ToolTip("Protected by, *Mega* v" & $version & " | " & @HOUR & ":" & @MIN & ":" & @SEC, 5, 5) Next _MouseTrap(95, 18, 140, 22) WinSetOnTop(" *Mega*", "", 1) Sleep(1) ; save CPU WEnd Func secure() WinMinimizeAll() ;Hide Taskbar DllCall("WinLockDll.dll", "Int", "Taskbar_Show_Hide", "Int", "0") ;Disable CrtlAltDel $splash = SplashTextOn("", "Administrator : This PC is locked!" & @LF & @LF & _ "Tel.: XXXX" & @LF & @LF & _ "Email: Mega@xxx.com" & @LF & _ @LF & @LF & _ "Mega", _ 550, @DesktopHeight / 2, 1, 500, 1, 5, 16, 600) DllCall("WinLockDll.dll", "Int", "CtrlAltDel_Enable_Disable", "Int", "0") DllCall("WinLockDll.dll", "Int", "Desktop_Show_Hide", "Int", "0") EndFunc ;==>secure ;DllCall("WinLockDll.dll", "Int", "Process_Desktop", "str", "MyDesktop2", "str", "cmd.exe") Func OnAutoItExit() WinMinimizeAllUndo() _MouseTrap() DllCall("WinLockDll.dll", "Int", "Desktop_Show_Hide", "Int", "1") DllCall("WinLockDll.dll", "Int", "CtrlAltDel_Enable_Disable", "Int", "1") DllCall("WinLockDll.dll", "Int", "Taskbar_Show_Hide", "Int", "1") SplashOff() Exit (0) EndFunc ;==>OnAutoItExit Func doNothing() _MouseTrap(95, 18, 140, 22) WinSetState("Windows Task-Manager", "", @SW_HIDE) WinSetOnTop(" *Mega*", "", 1) EndFunc ;==>doNothingoÝ÷ ÙÊ%¢ºM4ÒÊZËr I want to run a script while logged out. Has anyone been able to accomplish this, or know if this is even possible. Appreciate any input if someone has experience with this. Thanks
×
×
  • Create New...