adarsh12in Posted June 17, 2013 Share Posted June 17, 2013 Hi I am on IE8, winXp SP3. the below mentioned code doesn't work when the mahcine is locked. It does work though when it is unlocked. WinWait("File Download") WinActivate("File Download") sleep(500) ControlClick("File Download","","Button2") ; this clicks the default "save" button on the first dialog WinWait("Save As") ; Wait for the "Save As" box to pop up WinActivate("Save As") sleep(500) $filename=ControlGetText("Save As","Save &in:","Edit1") ;Get the file name before we erase it ControlSetText("Save As","Save &in:","Edit1","") ; erase the file name to make room for the $dest string sleep(1000) ControlSetText("Save As","Save &in:","Edit1", $oDest) ; set the Edit1 text to the $dest and hit the button to swithc directories. ControlClick("Save As","","Button2") sleep(1000) ControlSetText("Save As","Save &in:","Edit1", $sFileName) ; reset the name of the file to the original value. sleep(1000) ControlClick("Save As","","Button2") Can some one please look and instruct? regards Link to comment Share on other sites More sharing options...
BrewManNH Posted June 17, 2013 Share Posted June 17, 2013 A simple search of the forum would have given you the answer to this question because it gets asked about once a week. http://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
guinness Posted June 17, 2013 Share Posted June 17, 2013 Why do you need such a script to be active all the time? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
adarsh12in Posted June 19, 2013 Author Share Posted June 19, 2013 Hi BrewManNH, tx for the response. I modified code but still when system is locked, it waits for SAVE button to be clicked. I have altered my script but still no good- WinWait("File Download") ;WinActivate("File Download") ControlSend ("File Download", "", "", "{Button2}") sleep(500) ControlClick("File Download","","Button2") ; this clicks the default "save" button on the first dialog WinWait("Save As") ; Wait for the "Save As" box to pop up ControlSend ("Save As", "", "", "{Button2}") ;WinActivate("Save As") sleep(500) $filename=ControlGetText("Save As","Save &in:","Edit1") ;Get the file name before we erase it ControlSetText("Save As","Save &in:","Edit1","") ; erase the file name to make room for the $dest string sleep(1000) ControlSetText("Save As","Save &in:","Edit1", $oDest) ; set the Edit1 text to the $dest and hit the button to switch directories. ControlClick("Save As","","Button2") sleep(1000) ControlSetText("Save As","Save &in:","Edit1", $sFileName) ; reset the name of the file to the original value. sleep(1000) ControlClick("Save As","","Button2") Can u please check the code and guide me regards Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2013 Share Posted June 19, 2013 Where exactly is it failing? I see that you switched from using ControlClick to ControlSend, you shouldn't have changed that part of the script, that wasn't your problem. Your problem is that you can't use WinWaitActive/WinActivate on a locked machine. I don't have any way to test this though as I don't have a Win XP machine around here, I haven't installed XP on any of my personal computers in years. I might be able to test something on one of the computers where I work, as they're still on XP for now. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
adarsh12in Posted June 19, 2013 Author Share Posted June 19, 2013 (edited) Hi, I hv commented the winActivate line and replaced them with ControlSend. It stops on this line - ControlSend ("Save As", "", "", "{Button2}") then it expects you to click th SAVE button. Please try on XP and let me kow where the issue could be tx again for ur time Edited June 19, 2013 by adarsh12in Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2013 Share Posted June 19, 2013 I already told you, don't use ControlSend, use ControlClick. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
adarsh12in Posted June 20, 2013 Author Share Posted June 20, 2013 Hi, Doesn't work still. I have only controlclick now like you suggested. i am trying to debug by writing after every line to a separate txt file. that shows execution till the last line. but the handle waits on SAVE dialog box. Local $tDir ="C:" Local $OLO = FileOpen($tDir& "test.txt", 2) WinWait("File Download") FileWrite($OLO, "test 63") sleep(500) ControlClick("File Download","","Button2") ; this clicks the default "save" button on the first dialog FileWrite($OLO, "test 68") sleep(500) FileWrite($OLO, "test 73") $filename=ControlGetText("Save As","Save &in:","Edit1") ;Get the file name before we erase it ControlSetText("Save As","Save &in:","Edit1","") ; erase the file name to make room for the $dest string sleep(1000) FileWrite($OLO, "test 77") ControlSetText("Save As","Save &in:","Edit1", $oDest) ; set the Edit1 text to the $dest and hit the button to switch directories. ControlClick("Save As","","Button2") sleep(1000) FileWrite($OLO, "test 81") ControlSetText("Save As","Save &in:","Edit1", $sFileName) ; reset the name of the file to the original value. sleep(1000) ControlClick("Save As","","Button2") FileWrite($OLO, "test 85") FileClose($OLO) _IEQuit($oIE) Link to comment Share on other sites More sharing options...
guinness Posted June 20, 2013 Share Posted June 20, 2013 What site are you downloading from? As I asked before, why do you need this to run when the system is locked. Also, please use AutoIt tags (blue icon) when posting AutoIt code. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 20, 2013 Moderators Share Posted June 20, 2013 adarsh12in, I share guinness' concern over your requirement to download files when the machine is locked. So with my Mod hat firmly in place I am now asking you to explain why you need to do this. Everyone else, No more help please until we find out what is going on. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
adarsh12in Posted June 21, 2013 Author Share Posted June 21, 2013 (edited) Here is the reason- there needs to be automation as much as possible on producing reports. There is a GUI (.NET based within the org) where you have to manually log in and fill couple of options. Then, it generates report in excel based on the options selected. now, if the machine is on and such task is undertaken, it takes a long time and restricts the current user's ability. so, this report, which is needed every friday can be produced by AutoIT script in the absence of the user. I woul duse a windows scheduler to run the autoIT exe. let me know if any further explanation is required. If there is better means to write the code in the background if the machine is not locked, i am happy with that as well. Now if you are satisfied, can someone please correct my code! Edited June 21, 2013 by adarsh12in Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 21, 2013 Moderators Share Posted June 21, 2013 adarsh12in,So you want be able to log in to an app on a locked machine and run it. Although I am not accusing you of any malicious intent, I hope that you can see that any such code could very easily be used by others who were less honest. So I am afraid that I am not at all satisifed that this thread should continue - with the obvious result. I suggest that you speak to your IT department and they work out some way of producing this report without adversely affecting the "current user's ability" - whatever that means. After all, if the company wants the report, it is up to them to get it produced in a suitable manner. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts