Jump to content

Anoop

Active Members
  • Posts

    55
  • Joined

  • Last visited

Everything posted by Anoop

  1. @Jos, Thank you very much for the clarification.
  2. Hi @nitekram Thanks for the reply. This is the alternate way I found. But I liked your quick response. Hi @Jos and @nitekram, If it is the issue with return, how it worked for the first time. I am triggering the first event when in start(). It worked correctly. Then again coming to start() and triggering the second event. Now it is not working. Moreover, this is OnEvent mode and my understanding is that this event should be captured regardless of where the script is.
  3. I found alternate way. But It seems, it is a bug in AutoIt software.
  4. Hi All, I am facing an issue with tray event. The tray event is not getting captured from the second time. It correctly worked for the very first time. I have copied my code below. There is a simple gui with a "START" button. When the button is clicked, it just sends a winhttp request continuously with 5 seconds delay. A tray menu item "Stop" is there and on selecting it, it asks whether to stop the operation - It works perfectly for the first time. But after I confirm to stop and again START the operation from GUI. Now try to select "Stop" tray menu option. It does not work. Can someone be kindful to help? #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> Local $oMyError1 = ObjEvent("AutoIt.Error", "WinhttpError", "IWinHttpRequestEvents") Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") Opt("TrayAutoPause",0) Opt("TrayMenuMode",1 + 2) Opt("TrayOnEventMode",1) Local $oStopTray = TrayCreateItem("Stop") TrayItemSetOnEvent(-1,"_stop") $hGUI = GUICreate("Tray Event",100,50) $hButton = GUICtrlCreateButton("START", 10, 10, 75, 25) GUI() Func GUI() Opt("TrayIconHide",1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hButton GUISetState(@SW_HIDE) Start() EndSwitch WEnd EndFunc Func Start() Opt("TrayIconHide",0) while 1 $oHTTP.Open("GET", "http://www.google.com") $oHTTP.Send() ConsoleWrite($oHTTP.ResponseBody) Sleep(5000) WEnd EndFunc Func _stop() $iReply = MsgBox($MB_YESNO + $MB_ICONINFORMATION + $MB_TOPMOST,"STOP???", "Analysis in progress. Do you want to stop the operation?") If $iReply == $IDYES Then GUI() Else Return EndIf EndFunc Func WinhttpError() ConsoleWrite(@ScriptName & " (" & $oMyError1.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oMyError1.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oMyError1.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oMyError1.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oMyError1.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oMyError1.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oMyError1.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oMyError1.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oMyError1.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oMyError1.retcode) & @CRLF & @CRLF) EndFunc thanks very much Anoop
  5. #include <Excel.au3> #include <Array.au3> Global $oAppl = _Excel_Open() Global $sWorkbook1 = @ScriptDir & "\Test.xls" Global $oWorkbook1 = _Excel_BookOpen($oAppl, $sWorkbook1, Default, Default, True) $aResult = _Excel_RangeRead($oWorkbook1) _ArrayDisplay ($aResult) $max = _ArrayMax($aResult, 1) MsgBox($MB_SYSTEMMODAL, "","$max  is : " & $max) Please try with this. Check if array displayed correctly.
  6. Take the data in an array using _Excel_RangeRead and use _ArrayMax to find the highest value.
  7. You can use single quotes ( ' ) to enclose it. 'interface ip set DNS "local area connection" static 192.168.100.76 primary'
  8. I tried this in a x64 PC and it is working for me. #include <MsgBoxConstants.au3> If @ProcessorArch = "X86" Then MsgBox($MB_OK, "Tutorial", "32 Bit") Run("tc86\calc.exe", "") Else MsgBox($MB_OK, "Tutorial", "64 Bit") Run("tc64\notepad.exe","") EndIf
  9. Hi vikashbitm2010, Great to know that you solved your issue.
  10. EnvSet("qm_AttachmentsFile" ," D:\myfile.txt") MsgBox(0,"",EnvGet("qm_AttachmentsFile")) The above script is correctly setting the environment variable and I can get it back using EnvGet. But please note - A environment variable set in this way will only be accessible to programs that AutoIt spawns (Run(), RunWait()). Once AutoIt closes, the variables will cease to exist. For permanently setting, you can use the script provided in the below post as reference.
  11. Unfortunately, I don't think that there is some truth . His question clearly states that, he has a batch file with an environment variable which is getting appended with some file path. And he wants to do it with Autoit. Per my knowledge, envget will not do this.
  12. @vikashbitm2010, So let BreManNH post help you. If you need any more details, please feel free to ask me.
  13. Are you getting any error? Please note, Once AutoIt closes, the variables will cease to exist. If you want to permanently set, use registry write operation. Search this forum.
  14. Use envset for temporarily setting the environment variable.
  15. You can double click the script to open. If the script is running instead of opening in the editor, there was a setting which needs to be selected during the installation. You can check this tutorial AutoIt Download and Installation for details. Please check 6th step.
  16. So you are getting error when loading the website initially itself. Try to solve it first.
  17. Post the full console log.
  18. Check https://www.autoitscript.com/autoit3/docs/libfunctions/_IEFormElementSetValue.htm _IEFormElementSetValue($Name,"Henry")
  19. Below are the methods to access different SendTo shortcut folders: AutoIt - Get Current User Desktop Folder Path AutoIt - Get Desktop Folder Path for 'All Users' AutoIt - Get My Documents Folder AutoIt - Get Documents Folder Path for 'All Users'
  20. Function to Create Shortcut Function to delete shortcut You need to specify the appropriate SendTo folder path in parameter "lnk" - Full path and file name of the shortcut.
  21. Add it to startup folder - http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/how-to-add-a-program-to-startup/91d18255-659e-4796-87f6-5e6c814c7d50
  22. JFYI - If you convert it to exe and run, you can see the executable file name in task manager.
  23. If it is IE browser, you can use IE functions automate these. In the below example, IE opens and navigates to google, minimize browser and searches for autoit. #include <IE.au3> Local $oIE = _IECreate("www.google.com") WinSetState("Google - Windows Internet Explorer","",@SW_MINIMIZE ) $oTxtSearch = _IEGetObjByName($oIE, "q") $oForm = _IEGetObjByName($oIE,"f") _IEFormElementSetValue($oTxtSearch,"autoit") _IEFormSubmit($oForm) ;_IEQuit($oIE)
  24. If you want to minimize a window, check WinSetState ( "title", "text", flag )
  25. _Excel_RangeRead ( $oWorkbook [, $vWorksheet = Default [, $vRange = Default [, $iReturn = 1 [, $bForceFunc = False]]]] ) Change $iReturn to 3 and try.
×
×
  • Create New...