Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. ; *** 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: (Beta) Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ReRun() ; ugly fix Func ReRun() If Not StringInStr($CmdLineRaw, "/ErrorStdOut") Then WinSetState(@ScriptFullPath, "", @SW_HIDE) Local $errorlevel If @Compiled Then $errorlevel = ShellExecuteWait(@ScriptFullPath, "/ErrorStdOut") Else $errorlevel = ShellExecuteWait(@AutoItExe, '"' & @ScriptFullPath & '" /ErrorStdOut') EndIf 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 ; Do stuff Sleep(5000) Until $text = 5 ; 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 =/
  3. A good place to start is this thread:
  4. Today
  5. 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.
  6. @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
  7. 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: (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.
  8. 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
  9. I used free version of cisco desktop manager.
  10. 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?
  11. 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.
  12. 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
  13. 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.
  14. 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.
  15. If you want to pay for something you can easily script around for free, more power to you
  16. Don't use GUIGetMsg with _IsPressed, just check for the keypress directly. Something like this would work. While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then $term = 99 ExitLoop EndIf If _IsPressed("31", $hDLL) Then GUIDelete() $term = 1 ExitLoop ElseIf _IsPressed("32", $hDLL) Then GUIDelete() $term = 2 ExitLoop ElseIf _IsPressed("33", $hDLL) Then GUIDelete() $term = 3 ExitLoop ElseIf _IsPressed("34", $hDLL) Then GUIDelete() $term = 4 ExitLoop ElseIf _IsPressed("41", $hDLL) Then GUIDelete() $term = 5 ExitLoop ElseIf _IsPressed("42", $hDLL) Then GUIDelete() $term = 6 ExitLoop ElseIf _IsPressed("43", $hDLL) Then GUIDelete() $term = 7 ExitLoop ElseIf _IsPressed("44", $hDLL) Then GUIDelete() $term = 8 ExitLoop EndIf WEnd
  17. Yesterday
  18. Found here (https://wimlib.net/forums/viewtopic.php?f=1&t=261&start=13) something about PROCESS_TRUST_LABEL_ACE blocking changes to WindowsApps folder. Is it possible to modify PROCESS_TRUST_LABEL_ACE so that it allows changes? What shoud content of _SYSTEM_PROCESS_TRUST_LABEL_ACE be? https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntifs/ns-ntifs-_system_process_trust_label_ace https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_ace_header https://docs.microsoft.com/en-us/windows/desktop/secauthz/access-mask https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/23e75ca3-98fd-4396-84e5-86cd9d40d343 http://hakril.github.io/PythonForWindows/build/html/security.html#windows.security.SystemProcessTrustLabelACE
  19. I have a great solution. Use cisco remote desktop manager and connect to your remote vdi. Then you can minimize it and script runs perfect.
  20. I am creating an installation tool for installing kitchen video controllers. One of my prompts is to select the configuration on which station the user is installing. I do not have a touchscreen or mouse on these controllers and must use keyboard input (keys 1-4 and a-d). Is the _IsPressed() function the only or best way to do this? I am using While and Select/Case to detect input. I have noticed that sometimes I may need to tap the key a couple of times to be accepted. My sample is below and would appreciate any feedback if this is correct or there is a more efficient method. While 1         $guimsg = GUIGetMsg()          Select              Case $guimsg = $GUI_EVENT_CLOSE                  $term = 99                  ExitLoop              Case _IsPressed("31", $hDLL)                  GUIDelete()                  $term = 1                  ExitLoop              Case _IsPressed("32", $hDLL)                  GUIDelete()                  $term = 2                  ExitLoop              Case _IsPressed("33", $hDLL)                  GUIDelete()                  $term = 3                  ExitLoop              Case _IsPressed("34", $hDLL)                  GUIDelete()                  $term = 4                  ExitLoop              Case _IsPressed("41", $hDLL)                  GUIDelete()                  $term = 5                  ExitLoop              Case _IsPressed("42", $hDLL)                  GUIDelete()                  $term = 6                  ExitLoop              Case _IsPressed("43", $hDLL)                  GUIDelete()                  $term = 7                  ExitLoop              Case _IsPressed("44", $hDLL)                  GUIDelete()                  $term = 8                  ExitLoop          EndSelect     WEnd Thank you
  21. Here is another example: The following code is based upon one of the old scripts that I used years ago, just retested and it worked fine in Windows 10 x64 after a couple of modifications due to AutoIt changes: All credit Lod3n and Gary Frost #NoTrayIcon #include <GDIPlus.au3> #include <GuiComboBox.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 0) Global Const $AC_SRC_ALPHA = 1 Global Const $ULW_ALPHA = 2 ;~ Load PNG file as GDI bitmap _GDIPlus_Startup() Global $g_sBGImage = "C:\Program Files (x86)\AutoIt3\Examples\GUI\Torus.png" Global $g_hBGImage = _GDIPlus_ImageLoadFromFile($g_sBGImage) ;~ Extract image width and height from PNG Global $g_iWidth = _GDIPlus_ImageGetWidth($g_hBGImage) Global $g_iHeight = _GDIPlus_ImageGetHeight($g_hBGImage) ;~ Create Layered Window Global $g_hMainGui = GUICreate("lod3n launcher", $g_iWidth, $g_iHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($g_hMainGui, $g_hBGImage, 255) ;~ Register Notification Messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() WinSetOnTop($g_hMainGui, "", 1) ;~ Create child MDI Gui window to hold controls Global $g_hControlGui = GUICreate("ControlGUI", $g_iWidth, $g_iHeight + 40, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $g_hMainGui) ;~ The following image just needs to be a solid colour ;~ This allows you to drag the window/image GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\Advanced\Images\Blue.bmp", 0, 0, $g_iWidth, $g_iHeight + 40) GUICtrlCreateLabel("Floating Image", 10, $g_iHeight + 10, $g_iWidth - 20, 20, $SS_CENTER) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0x000000) GUICtrlSetFont(-1, 12, 800) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($g_hControlGui) ;~ Release Resources _WinAPI_DeleteObject($g_hBGImage) _GDIPlus_Shutdown() ; ==================================================================================================== ; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image. ; ==================================================================================================== Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $g_hMainGui) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST ; ==================================================================================================== ; SetBitMap ; ==================================================================================================== Func SetBitmap($hGUI, $g_hBGImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($g_hBGImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($g_hBGImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($g_hBGImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap
  22. #include <File.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <WinAPIGdi.au3> #include <ScreenCapture.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> Global Const $AC_SRC_ALPHA = 1 Global $GUI, $hGraphic, $hGraphic2, $hImage, $hImageR $GUI = GUICreate('IPMA', 100, 100, 300, 300, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0xABCDEF) GUISetState(@SW_SHOW, $GUI) _GDIPlus_Startup() _WinAPI_SetLayeredWindowAttributes($GUI, 0xABCDEF, 220) ;0xABCDEF 0xFFFFFF 0x000000 _SetGraphics(0, 0) Sleep(3000) Func _SetGraphics($x, $y) $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir&'\test.png') $hImageR = _GDIPlus_ImageResize($hImage, 100, 100, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($GUI) _GDIPlus_GraphicsDrawImageRect($hGraphic2, $hImageR, $x, $y, 75, 75) _GDIPlus_ImageDispose($hImage) _GDIPlus_BitmapDispose($hImageR) _GDIPlus_GraphicsDispose($hGraphic2) EndFunc ;==>_SetGraphics Nevermind the includes it was copy paste.
  23. Don't lock the desktop, and don't minimize the client.
  24. You always have to check the returncode of Hotkeyset (). If an error occurs, you must issue a warning message indicating which hotkey is already in use. Then you have to close the program in question and then repeat the Hotkeyset (). Or you change your program and use hotkeys that are never used by other programs.
  25. In that case will the hotkey only not work when I have the window in the foreground, Or not work universally?
  26. any other alternative than modifying the code? it's too late to do it as i have to present.
  27. https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F
  1. Load more activity
  • Create New...