Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. 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.
  3. 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
  4. 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
  5. Today
  6. #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.
  7. Don't lock the desktop, and don't minimize the client.
  8. 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.
  9. In that case will the hotkey only not work when I have the window in the foreground, Or not work universally?
  10. any other alternative than modifying the code? it's too late to do it as i have to present.
  11. https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F
  12. Hi, When I run autoit script in remote vdi, it does not work when I minimize the window of the remote desktop. How do I solve this problem? I want the scripts to run even when I am not logged in to that machine or minimized the remote desktop window. I cannot change codes at this moment. so any other advice?
  13. I've been trying to make a transparent splash PNG image. Looked everywhere on the forum, and every example i found doesn't seem to work anymore. Is there an 'easy' way to perform this?
  14. Good day all, I am trying to find out what approach you guys take to update your app say from a file or web server to make sure the latest version is always being used. I looked through the help file and UDF's but I am not seeing anything for this, perhaps I am looking for the wrong terms.
  15. You just aren't reading or comprehending what is told to you. I'm out of this stupid conversation, you will never accept the FACT that this can't be done in AutoIt and will never be able to be done.
  16. The updated function should not be changed in the runtime! i only want to edit the main tool and all of its functionality while it is not running. But i want to edit the functions in the text editor as real functions and not in a string variable which i pass to the programm
  17. decompiling my own script on the runtime would be an solution too which i would accept if there is no other solution. i would also work with the #save_source parameter if theres no other way to accomplish this .... and thank you for the explanation. but just another question, if i copy 1:1 the memory from the beginning to the function to the end of the function, then why couldn't i call the function ? cause i give the programm the information what to do and as i know which function it is, why shouldnt i been able to pass the correct call with the correct (new) address to the newly created temporary script?
  18. You can't create a self-updating script while it is running, you'd have to stop the script, and then restart it with the new code. You can't do this on an executable, it could only work as a script. You COULD put your code in a separate file, create an A3X file, restart your script that includes the a3x file and it will read the new code in that file. But you'd have to restart the script to do it, and it could be done using an exe and not just a script. Another conundrum you're going to run into is what kind of changes are you making to the updated function and will the old code that calls it still run as expected. I can only see a disaster in the making if the new code fundamentally alters the script functionality and you have no way to program that into the main program. I personally think it's a terrible idea, and bound to cause more problems than you think you're solving with this attempt.
  19. Local $l = @ScriptDir & "\tmp_call.au3", $r, $e, $a              Dim $CallBack = DllCallbackRegister("_CallMeFunction", "int", "int;int;int;bool") ; i want the address of  the autoit function     ConsoleWrite( "!$CallBack:        "& $CallBack & @CRLF )         $a = DllCallbackGetPtr($CallBack)         ConsoleWrite( "!DllCallbackGetPtr:    "& $a & @CRLF )  ; i got the address of  the autoit function     ; here should be a part which "extract" runnable autoit code from the memory / i would also map the code into the memory/ if possible - but i want to avoid creating a function like:     #cs         $test_string = 'Func _CallMeFunction( $a=1, $b=2, $c=3, $externalCall=False )' & @CRLF & _                     'If ($externalCall = True) Then' & @CRLF & _                         'MsgBox(0, "external", "call - running in its own script " & $a & $b & $c  )' & @CRLF & _                     'ElseIf ($externalCall = False) Then' & @CRLF & _                         'MsgBox(0, "internal", "call - running in the main script " & $a & $b & $c  )' & @CRLF & _                     'EndIf' & @CRLF & _                     'Return 1' & @CRLF & _                     'EndFunc' & @CRLF & _                     '_CallMeFunction()'           and preferable be able to just to something like this :     #ce        $r = _ExtractAutoItCodeFromMemory( $a, '_CallMeFunction', $lenght )         FileWrite( $l , $r )         $e = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $l & '"' )         ConsoleWrite( "!Run:            "& $e & @CRLF )         MsgBox(0, $e, $a )         Exit   Func _CallMeFunction( $a=1, $b=2, $c=3, $externalCall=True )     If $externalCall = True Then         MsgBox(0, "external", "call - running in its own script " & $a & $b & $c  )     ElseIf $externalCall = False Then         MsgBox(0, "internal", "call - running in the main script " & $a & $b & $c  )     EndIf     Return 1 EndFunc I tried to describe the problem with this. I want programm A Programm A has a lot of functionality, some of the functionality actually need quite some time to complete and meanwhile programm A is unusable. But Programm A has do be interactable all the time - because it some sort of template editor/manager, when i press F2 it sends a template with ctrl+v or f3 another one or f4 another one. Also is has to be able to load a website and extract its data and display the data for me <- while it is doing this, I'm unable to use the programm Also it has to navigate on the website (like for example) in a new tab WHILE its extracting data from another tab and has to do some tasks there AND while it is doing that i need still be able to press F2,F3,F4 OR use the entire GUI. The problem i have right now is, i have tool A (hotkeys) tool B (extracting) tool C (doing functionality on a website) tool D,E,F etc. - actually its really a lot of functionality and its REALY uncomfortable to start 15 exe files each time i boot the pc or if one is crashing restart it. AND its also realy uncomfortable to create the script in an "COPROCESS" unit like : $test_string = 'Func _CallMeFunction( $a=1, $b=2, $c=3, $externalCall=False )' & @CRLF & _                     'If ($externalCall = True) Then' & @CRLF & _                         'MsgBox(0, "external", "call - running in its own script " & $a & $b & $c  )' & @CRLF & _                     'ElseIf ($externalCall = False) Then' & @CRLF & _                         'MsgBox(0, "internal", "call - running in the main script " & $a & $b & $c  )' & @CRLF & _                     'EndIf' & @CRLF & _                     'Return 1' & @CRLF & _                     'EndFunc' & @CRLF & _                     '_CallMeFunction()' Because i MAY have to align the code quickly and/ or change a lot of lines and test them,. This is also in no way comfortable. So what I'm trying to do - I want to create one tool which merges ALL the functionality into itself and then i want a function like: _getFuncToFileAndRun( @autoitexe, $funcname, $nParam, $paramdelim='|') Then this function should extract the current and actuall function in my code with every code change and write it into TEMP_AU3.au3 and start it with /autoit3executescript The difference between all coprocess i know so far - is the calling of the function! I do not want to hardcore the function into an function call - i want the function to extract the requested function out of the programm itself dynamically and then use it to run the function in a newly created .au3 script. I would also be down to decompile the script on the fly, parse the source - get the function and delete the decompiled source - but i dont even know if this is possible I would also accept the #save_source parameter for this to work - this is no question of having open/visible source as i want to use this in my company for work efficiency. I don't even want fully functional code, just a small push in the right direction :(... (I also have some sort of garbage collector in mind which watches the actuall processes and cleans up the temp files.) actually while writing this, i realize i could just let the compiled exe file in the source directory and then wildly call the available includes. - but honestly this would be the last option i would like to choose, as it feels dirty even thinking in this direction.
  20. Sounds good. I'll pull out that W10 1809 ISO that I've been waiting for McAfee to support. Don't spend time on the past for me. FotF - Focus on the Future. Your time is too valuable building NEW FUNCTION to spend it on past-tense-trivia - PTT. Phil
  21. start with describing the problem instead of describing solutions. It seems like you want some kind of plugin logic in a precompiled exe.
  22. Thanks for this udf. Could you add an indeterminate state for checkbox ? I tried, but my gdi experience isn't very good.
  23. Agreed, he could easily annonimize his code as a small reproducing snippet, but if he just wants to spin his tires, so be it
  24. Good luck with that, might need WikiLeaks to get anything useful to work with.
  25. Reread your issues, and imagine you are one of us. Errors occur for a reason, and they are specific to something, but you have provided no details. What do you expect other than a comment like this asking for more info? Add a code snippet that we can run and reproduce the issue with.
  26. That's getting dangerously close to decompiling the script. The reason you can't call a function from memory in another script to yours is that the function has to exist in the first script or it won't be recognized, you can't create phantom functions in a script by pulling them in from elsewhere. The calling script has to know that the function exists, and has to know where in the script this function is, at runtime, so if it's not there when the script starts, the interpreter doesn't know about it.
  27. abhinav_sodha, That is exactly what I have done - as I said above. M23
  1. Load more activity
×
×
  • Create New...