Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. 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
  3. 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
  4. 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.
  5. ... I can think of an other more appropriate option but that would be rude. Jos
  6. Today
  7. The OP script works as intended here (W7 x64). I'm surprised it doesn't work elsewhere.
  8. @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
  9. Then go ask him what the problem is if you’re not willing to share your code because this is ridiculous
  10. 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
  11. 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.
  12. 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
  13. ; *** 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 =/
  14. A good place to start is this thread:
  15. 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.
  16. @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
  17. 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.
  18. 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
  19. I used free version of cisco desktop manager.
  20. How about you try both,or all of the choices you can think of, and report the results? Or do a search to see if its been done before and go from there?
  21. Hello every one, I have a small question is: With a large amount of data, if I use StringSplit to convert it to Array then use ArrayFindAll to find or just leave it as a string and use StringInStr to find which is effective than? And the fastest? Thanks.
  22. Hi and thanks for this excellent UDF! Gonna extensively use it in a BIG project I'm working on... Juste one "cosmetics" little comment: I'm I the only one that don't like the Icon placement in the window? I think it should be: If Icon height > textHeight: vertically centered on the text's center If Icon height <= textHeight: Icon.X = text.X
  23. Why would you want to? If you're writing Python, write Python. If you're writing AutoIt, write AutoIt. If you have a situation where you simply cannot get away from mixing and matching languages (doubtful) a little more explanation would be wonderful.
  24. I should have shown the previous line. There is a local variable $guitmsg =GuiGetMsg() that is being called. Your example lets me reduce an extra line that is not needed. Thanks. I added that so the application and GUI could be exited when I was testing with a mouse.
  25. If you want to pay for something you can easily script around for free, more power to you
  1. Load more activity
×
×
  • Create New...