Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Awesome thank you all I will start working on this and post back.
  3. Hi all, Just to point out that this is a good example of what we mean when we talk about a "check for a few keys being pressed" in this announcement - and so the thread is perfectly legal. M23
  4. Nope, When a computer shuts down, a close messages is send to all "program windows" which will then include the hidden Autoit3 window and a normal close will be performed by AutoIt3 which includes performing the registered functions for Exit. Jos
  5. Ok. While I understand what you are saying, autoit is able to determine if a script exited due to the user logging out or shutting down the machine, right? As far as the executing script is concerned, wouldn't the act of shutting down or logging off the machine be interpreted as "killing the script" as well, @BrewManNH?
  6. So make one exe with all functionality and based on parameter it can start itself and call the function you indicate by parameter. You are having focus to much on your solution instead of detailing requirements. This way its hard to give you a good direction on a solution. Same exe starting many times from itself calling another function shouldnt be that difficult.
  7. Today
  8. That's by design, you aren't exiting the process, you are killing it. There's no way for any program to know you're doing that. OnAutoItExit only works when the program closes normally, you're not closing it normally. There's no bug.
  9. Wow. Did not expect the conversation to go in this direction. I had assumed I had done something wrong and that was why OnAutoItExitRegister was not running correctly, but it appears that I am not the only one who is running into this issue. So I just want to confirm that the behavior for OnAutoItExitRegister is not by design and is not behaving as it should, right? Should I file a bug report? Also, thanks for the solution, @argumentum.
  10. even more strange... as @argumentum suggested, tryed a WatchDog way by spawn a process detached from the main script. (I can see that there are 2 processes with 2 different Pid in task manager) the whole works OK even if compiled, but if I force the close of the command prompt window of the main exe, then also the detached exe is closed as well (shouldn't the detached exe continue to run??) #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #pragma compile(AutoItExecuteAllowed, true) Local $hPid = ShellExecute('notepad.exe') _WatchDog_OnAutoItExitRegister() MsgBox(0, "Demo", "press ok to exit (and let notepd be closed by the watchdog)") Func _WatchDog_OnAutoItExitRegister() ; prepare the "On exit" script (it must stay all in one line) Local $sCommand = "Local $WatchDog = ProcessWaitClose($CmdLine[1]), $Dummy = ProcessClose($CmdLine[2]) + MsgBox(0,'WatchDog','All done! ... woof woof!' )" ; adjust quotes if needed ;https://www.autoitscript.com/forum/topic/181491-question-about-autoit3executeline/?do=findComment&comment=1303199 $sCommand = '"' & StringReplace($sCommand, '"', '""') & '"' ; unleash the "WatchDog" ; the @AutoItPID passed here is the Pid of the "main" script (not the pid of the detached script) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand & ' ' & @AutoItPID & ' ' & $hPid) EndFunc ;==>_WatchDog_OnAutoItExitRegister
  11. Is there another way of selecting items from combo boxes. I have tried everything i can think of and though the below code works it takes focus away from the user Func ComboboxSelect() ConsoleWrite( "--- Find ComboBox ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "cmbAddressType", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pComboBox1, $oComboBox1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition0, $pComboBox1 ) $oComboBox1 = ObjCreateInterface( $pComboBox1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oComboBox1 ) Then Return ConsoleWrite( "$oComboBox1 ERR" & @CRLF ) ConsoleWrite( "$oComboBox1 OK" & @CRLF ) Local $pInvoke, $oInvoke $oComboBox1.GetCurrentPattern( $UIA_ExpandCollapsePatternId, $pInvoke) $oInvoke = ObjCreateInterface( $pInvoke, $sIID_IUIAutomationExpandCollapsePattern, $dtagIUIAutomationExpandCollapsePattern ) If Not IsObj( $oInvoke ) Then Return ConsoleWrite( "$oInvoke ERR" & @CRLF ) ConsoleWrite( "$oInvoke OK" & @CRLF ) $oInvoke.Expand() ConsoleWrite( "--- Find Do it Later ---" & @CRLF ) Local $pCondition4 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Do it later", $pCondition4 ) If Not $pCondition4 Then Return ConsoleWrite( "$pCondition4 ERR" & @CRLF ) ConsoleWrite( "$pCondition4 OK" & @CRLF ) Local $pListItem1, $oListItem1 $oComboBox1.FindFirst( $TreeScope_Children, $pCondition4, $pListItem1 ) $oListItem1 = ObjCreateInterface( $pListItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oListItem1 ) Then Return ConsoleWrite( "$oListItem1 ERR" & @CRLF ) ConsoleWrite( "$oListItem1 OK" & @CRLF ) Local $pInvoke1, $oInvoke1 $oListItem1.GetCurrentPattern( $UIA_SelectionItemPatternId, $pInvoke1) $oInvoke1 = ObjCreateInterface( $pInvoke1, $sIID_IUIAutomationSelectionItemPattern, $dtagIUIAutomationSelectionItemPattern ) If Not IsObj( $oInvoke1 ) Then Return ConsoleWrite( "$oInvoke ERR" & @CRLF ) ConsoleWrite( "$oInvoke OK" & @CRLF ) $oInvoke1.Select() ;Close ComboBox $oInvoke.Collapse() EndFunc
  12. here the problem described by op also arises. (Win7 x64), as suggested by @argumentum better to insert a delay of few seconds within the do ... Until $text = 5 loop so to give time to notepad to start, and also allow users to force the close of the command prompt window. When I force the close of the command prompt window, (before the script ends by himself) the notepad is not killed by the OnAutoItExitRegister function.
  13. ... I can think of an other more appropriate option but that would be rude. Jos
  14. The OP script works as intended here (W7 x64). I'm surprised it doesn't work elsewhere.
  15. @Earthshine, So what do you really think about this topic? You could choose to do like I do, just ignore the topic when people aren't prepared to being helped. Jos
  16. Then go ask him what the problem is if you’re not willing to share your code because this is ridiculous
  17. As mentioned numerous times above this isn’t possible so you should just drop it and move on. Plus there is no good reason to do this anyway
  18. philkryder, I've corrected the error with the red rectangle in the Windows 7 version of UIASpy, which you can find near the bottom of this post. Select the correct screen scaling in the Options menu.
  19. So, your passwords are in the cloud. And nowadays every "service in the cloud" is hack free by strong and secure measures. Looks like a nice app. Edit: Running the app and it has a local data source
  20. ; *** Start added by AutoIt3Wrapper *** #include <AutoItConstants.au3> ; *** End added by AutoIt3Wrapper *** #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.15.0 (Beta) Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ReRun() ; ugly fix Func ReRun() If Not @Compiled Then ConsoleWrite(@CRLF & @CRLF & @CRLF & "!!! compile to run the example !!!" & @CRLF & @CRLF & @CRLF & @CRLF) Exit 0 EndIf If Not StringInStr($CmdLineRaw, "/ErrorStdOut") Then WinSetState(@ScriptFullPath, "", @SW_HIDE) Local $errorlevel = ShellExecuteWait(@ScriptFullPath, "/ErrorStdOut " & $CmdLineRaw) Do ProcessClose ( "notepad.exe" ) Until Not ProcessExists ( "notepad.exe" ) Exit $errorlevel EndIf EndFunc ;~ OnAutoItExitRegister ( "endproc" ) ; replaced by ugly fix ShellExecute ( "notepad.exe" ) $text = 0 WinActivate(@ScriptFullPath) Do $text = $text + 1 ConsoleWrite('loop # ' & $text & ' of 10'& @CRLF) ; Do stuff Sleep(2000) Until $text = 10 ; Do more stuff here Func endproc () Do ProcessClose ( "notepad.exe" ) Until Not ProcessExists ( "notepad.exe" ) EndFunc Same here. If I close the compiled script it does not behave has expected. But you could write a watchdog that'll do the work of OnAutoItExitRegister() when you exit =/
  21. A good place to start is this thread:
  22. Thanks for the suggestion, but I doubt I will bother any time soon ... too much on my plate etc. But if others are happy to chase it up and post each solution here, I will be happy to incorporate.
  23. @TheSaint. Cool UDF. I figured I would offer a suggestion if you have not already found out how to get the other browsers to work. If I were in your shoes, I would use a tool like Nirsoft's reg from app tool or registry changes view tool to determine which registry keys are responsible for setting each browser as the "default browser" by actually recording the change that is made. Just a thought
  24. Hello all. So I have some questions concerning the OnAutoItExitRegister function. I see the help file takes the time to explain how the exit code and exit method can be retrieved from macro values and even defines some of the methods, but my question is are the methods that the help file defines the only methods that autoit can detect? Allow me to elaborate: consider the below script, which was compiled as a CUI script rather than a GUI script: ; *** Start added by AutoIt3Wrapper *** #include <AutoItConstants.au3> ; *** End added by AutoIt3Wrapper *** #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.15.0 (Beta) Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here OnAutoItExitRegister ( "endproc" ) ShellExecute ( "notepad.exe" ) $text = 0 Do $text = $text + 1 ; Do stuff Until $text = 5 ; Do more stuff here Func endproc () Do ProcessClose ( "notepad.exe" ) Until Not ProcessExists ( "notepad.exe" ) EndFunc This script is not the exact same as the one I am working with, but it will still help me illustrate the nature of my question/problem. The main difference between this script and the one I am working with is that the contents inside the "Do...Until" loop are very unlikely to satisfy the condition that would allow the loop to exit (its monitoring if a web site is online and will only exit the loop if the code in the loop indicate the site has gone down). That being the case, the scenario which is much more likely is that the script will be closed by me when I close the command prompt (either by clicking the "x" or using the keyboard "ctrl + c"). However, when I exit the application in this way, the contents of the function that I defined in the "OnAutoitExitRegister" function do not appear to be executing, as notepad remains open after the script has stopped running. Why is this? I am guessing compiling the script as a cui rather than a gui might have something to do with it, but is there a way for autoit to register a function when a cui script is closed in either of the ways I described above. I look forward to your feed back.
  25. Well, I have a location on one of our servers in the LAN and on every start the local version is compared to the version on the server. General way of updating the compiled exe is: rename current exe to _old.exe (yes, the exe file is able to rename itself) copy the new exe to the local computer run the new exe Func Updateholen() Local $updatepfad = "\\server\myprogram\" ; Folder to get the Updates Local $updatequelle = $updatepfad & "myfile.exe" ; FileName to check for Local $tmp1 = "" Local $tmp2 = "" If FileExists(@ScriptDir & "\myfile_old.exe") Then FileDelete(@ScriptDir & "\myfile_old.exe") ; delete possibly existing old version If Not @Compiled Then Return ; only try to update if started as a compiled exe If @AutoItX64 = 1 Then $updatequelle = $updatepfad & "myfile_x64.exe" If Not Ping("server", 50) Then Return ; if server is not online, update can not be retrieved If FileExists($updatequelle) Then $tmp1 = FileGetTime($updatequelle, 0, 1) $tmp2 = FileGetTime(@AutoItExe, 0, 1) If $tmp1 > $tmp2 Then ; rename the currently running exe file $tmp1 = FileMove(@AutoItExe, @ScriptDir & "\userinfo_alt.exe") If $tmp1 <> 1 Then MsgBox(16, "Problem", "Could not rename the running exe") Exit EndIf ; copy the new exe file to our PC $tmp1 = FileCopy($updatequelle, @AutoItExe) If $tmp1 <> 1 Then MsgBox(16, "Problem", "Could not copy the update") Exit EndIf ; notify user about the update and display version history If FileExists($updatepfad & "history.htm") Then ShellExecute($updatepfad & "history.htm") Run(@AutoItExe) Exit EndIf EndIf EndFunc ;==>Updateholen
  26. I used free version of cisco desktop manager.
  1. Load more activity
×
×
  • Create New...