Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Hi everybody, I need information about automation process in Thunderbird. Before I used 2 plugin Print Tool and FiltaQuilla To remove email header and send filtered email to print spooler these plugins are incompatible with the latest version of thunderbird. I would like to write a script to do this with autoit, could you tell me the most effective way to start? THX
  3. Try this (tested on french win7) : Run("control.exe desk.cpl,Settings,@Settings") Local $hWnd = WinWait("[CLASS:CabinetWClass]","Résolution") Local $hCtrl = ControlGetHandle ($hWnd, "", "Button1") ConsoleWrite ($hWnd & "/" & $hCtrl & @CRLF) ControlClick ($hWnd, "", $hCtrl)
  4. Thank you Master Melba23. Will look in to that. πŸ––
  5. Today
  6. Gtek, You need to move the idle loop out of the 2 functions - AutoIt will not run another function while one is still running: #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include "GUIConstants.au3" Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $ExitID, $ibase, $scustomer, $parent1, $parent2 _Main() ; Put the idle loop here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 Sleep(10) WEnd Func _Main() Local $installID $parent1 = GUICreate("Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) $installID = GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent($installID, "OnYes") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() ; display the GUI EndFunc ;==>_Main ;--------------- Functions --------------- Func OnYes() $parent2 = GUICreate("Fineman Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent(-1, "instpre") GUICtrlCreateButton("Make Image", 90, 50, 70, 20) GUICtrlSetOnEvent(-1, "makecus") $ExitID = GUICtrlCreateButton("Exit", 350, 50, 50, 20) GUICtrlSetOnEvent($ExitID, "OnExit") GUIDelete($parent1) GUISetState(@SW_SHOW, $parent2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Main") EndFunc ;==>OnYes ;Start conimg Function Func instpre() ConsoleWrite("instpre2" & @CRLF) EndFunc ;==>instpre ;Start preimg Function Func makecus() ConsoleWrite("makeus" & @CRLF) EndFunc ;==>makecus Func OnExit() If @GUI_CtrlId = $ExitID Then MsgBox(64, "Exit", "Imaging Canceled") Else MsgBox(64, "Cancel", "Action Canceled") EndIf Exit EndFunc ;==>OnExit For a more detailed explanation on how AutoIt runs functions, please read the Interrupting a running function tutorial in the Wiki. M23
  7. just a stab: StringRegExp($content,'<resource.*?>xy:/resources/([^<]*)<\/resource>',3) Post a runnable test script when you want it confirmed as I am way too lazy to have to type that myself. Jos
  8. Hi y'all! I'm trying to understand why the new GUicreate don't work. it does this. the 2nd windows open, but no buttons work. You guys can probably see right through it So thank you for all your help in advance 😁 #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include "GUIConstants.au3" Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $ExitID, $ibase, $scustomer, $parent1, $parent2 _Main() Func _Main() Local $installID $parent1 = GUICreate("Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) $InstallID = GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent($InstallID, "OnYes") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() ; display the GUI While 1 Sleep(1000) WEnd EndFunc ;==>_Main ;--------------- Functions --------------- Func OnYes() $parent2 = GUICreate("Fineman Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent(-1, "instpre") GUICtrlCreateButton("Make Image", 90, 50, 70, 20) GUICtrlSetOnEvent(-1, "makecus") $ExitID = GUICtrlCreateButton("Exit", 350, 50, 50, 20) GUICtrlSetOnEvent($ExitID, "OnExit") GUIDelete($Parent1) GUISetState(@SW_SHOW, $parent2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Main") ;GUISetState() ; display the GUI While 1 Sleep(10) WEnd EndFunc ;Start conimg Function Func instpre() Local $iLoop = 1 While $iLoop = 1 $ibase = InputBox("Install With 10Ltsb19 Licens", "Enter module name" & @CRLF & "" & @CRLF & " f. eks. Si22" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else $scustomer = InputBox("Choose which Customer", "Enter name of customers image" & @CRLF & "" & @CRLF & " f. eks. Scala/combine/WZF" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else if 0 = FileExists("\\10.0.1.17\public\teknik_images\ibase\" & $ibase & "\" & $ibase & "_10ltsc19_" & $scustomer & ".gho") Then MsgBox(0x5,"Error", "File name doesn't exist" & @CRLF & "Or"& @CRLF & "Network connection is missing" & @CRLF & "Else" & @CRLF & "Examine path: \\FINESTORAGE\Public\Teknik_Images\ibase") Else $iLoop = 0 EndIf EndIf EndIf WEnd RunWait(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=restore,src=\\10.0.1.17\public\teknik_images\ibase\'& $ibase &'\'& $ibase &'_10ltsc19_'& $scustomer &'.gho,dst=1 -ntexact -sure -auto',"") EndFunc; Stop ;Start preimg Function Func makecus() Local $iLoop = 1 While $iLoop = 1 $ibase = InputBox("Install With 10Ltsb19 Licens", "Enter module name" & @CRLF & "" & @CRLF & " f. eks. Si22" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else $scustomer = InputBox("Choose which Customer", "Enter name of customers image" & @CRLF & "" & @CRLF & " f. eks. Scala/combine/WZF" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else if 0 = FileExists("\\10.0.1.17\public\teknik_images\ibase\" & $ibase & "\" & $ibase & "_10ltsc19_.gho") Then MsgBox(0x5,"Error", "File name doesn't exist" & @CRLF & "Or"& @CRLF & "Network connection is missing" & @CRLF & "Else" & @CRLF & "Examine path: \\FINESTORAGE\Public\Teknik_Images\ibase") Else $iLoop = 0 EndIf EndIf EndIf WEnd RunWait(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=restore,src=\\10.0.1.17\public\teknik_images\ibase\'& $ibase &'\'& $ibase &'_10ltsc19_.gho,dst=1 -ntexact -sure -auto',"") if 0 = FileExists("\\10.0.1.17\public\teknik_images\dokumentation\Kundetilpassede\" & $scustomer & "\BG" & $scustomer & "\BG.jpg") Then Exit Else DirCopy("\\10.0.1.17\public\teknik_images\dokumentation\Kundetilpassede\"& $scustomer &"\BG"& $scustomer &"", "d:\FineDir") FileCopy("d:\Finedir\BG"& $scustomer &".bat", "d:\Users\player\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\bg"& $scustomer &".bat") EndIf EndFunc ; Stop Func OnExit() If @GUI_CtrlId = $ExitID Then MsgBox(64, "Exit", "Imaging Canceled") Else MsgBox(64, "Cancel", "Action Canceled") EndIf Exit EndFunc ;==>OnExit2
  9. Hi, im using this statement to get a specific content between two tags: StringRegExp($content,'<resource>xy:/resources/([^<]*)<\/resource>',3) It works fine. But now i have to add a functionality, because it can happen, that after "<resource" another tags comes up, but the regex should ignore it the content can be like this <resource>xy:/resources/xyz/123</resource> <resource mytag="xy">xy:/resources/xyz/123</resource> what do i have to change to my rule, that is has something like StringRegExp($content,'<resource I_DONT_CARE_WHAT_STANDS_HERE>xyz:/resources/([^<]*)<\/resource>',3) any ideas?
  10. that works great mikell! thank you however, for the File_GetPath - how do i exclude the exe - i just would like the path without the exe also what if the switch command / is used instead of - ? i am using this script to identify startup paths and files on remote computers. so the path might have either / or - thanks again for your help!
  11. This is the best time to start understanding this kind of solutions, it's not so complicated, and the usage is simple. The idea is to set hotkeys and hold them in array, and when needed, unset it by the data in this array.
  12. My mistake, I used - for some stupid reason - regedit in the 32bit version. Of course the key "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\vmware.exe" is there. If i use this one in the 64bit script it returns the correct path. Just to summarize this (whoever might find this useful): ; 32bit script RegRead("HKLM\SOFTWARE\Microsoft")                ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft" RegRead("HKLM64\SOFTWARE\Microsoft")              ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft" RegRead("HKLM\SOFTWARE\WOW6432Node\Microsoft")    ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft" RegRead("HKLM64\SOFTWARE\WOW6432Node\Microsoft")  ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft" ; 64bit script RegRead("HKLM\SOFTWARE\Microsoft")                ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft" RegRead("HKLM64\SOFTWARE\Microsoft")              ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft" RegRead("HKLM\SOFTWARE\WOW6432Node\Microsoft")    ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft" RegRead("HKLM64\SOFTWARE\WOW6432Node\Microsoft")  ; will read from "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft" That is a nice solution, thank you!
  13. The following works for me #include <Array.au3> #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** _ArrayDisplay(_AppPaths("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"), "64 Bit App Paths") _ArrayDisplay(_AppPaths("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths"), "32 Bit App Paths") Func _AppPaths($_sRegPath) Local $sRegKey, $aRegPaths[0][2], $i = 1 While 1 $sRegKey = RegEnumKey($_sRegPath, $i) If @error Then ExitLoop _ArrayAdd($aRegPaths, $_sRegPath & "\" & $sRegKey & "|Path = " & RegRead($_sRegPath & "\" & $sRegKey, "Path")) $i += 1 WEnd Return $aRegPaths EndFunc
  14. I would have expected it to be there when you installed the x64 version of the installer but maybe I am wrong here.
  15. No, there is not. It seems the complete "App Paths" key is not there at the WOW6432Node. That means, there is no way I can read the value from "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\vmware.exe" if the script is compiled as 64bit version?
  16. _IELinkClickByText($oIE, "Got it!") Tried the above, alas it did not work. It would however been extremely "clean", replacing all those lines by only one😁 BTW, did you know that the second example of _IELinkClickByText in the help file, does not has _IELinkClickByText in it? I think it is intended though. Just change the earlier enumeration with the following code. $oElements = _IETagNameAllGetCollection($oIE) For $oElement In $oElements If $oElement.GetAttribute("aria-label")="dismiss cookie message" Then _IEAction($oElement, "click") Next Just found this solution more universal and unique for checking on the attribute "aria-label".
  17. $path contains a space, shouldn't it be enclosed with quotes ? Anyway : $path = "cmd /k c:\test\one drive\cars.exe --tmas -asd" Msgbox(0,"", File_GetPath($path) &@crlf& Get_FileName($path) ) Func File_GetPath($path) Return StringRegExpReplace($path, ".*(\S+:\\.+?)(?=\s-|$).*", "$1") EndFunc Func Get_FileName($path) Return StringRegExpReplace($path, "^.+\\(.+?)(?=\s-|$).*", "$1") EndFunc ;==>Get_FileName
  18. Do you have an entry in the registry at this spot?: "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\vmware.exe" Jos
  19. nirsoft looked interesting but unfortunately did not produce the outcome i want. however i did notice that if i go into the Display settings under Windows Settings, system, display and click on the Detect button, it will reset and detect what monitors are on or off so that the DesktopDimensions function works accurately again. so now my issue is how can i trigger display detection from autoit or from the command line?
  20. Hello, I am trying to read a file path from the registry using the key : HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\vmware.exe Running the script as 32bit I retrieve the path, but if I run the script in 64bit it fails to read the value. Is it possible that there is some limitation to read from this specific path? #RequireAdmin #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #Tidy_Parameters=/reel /sf /ri #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region Main _Main() Func _Main() Local $sFilePath_x32 = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\vmware.exe", "") ConsoleWrite(@error & @TAB & @extended & @TAB & $sFilePath_x32 & @CRLF) Local $sFilePath_x64 = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\vmware.exe", "") ConsoleWrite(@error & @TAB & @extended & @TAB & $sFilePath_x64 & @CRLF) Local $sCommonFiles_32 = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion", "CommonFilesDir") ConsoleWrite(@error & @TAB & @extended & @TAB & $sCommonFiles_32 & @CRLF) Local $sCommonFiles_64 = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion", "CommonFilesDir") ConsoleWrite(@error & @TAB & @extended & @TAB & $sCommonFiles_64 & @CRLF) EndFunc ;==>_Main #EndRegion Main Result if run as 32bit: 0 1 C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe 1 2 0 1 C:\Program Files (x86)\Common Files 0 1 C:\Program Files\Common Files Result if run as 64bit: 1 2 1 2 0 1 C:\Program Files\Common Files 0 1 C:\Program Files\Common Files
  21. That line is generated by AutoIt3Wrapper, which then decides to use the original. In case you always want to use the Stripped version anyways you simply use the appropriate #AutotIt3Wrapper directive: (last one) ; Au3Stripper Settings #AutoIt3Wrapper_Run_Au3Stripper= ;(Y/N) Run Au3Stripper before compilation. default=N #Au3Stripper_Parameters= ; Au3Stripper parameters...see SciTE4AutoIt3 Helpfile for options #AutoIt3Wrapper_Au3stripper_OnError= ;(C/S/ForceUse) Continue/Stop on Errors/Continue using stripped source in Exe (Default=C) Jos
  22. Welcome to the AutoIt forum. Are you still new to our rules being here this long? Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team
  23. this function only seems to work if the 2nd monitor has not been turned on or has been turned on and left on. if i turn on the 2nd monitor then turn it off, it still says i have 2 monitors. how do i get this function to tell if the 2nd monitor is really on or off?
  24. ...working with arrays can be overwhelming at first but it opens a world of possibilities. Try to play with arrays to get the hang of it. It'll be worth it. As far as your code: if it works, it worked. If you found a solution you can get your head around, then is all good. You can always revisit old code and update it with your newer style, as you become more proficient
  25. Hi guys, thank you very much for your suggestions. Melba23's solution is good and is similar to my initial idea when I first thought about this problem, but I think it might affect performance when the array grows. I don't understand faustf's and MrCreatoR's solutions. I think the solution offered by Bilgus is very good since it's succinct and it's like an O(1) algorithm (i.e. no matter how many more hotkeysets I add, this solution's execution time does not escalate). Based on this solution, I have written another one (same idea as Bilgus, but easier to understand). #include <GUIConstantsEx.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> ; ^ = Ctrl ; ! = Alt ; + = Shift Global $task1hk = "1" HotKeySet($task1hk, "doTask1") Global $task2hk = "2" HotKeySet($task2hk, "doTask2") Global $isBusyFlag = False While 1 Sleep(100) WEnd Func doTask1() If ($isBusyFlag = True) Then sendStrayHotkey($task1hk, "doTask1") Return EndIf $isBusyFlag = True ; Unset the HotKey HotKeySet($task1hk) ; prevent hotkey recursion _SendEx("Task 1 is executing..." & @CRLF) _SendEx($task2hk) ; And now reset the HotKey HotKeySet($task1hk, "doTask1") $isBusyFlag = False EndFunc Func doTask2() If ($isBusyFlag = True) Then sendStrayHotkey($task2hk, "doTask2") Return EndIf $isBusyFlag = True ; Unset the HotKey HotKeySet($task2hk) ; prevent hotkey recursion _SendEx("Task 2 is executing..." & @CRLF) ; And now reset the HotKey HotKeySet($task2hk, "doTask2") $isBusyFlag = False EndFunc Func sendStrayHotkey($hk, $task) HotKeySet($hk) _SendEx($hk) HotKeySet($hk, $task) EndFunc Func _SendEx($ss, $warn = "") Local $iT = TimerInit() While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12") If $warn <> "" And TimerDiff($iT) > 1000 Then MsgBox(262144, "Warning", $warn) EndIf Sleep(50) WEnd Send($ss) EndFunc;==>_SendEx I ran the test script above and it worked as expected: Command _SendEx($task2hk), which is issued inside doTask1()'s body, does not activate doTask2(), it just sends out the hotkey of doTask2() (which is what I actually want).
  26. Where do you get $path from? There might be a better way than manually extracting the path than parsing the command.
  27. Thank you for your support. But I'm sorry, I now get this message as attached.
  1. Load more activity
×
×
  • Create New...