Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/28/2019 in all areas

  1. To use transparency, the image must already contain transparent areas, if it does not contain them, it must be modified with a program that can manage transparency and choose the areas that must be transparent * . In short, transparency must already be present in the image. If you don't have or don't want to install a proper editing program, you can simply use an online image editor. A quick and simple example: open this site: http://www.online-image-editor.com/ upload the image to be modified; browse button and upload button (to keep the BMP format check "Convert during upload" and select BMP even if the image is already BMP otherwise it will be saved in PNG) select the "wizads" tab choose the "transparency" icon (the diamond) Click on the background of the image to make it transparent. save the modified image and use it in the script instead of the previous one. have fun
    2 points
  2. @FrancescoDiMuro After studying GUISetAccelerators(), my utility is functioning much better. Also, when I do have a mouse connected, I get the best of both worlds now. The lagging I was experiencing before is gone. Took me a few minutes to understand the array, but this is definitely an improvement to what I started with. Thank you!
    2 points
  3. ok, 16 or 61 maters not. There are simple basics one should be familiar with. The first one is the command prompt. I would recommend to first learn how to run batch files. Then maybe some basic HTML, just to see how changing markup language works. ( no CSS, javascript, etc., just HTML ) Once you have some experience with these files, then writing simple AutoIt code, is not so hard. cmd runs the .bat files. your browser runs .htm files. AutoIt runs the .au3 files. Learning something so abstract as coding, takes time. Take all the time that is needed. The mind needs time to work and the cycles are by sleep cycles, so it'll take days to learn, years to be able to do what some ppl here can do, and even them share their limitations at times, to get aid from those in the forums. So go at it. I did and now enjoy the know how Cheers
    2 points
  4. jchd

    I don't understand nothing

    @zoel Also try to avoid double negatives as it means the reverse of what you intend. That will help you improve your logic, something pretty useful for programing.
    2 points
  5. Subz

    CMD output

    Download and install the full script editor: https://www.autoitscript.com/site/autoit-script-editor/downloads/ When you run your code within Scite it will give you more error information, in this case you are missing udfs at the top of your script, in the examples in the help file remember to note down the includes required for that function/variable: #include <Array.au3> ;~ This is for the _ArrayDisplay() function #include <AutoItConstants.au3> ;~ This declares the $STDOUT_CHILD Variable #include <MsgBoxConstants.au3> ;~ This declares the $MB_SYSTEMMODAL variable NB: There are other functions that would capture a folder paths i.e. _FileListToArrayRec which don't require CMD.
    1 point
  6. JLogan3o13

    CMD output

    Post the code you're using, and the error you're getting - not difficult
    1 point
  7. JLogan3o13

    CMD output

    How about posting what you are trying, or the error, rather than asking us to guess?? We cannot assist if you continue forcing us to pull teeth to get info from you. Be aware, this is not a forum where someone is going to spoon feed it to you and do all the work for you. We're more than happy to help, but the "I can't do it, do it for me" attitude will get you nowhere.
    1 point
  8. I modified @Chimp's example. #include <GuiImageList.au3> #include <WinAPI.au3> #include <GDIPlus.au3> ; ---------------------- ; https://www.autoitscript.com/forum/topic/97902-trayseticon-with-handle/ Global Const $tagNOTIFYICONDATAW = _ 'dword cbSize;' & _ 'hwnd hWnd;' & _ 'uint uID;' & _ 'uint uFlags;' & _ 'uint uCallbackMessage;' & _ 'hwnd hIcon;' & _ 'wchar szTip[128];' & _ 'dword dwState;' & _ 'dword dwStateMask;' & _ 'wchar szInfo[256];' & _ 'uint uVersion;' & _ 'wchar szInfoTitle[64];' & _ 'dword dwInfoFlags;' ; & $tagGUID Global $tNID = DllStructCreate($tagNOTIFYICONDATAW), $pNID = DllStructGetPtr($tNID) Global $hWnd = WinGetHandle(AutoItWinGetTitle()), $hIcon DllStructSetData($tNID, 'cbSize', DllStructGetSize($tNID)) DllStructSetData($tNID, 'hWnd', $hWnd) ;HWnd($hGUI)) ; DllStructSetData($tNID, 'uID', 1) DllStructSetData($tNID, 'uFlags', 3) ; ---------------------- Global $hBmp_Anim, $hGfx, $hFrames Opt("GUIOnEventMode", 1) HotKeySet("{ESC}", "Quit") Example() Func Example() _GDIPlus_Startup() ; Load Image Local $hBitmap_l = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Bitmap351.png") Local $iW = _GDIPlus_ImageGetWidth($hBitmap_l), $iH = _GDIPlus_ImageGetHeight($hBitmap_l) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;convert black to transparent color - not really needed here as there are not much opaque background pixels visible Local $aRemapTable[2][2] $aRemapTable[0][0] = 1 $aRemapTable[1][0] = 0xFF000000 ;black $aRemapTable[1][1] = 0 ;transparent Local $hIA = _GDIPlus_ImageAttributesCreate() _GDIPlus_ImageAttributesSetRemapTable($hIA, $aRemapTable) _GDIPlus_GraphicsDrawImageRectRect($hGfx, $hBitmap_l, 0, 0, $iW, $iH, 0, 0, $iW, $iH, $hIA) _GDIPlus_ImageDispose($hBitmap_l) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageAttributesDispose($hIA) ; there are 31 images (frames) in strip Local $iFramesInStrip = 31 Local $iFrameWidth = 18 Local $iFrameHeight = 32 $hFrames = _GDIPlus_BitmapCreateFromScan0($iFrameWidth * $iFramesInStrip, $iFrameHeight) $hGfx = _GDIPlus_ImageGetGraphicsContext($hFrames) Local $sx = 0, $dx = 0 For $i = 1 To $iFramesInStrip - 3 _GDIPlus_GraphicsDrawImageRectRect($hGfx, $hBitmap, 20 + $sx, 22, $iFrameWidth, $iFrameHeight, $dx, 0, $iFrameWidth, $iFrameHeight) $sx += 32 $dx += $iFrameWidth Next ;the last 3 images have a different offset $sx -= 8 For $i = $iFramesInStrip - 2 To $iFramesInStrip _GDIPlus_GraphicsDrawImageRectRect($hGfx, $hBitmap, 20 + $sx, 22, $iFrameWidth, $iFrameHeight, $dx, 0, $iFrameWidth, $iFrameHeight) $sx += 32 $dx += $iFrameWidth Next _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap) ; release GDIPlus bitmap because not needed anymore ;_GDIPlus_ImageSaveToFile($hFrames, @ScriptDir & "\TestStripe.png") $hBmp_Anim = _GDIPlus_BitmapCreateFromScan0(16, 16) $hGfx = _GDIPlus_ImageGetGraphicsContext($hBmp_Anim) ; Create a little GUI $hGUI = GUICreate("Demo", 150, 80) GUICtrlCreateLabel("see the tray icon...", 10, 10, 140) GUICtrlSetFont(-1, 12) GUICtrlCreateButton("Quit", 40, 40, 80) GUICtrlSetOnEvent(-1, "Quit") GUISetState(@SW_SHOW) $sx = 0 Do For $i = 1 To $iFramesInStrip ; loop all frames _GDIPlus_GraphicsClear($hGfx, 0) _GDIPlus_GraphicsDrawImageRectRect($hGfx, $hFrames, $sx, 0, $iFrameWidth, $iFrameHeight, 2, 0, 12, 16) $sx += $iFrameWidth If $sx > $iFrameWidth * ($iFramesInStrip - 1) Then $sx = 0 $hIcon = _GDIPlus_HICONCreateFromBitmap($hBmp_Anim) DllStructSetData($tNID, 'hIcon', $hIcon) _Shell_NotifyIcon(1, $pNID) ; TraySetIcon() _WinAPI_DestroyIcon($hIcon) Sleep(250) Next Until False EndFunc ;==>Example Func Quit() ; free memory _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageDispose($hBmp_Anim) _GDIPlus_BitmapDispose($hFrames) _GDIPlus_Shutdown() _WinAPI_DestroyIcon($hIcon) GUIDelete() Exit EndFunc ;==>Quit Func _Shell_NotifyIcon($iMessage, $pdata) Local $aRet $aRet = DllCall('shell32.dll', 'int', 'Shell_NotifyIconW', 'dword', $iMessage, 'ptr', $pdata) If @error Then Return SetError(1, 0, 0) Return $aRet[0] EndFunc ;==>_Shell_NotifyIcon The attached image above is in PNG format, anyhow if you have it in BMP format then you should modify the line 40 accordingly, which should also work. Uncomment line 80 to save new created bitmap.
    1 point
  9. BrewManNH

    CMD output

    Open the help file, look at STDOutRead, try the example script to see how it's done, and learn something new. Or search the forum here for the 1000's of examples using stdoutread.
    1 point
  10. JLogan3o13

    CMD output

    @zoel "doesn't work" should be banned from the English language. How about some detail on what isn't working as expected? You mentioned outputting a command to your Edit (now Input) control, but I see no code written to do this.
    1 point
  11. BrewManNH

    CMD output

    Don't use an Input control, use an Edit control, use the Run function and look in the help file for examples using $STDERR_MERGED or $STDOUT_CHILD to get the output of the command you're running.
    1 point
  12. Jos

    I don't understand nothing

    @zoel, You do realize that your title contains a double negative meaning your statements means "You understand everything!". Jos
    1 point
  13. Melba23

    I don't understand nothing

    zoel, We understand your problem, but please stick to just the one thread - merged. And as I suggested above, decide on a simple project to code in AutoIt and see what you can do on your own first. You will find lots of help here if you make some effort yourself and do not expect others to spoon-feed you code - which woul not help you learn anyway. M23
    1 point
  14. @TekWeis Happy to have helped
    1 point
  15. Subz

    I don't understand nothing

    The Autoit help file is really helpful source to understanding how functions work, majority of the functions include examples, remember to utilize the help file search which will usually display relevant topics. If you're unsure about how to do something use Google Search for example Autoit Query... 9 times out of 10 it will find posts in this forum that have already covered the topic. If you're still unable to find the answer ask in the forums, just remember that the majority of people in the forums don't like to spoon feed and want to see the person has at least made an attempt to resolve the issue on their own. This is how I learned Autoit, although still have a lot to learn. Just my 2 cents
    1 point
  16. matwachich, You are not quite alone as you can see here. I have tweaked the positions a bit - how does this seem to you? M23
    1 point
  17. 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.
    1 point
  18. Trong

    Command line output

    This is an example of running a command and retrieving data from cmd (may help you) Local $iCommand='ping 8.8.8.8' Local $iReturn=_RunWait($iCommand) MsgBox(262144, $iCommand, $iReturn) Func _RunWait($sCommand) ConsoleWrite("! RUN: " & $sCommand & @CRLF) Local $sOutput, $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand & ' 2>&1', @ScriptDir, @SW_HIDE, 1+2+4) ;$STDERR_CHILD + $STDOUT_CHILD Local $itry = 100 While $itry $sLine = StdoutRead($iPID) If (@error) Then ExitLoop If (Not ProcessExists($iPID)) Then $itry -= 1 If $sLine <> "" Then $sOutput &= $sLine ConsoleWrite($sLine) EndIf WEnd ;~ ConsoleWrite("- OUT: " & @CRLF & $sOutput & @CRLF & @CRLF) Return $sOutput EndFunc ;==>_RunWait
    1 point
  19. Trong

    Autoit CMD

    Examples of CMD in Autoit GUI! #include <GUIConstants.au3> #include <Constants.au3> Global $hGUI = GUICreate("AutoIt CMD", 604, 320, -1, -1) Global $cCommand = GUICtrlCreateInput("ping google.com", 64, 10, 416, 21) GUICtrlCreateLabel("CMD: >", 20, 15, 40, 20) Global $cExecute = GUICtrlCreateButton("Execute Command!", 485, 8, 112, 25) Global $cOutputBox = GUICtrlCreateEdit("", 10, 47, 578, 260, $ES_READONLY + $ES_MULTILINE + $WS_HSCROLL + $WS_VSCROLL + $ES_AUTOVSCROLL) ;$ES_READONLY=2048, $ES_MULTILINE=4, $WS_HSCROLL=0x00100000, $WS_VSCROLL=0x00200000, $ES_AUTOVSCROLL=64 GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) Global $sCommand While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; $GUI_EVENT_CLOSE=-3 Exit Case $cExecute $sCommand = GUICtrlRead($cCommand) If StringStripWS($sCommand, 8) <> "" Then GUICtrlSetState($cCommand, $GUI_DISABLE) ;$GUI_DISABLE=128 GUICtrlSetState($cExecute, $GUI_DISABLE) GUICtrlSetData($cExecute, " eXecuting..... ") _ExecuteCommandStream($sCommand) ;~ GUICtrlSetData($cOutputBox, _ExecuteCommand($sCommand)) GUICtrlSetData($cExecute, "Execute Command") GUICtrlSetState($cExecute, $GUI_ENABLE) ; $GUI_ENABLE=64 GUICtrlSetState($cCommand, $GUI_ENABLE) EndIf EndSwitch WEnd Func _ExecuteCommandStream($sCommand) Local $cCommandinfo = Run('"' & @ComSpec & '" /c ' & $sCommand, @ScriptDir, @SW_HIDE, $STDERR_MERGED) ;$STDERR_MERGED=8 Local $sOutput, $sOutputError While 1 GUICtrlSetData($cOutputBox, $sOutput & @CRLF) $sOutput &= StdoutRead($cCommandinfo) If @error Then ExitLoop Sleep(50) WEnd GUICtrlSetData($cOutputBox, $sOutput & @CRLF) EndFunc ;==>_ExecuteCommandStream Func _ExecuteCommand($sCommand) Local $cCommandinfo = Run('"' & @ComSpec & '" /c ' & $sCommand, @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD) ;$STDERR_CHILD=4, $STDOUT_CHILD=2, $STDIN_CHILD=1 Local $sOutput, $sOutputError While 1 $sOutput &= StdoutRead($cCommandinfo) If @error Then ExitLoop WEnd While 1 $sOutputError &= StderrRead($cCommandinfo) If @error Then ExitLoop WEnd If $sOutput <> '' Then Return $sOutput ElseIf $sOutputError <> '' Then Return SetError(0, 1, $sOutputError) Else Return SetError(0, 2, "") EndIf EndFunc ;==>_ExecuteCommand
    1 point
×
×
  • Create New...