Leaderboard
Popular Content
Showing content with the highest reputation on 10/09/2021 in all areas
-
LAST VERSION - 1.8 02-Nov-09 Deprecated. The library contains three basic functions. I always use these functions and decided to share them with the community. I hope that to some of you they will be useful. To understand why this is done, please look at my examples. History Available functions Icons UDF Library v1.8 Previous downloads: 1268 Icons.au3 Example #Include <GUIConstantsEx.au3> #Include <Icons.au3> Global Const $sPng = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\Examples\GUI\Advanced\Images\Torus.png' Global Const $sJpg = @TempDir & '\~wallpaper.jpg' Global Const $sGreen = @TempDir & '\~green.png' Global Const $sRed = @TempDir & '\~red.png' Global Const $sLogo = @TempDir & '\~logo.png' Example1() Example2() Example3() Example4() Example5() Example6() Example7() Func Example1() GUICreate('Example1', 204, 108) $Icon1 = GUICtrlCreateIcon('', 0, 30, 38, 32, 32) $Icon2 = GUICtrlCreateIcon('', 0, 88, 38, 32, 32) $Icon3 = GUICtrlCreateIcon('', 0, 146, 38, 32, 32) GUISetState() _SetCombineBkIcon($Icon1, -1, @SystemDir & '\shell32.dll', 70, 32, 32, @SystemDir & '\shell32.dll', 22, 24, 24, 0, 8) _SetCombineBkIcon($Icon2, -1, @SystemDir & '\shell32.dll', 3, 32, 32, @SystemDir & '\shell32.dll', 28, 32, 32) _SetCombineBkIcon($Icon3, -1, @SystemDir & '\shell32.dll', 220, 32, 32, @SystemDir & '\shell32.dll', 29, 32, 32) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example1 Func Example2() GUICreate('Example2', 216, 128) $Icon = GUICtrlCreateIcon('', 0, 40, 40, 48, 48) GUICtrlCreateIcon(@WindowsDir & '\explorer.exe', 0, 128, 40, 48, 48) GUISetState() _SetIcon($Icon, @WindowsDir & '\explorer.exe', 0, 48, 48) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example2 Func Example3() GUICreate('Example3', 715, 388) $Pic1 = GUICtrlCreatePic('', 10, 10, 386, 368) $Pic2 = GUICtrlCreatePic('', 406, 10, 193, 184) $Pic3 = GUICtrlCreatePic('', 609, 10, 96, 92) GUISetState() _SetImage($Pic1, $sPng) _SetImage($Pic2, $sPng) _SetImage($Pic3, $sPng) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example3 Func Example4() GUICreate('Example4', 253, 244) $Pic1 = GUICtrlCreatePic('', 10, 10, 193, 184) $Pic2 = GUICtrlCreatePic('', 60, 60, 193, 184) GUISetState() _SetImage($Pic2, $sPng) _SetImage($Pic1, $sPng) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example4 Func Example5() Local $aIndex[10] = [4, 13, 23, 31, 86, 104, 130, 150, 168, 170] GUICreate('Example5', 600, 400) $Pic = GUICtrlCreatePic('', 0, 0, 600, 400) For $i = 1 To UBound($aIndex) GUICtrlCreatePic('', Random(0, 600 - 48, 1), Random(0, 400 - 48, 1), 48, 48) $hIcon = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', $aIndex[$i - 1], 48, 48) $hBitmap = _Icons_Bitmap_CreateFromIcon($hIcon) _SetHImage($Pic + $i, $hBitmap) _WinAPI_DeleteObject($hBitmap) _WinAPI_DestroyIcon($hIcon) Next GUISetState() InetGet('http://dota.ru/3d/big/p324_42.jpg', $sJpg) $hBitmap = _Icons_Bitmap_Load($sJpg) $hArea = _Icons_Bitmap_Crop($hBitmap, 420, 320, 600, 400) _SetHImage($Pic, $hArea) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hArea) FileDelete($sJpg) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example5 Func Example6() GUICreate('Example6', 800, 500) $Background = GUICtrlCreatePic('', 0, 0, 800, 500) GUICtrlSetState(-1, $GUI_DISABLE) $Button = GUICtrlCreateButton('Test', 355, 460, 90, 23) $Pic1 = GUICtrlCreatePic('', 102, 122, 256, 256) $Pic2 = GUICtrlCreatePic('', 442, 122, 256, 256) GUISetState() InetGet('http://autoit.rv.ua/files/Pictures/icons_ex_back.jpg', $sJpg) InetGet('http://autoit.rv.ua/files/Pictures/icons_ex_green.png', $sGreen) InetGet('http://autoit.rv.ua/files/Pictures/icons_ex_red.png', $sRed) _SetImage($Background, $sJpg) $hGreen = _Icons_Bitmap_Load($sGreen) $hRed = _Icons_Bitmap_Load($sRed) _SetHImage($Pic1, $hRed) _SetHImage($Pic2, $hRed) FileDelete($sJpg) FileDelete($sGreen) FileDelete($sRed) $pCtrlID = 0 While 1 $Cursor = GUIGetCursorInfo() If @error Then ContinueLoop EndIf $nCtrlID = $Cursor[4] If $nCtrlID <> $pCtrlID Then Switch $pCtrlID Case $Pic1 _SetHImage($Pic1, $hRed) Case $Pic2 _SetHImage($Pic2, $hRed, -1) EndSwitch Switch $nCtrlID Case $Pic1 _SetHImage($Pic1, $hGreen) Case $Pic2 _SetHImage($Pic2, $hGreen, -1) EndSwitch $pCtrlID = $nCtrlID EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button GUICtrlSetState($Button, $GUI_DISABLE) For $i = 1 To 50 GUIGetMsg() _SetHImage($Pic1, $hGreen) _SetHImage($Pic2, $hGreen, -1) Sleep(50) _SetHImage($Pic1, $hRed) _SetHImage($Pic2, $hRed, -1) Sleep(50) Next GUICtrlSetState($Button, $GUI_ENABLE) EndSwitch WEnd GUIDelete() EndFunc ;==>Example6 Func Example7() GUICreate('Example7', 400, 93) $Pic = GUICtrlCreatePic('', 0, 0, 400, 93) $hIcon = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', 86, 24, 24) $hBitmap = _Icons_Bitmap_CreateFromIcon($hIcon) For $i = 1 To 5 GUICtrlCreatePic('', 258 + ($i - 1) * 28, 12, 24, 24) _SetHImage($Pic + $i, $hBitmap) Next _WinAPI_DeleteObject($hBitmap) _WinAPI_DestroyIcon($hIcon) GUISetState() InetGet('http://www.autoitscript.com/forum/public/style_images/autoit/logo.png', $sLogo) $hBitmap = _Icons_Bitmap_Load($sLogo) $hArea = _Icons_Bitmap_Crop($hBitmap, 0, 7, 400, 93) _SetHImage($Pic, $hArea) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hArea) FileDelete($sLogo) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example7 GUICtrlSetOnHover & Icons UDFs Demonstration Icons_Hover.zip1 point
-
(Poll) What features do you wish you had in AutoIt?
TheDcoder reacted to argumentum for a topic
@CoffeeJoe, there is forking you can do with AutoIt. Look at my signature.1 point -
I am way late to the discussion, and I'm not sure its still open. My request is intended to be more broad than specific. I want some sort of parallel processing capability. Call it multi-threading, call it multi-processing, call it bob. For me I'd be happy if AdlibRegister simply spawned a new process and didn't require the main process to even notice. Programming in Java was fun and I see people talking about OOP - for me the one thing I miss is Instantiation - again an issue without parallel processing. Then I remember that its a scripting language not an application development platform. Just the things I was thinking as I tread through this thread.1 point
-
Most machines (e.g. our PCs) use 2's complement representation for integers.1 point
-
Signed integer vs unsigned integer? Hex2Dec function written by @Malkey, should return the correct values. Func Hex2Dec($iN) Local $aN, $ihex = 0 $aN = StringSplit(StringTrimLeft($iN, 2), "", 1) For $x = 1 To UBound($aN) - 1 $ihex += Dec($aN[$x]) * (16 ^ (UBound($aN) - 1 - $x)) Next Return $ihex EndFunc ;==>Hex2Dec1 point
-
Detect screen change (NOT FOR A GAME!)
AlessandroAvolio reacted to Atamisk for a topic
For anyone else running into this same issue of the mouse position being off, I figured it out! Well, You guys figured it out but I found the post that had the needed info in it. So my DPI was set to 125% and as stated here So I changed everything back to 100% and used the mouse position from auto IT window program and it worked! it was giving the correct position. So in case anyone runs into this problem with using mouse position, change your windows DPI back to 100%!1 point -
SSH UDF
seadoggie01 reacted to ptrex for a topic
Hi, Thanks for sharing but ... I wonder why you use an external app to create an SSH cleient. While W10 has this out of the box using the SSH command usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]] destination [command] Which also integrates in Windows Terminal https://docs.microsoft.com/en-us/windows/terminal/tutorials/ssh1 point -
On 64-bit systems you need to run 64-bit version of cmd, example: ;~ The following script can be compiled as 32-bit #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) RunWait(@ComSpec & " /k " &'ssh -o "StrictHostKeyChecking no" user@server' ,"", @SW_SHOW) _WinAPI_Wow64EnableWow64FsRedirection(True) Or just compile the script as 64-bit #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** RunWait(@ComSpec & " /k " &'ssh -o "StrictHostKeyChecking no" user@server' ,"", @SW_SHOW)1 point
-
Fork UDF (ish)
CoffeeJoe reacted to argumentum for a topic
Forking and threading. They both do stuff while another loop or event handler, does it's thing. Load a DLL, and ask for a function or procedure to run, and it'll do it. Handling all those takes time waiting, or to come up with semaphores and mutex and what not. So the issue at times is that we want to have all that in AutoIt and there comes the OMGs. To me, it all comes to run something and not get the main loop stuck waiting, unresponsive, as if frozen. ( oh, there is no threading in AutoIt, what can I do ! ) Hence this UDFish ( I'm not good at technical writing 😕 ), that has these functions: #cs === User Calltips: =============================================================================================== _Fork_Startup() Init. UDF - Place on your main script once everything is declared. _Fork_StartupOnFailMsgBox([$ShowMsgBox = Default]) Default = (not @compiled), True = Show error MsgBox(), False = Do Not show error MsgBox() _Fork_Func([$sFunction = Default], [$vParameter = ""], [$sExtraCmdLine = ""], [$iUseBase64Cmd = 0], [$sVerb = ""]) Starts another Process and Execute or Call $sFunction, Returns PID. _Fork_SetReceiver([$sFunction = ""]) Register/Unregister IPC Receiver Function. _Fork_GetReceiver() Get IPC Receiver Function name. _Fork_GetParentPID() Get the parent PID. _Fork_GetWinInfos([$AutoItWinTitlePrefix = Default],[ $ForkPID = ""]) Get an array of Forked Processes _Fork_CallArgArraySeparatorChar($sChar = Default) Default = Opt("GUIDataSeparatorChar") _Fork_AutoItWinTitlePrefix([$sPrefix = Default]) Returns the prefix, or set it by passing a new string. _Fork_ForkReceiverGuiTitlePrefix([$sPrefix = Default]) Returns the prefix, or set it by passing a new string. _Fork_ProcessGetWinList($vProcess, $sTitle = Default, $iOption = 0) Enumerates Windows of a Process. _Fork_WaitForReceiver($iPidChild, [$iTimeout = 60 Sec]) wait for _Fork_SetReceiver() to load via AutoItWinSetTitle(). _Fork_WaitForFork($iPidChild, [$iTimeout = 60 Sec]) wait for _Fork_Func() to load via AutoItWinSetTitle(). _Fork_Send($vPidOrHWnd, $sMessage,[$iTimeout = 500 mSec],[$fAbortIfHung = True]) Send IPC Message to Process via PID or hWnd. _Fork_Broadcast($sMessage, [$iTimeout = 500 mSec], [$fAbortIfHung = True], [$iDelayMs = 0], [$iExcludeSelf = 1], [$WinCloseAll = 0]) Send IPC Message broadcast to all in _Fork_AutoItWinTitlePrefix(), see comments. _Fork_DuplicateHandle($dwSourcePid, $hSourceHandle, $dwTargetPid = @AutoItPID, $fCloseSource = False) Returns a Duplicate handle. _Fork_GetVerUDF() Returns the version of this UDF. _DbgAid_SetActive([$Active = Default]) Enable sending data for debug: Default = Auto (True if Win found), True = Enable, False = Disable. _DbgAid_GetActive() Query Active state. _DbgAid_GuiTitle([$sTitle = Default]) Get or Set the GUI title for the debug receiver. _DbgAid_SelfName([$sSelfName = Default]) Get or Set a short name to be identified by. _DbgAid_Send($sString[, $iForceType = Default]) Send a string to the debug GUI. _DbgAid_SendVia([$iType = Default / $e_ForkDbgAid_ViaCOPYDATA / $e_ForkDbgAid_ViaMailslot]) Get / Set _DbgAid_Send() type. #ce === User Calltips: =============================================================================================== I believe that, with these functions, one can run a function in any count of other PIDs, communicate back and forth with any of them, and a console of sorts, to send data to follow what is happening with those other instances. This is basically a rewrite of "Another Multi Process Helper" by @piccaso. The functions not ported, I decided to not port. The renamed functions, are renamed to simplify the understanding of what they do, from a view of a ... me I did this because I'll need it in an upcoming project, and share it to aid those, that may find this, simple to implement in their code. Try the examples from SciTE ( or your editor ) and read the code, as there are notes explaining how it works. As always, share your views and improvements. If you have coding questions, kindly place them in "AutoIt General Help and Support". _Fork_UDF(v2019.06.29d).zip ( current version )1 point