Leaderboard
Popular Content
Showing content with the highest reputation on 04/22/2015 in all areas
-
Pool provides multiple AutoIt processes with an infrastructure for exchanging messages, data, and remote-control instructions, on a single machine or on a local area network. It is modelled partly on HTCondor, but also incorporates user-defined messages (UDM), LANchat, mails, data Container shipping management, and remote power control and remote execution. That last feature means one process can send lines of AutoIt script to another process, and run it there (including batch control and synchronisation). Consider it my take on inter-process communication (IPC). Pool incorporates many contributions (a few are included in the bundle, other tiny snippets are part of the main script), from other forum members without whom this project simply would never even have been conceivable. In particular, I hereby want to acknowledge the excellent work of Zatorg, wraithdu, W0uter, Ward, ValeryVal, spudw2k, trancexx, This-is-Me, Nomad, Nine, Manadar, LazyCat, Lakes, Kip, Kealper, Jos, Greencan, FredAI, evilertoaster, dragan, Chimp, and AdamUL. Some codes merely helped to clarify my novice understanding of various IPC issues, others have been gratefully integrated. Three contributors need special mention: Kip & Zatorg for event-driven TCP, and trancexx for MailSlot; together these form the backbone of everything else. The only reason I still dare to publish this under my own name is because I did add over ten thousand lines of code myself. Nevertheless, Pool may serve as a showcase for how various members' example scripts can be combined into a comprehensive environment. Many, many thanks to everyone involved! Pool is designed to be simple to use. Only a few functions are public, and of those, you really only need to study these four control UDFs: _Pool_Send_Command(): Pool's Command & Control Centre (see list of commands below) _Pool_Send_UserDefinedMsg(): define your own outgoing msgs _Pool_Receive_UserDefinedMsg(): process your own incoming msgs _Pool_Send_ExeQcall(): send one or more AutoIt instructions to target's Exe-Queue (ExeQ) and these ones for data transfers: _Pool_Container_Create(): associate shipping Container with data _Pool_Container_Destroy(): release Container memory and all associated Sharing relations _Pool_Container_CreateShare(): associate destination with Container _Pool_Container_DestroyShare(): dissolve sharing association for destination To get an idea of what _Pool_Send_Command() can do, here's the list of commands: Pool is big. It has got many dozens of fixed and dynamic user-defined settings to create specific applications with (see #Region Globals). Please take the time to read the extensive Remarks section at the top of the main script (Pool.au3), including the warnings and limitations. Furthermore, I've provided two example environments in the subdir Examples in the bundle: CLNtest (messages and remote execution) and CLNmaster + CLNslave (data Container shipping). If you run these on a single machine, you'll need to start PostOffice_Solo; on multiple machines, one should start first with PostOffice_Server, the rest with PostOffice_Client, once the Server is initialised. See the readme.txt in the Examples subdir for additional help. Another example (multi-processing a la Condor) is shipped with release 2.4+ of Eigen4AutoIt. Since this is an Example script, you can find a number of interesting design ideas in Pool: Pool.v0.7.7z Pool bundle, second beta release, version 0.7 IMPORTANT CAVEAT This is an experimental beta release. Some parts of Pool have never been tested, others only in the simplest possible setting (the largest network I ever tested comprised one desktop and three laptops (one with busted radio) on a crappy Wifi router; I've never tested it on a cabled network). The (W)LAN part still has many issues and may not be able to handle more than a few machines. There's no callstack error handler. Event-driven TCP remains glitchy, and some of my MailSlots keep malfunctioning. I also lack access to Windows 8.* test environments. In addition, many issues you may encounter will be due to specific timings/event sequencing (which makes it hard to debug) and/or your specific infrastructure. That means that, most likely, I cannot recreate your Pool bugs (even with your scripts), so I cannot fix them either. Therefore, I will not be offering bug support for users at this point; there's still far too much I need to fix in my own environment to worry about yours, I'm sorry (also, I've been working on this for four months flat, and need a break from it). However, I am of course open to suggestions, remarks, criticism, and kind words (preferably the latter ). Finally, I will be exceptionally busy with work for the foreseeable future, so it may take me more time than in the past to respond to your posts. Have fun playing in the Pool.1 point
-
Hi, The latest forum upgrade seems to have completely messed up some complex signatures - please check yours to make sure it is still as you want it to appear. And can I take this opportunity to remind you all that sigs should not be too large (think of using a spoiler to hide text walls) nor advertise external products. Be prepared to find them edited if we think they do not meet these requirements. M231 point
-
The vmrun syntax should be vmrun start "Path to vmx file". You could retrieve the vmx file list in the inventory.vmls file (seems easy to parse). Did you try to open it with a text editor to see its content ?1 point
-
Newbie question about Call
MikahS reacted to SorryButImaNewbie for a topic
Thank you Master @MikahS!1 point -
Newbie question about Call
SorryButImaNewbie reacted to MikahS for a topic
For one, as jchd stated you can use a special array to pass arguments, like so: Local $aArgs[4] $aArgs[0] = "CallArgArray" ; required, otherwise the array won't be recognized as containing argmts $aArgs[1] = "I am a string parameter" $aArgs[2] = 50 $aArgs[3] = True Call("Example", $aArgs) Func Example($str, $int, $bool) MsgBox(0, "test", "string is: " & $str & @CRLF & _ "Int is: " & $int & @CRLF & _ "Bool is: " & $bool) EndFunc ;==>Example In my experience, I've only ever used it with functions that have many parameters, with an array like above. Otherwise, I just use the normal function call like so: Local $test = "hi" Example($test) Func Example($text) MsgBox(0, "", $text) EndFunc Edit: Good to hear.1 point -
Newbie question about Call
SorryButImaNewbie reacted to javiwhite for a topic
The call function can be handy when you have multiple functions with similar naming conventions ex: #include <GUIconstants.au3> $gui = GUIcreate("Test",400,400) $button1 = GUICtrlCreateButton("1",10,10,380,80) $button2 = GUICtrlCreateButton("2",10,110,380,80) $button3 = GUICtrlCreateButton("3",10,210,380,80) $button4 = GUICtrlCreateButton("4",10,310,380,80) GUISetState(@SW_SHOW) while 1 switch GUIGetMsg() Case $Button1,$Button2,$button3,$button4 $mouse = GUIGetCursorInfo() Call("func" & GUIctrlRead($mouse[4])) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func func1() msgbox(0,0,"Func1 called!") EndFunc Func func2() msgbox(0,0,"Func2 called!") EndFunc Func func3() msgbox(0,0,"Func3 called!") EndFunc Func func4() msgbox(0,0,"Func4 called!") EndFunc Regards Javi1 point -
Screenshot Description This lets you create bezier nodes between GUI controls. See screenshot for features. This is not an UDF. Download https://gist.github.com/minxomat/be51ae55cdf25c99c6921 point
-
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> ;Global $hGuiAddServer = 9999 ; Dummystring Local $aServers = IniReadSection (@ScriptDir & "\Servers.ini", "Servers") ; Create Main GUI and TabControl $Form1 = GUICreate("IT Tools", 365, 553, @DesktopWidth - 380,@DesktopHeight - 1195) $PageControl1 = GUICtrlCreateTab(8, 8, 350, 539) ; Servers Tab------------------------------------------------------------------------------------------------------------------------ $Servers = GUICtrlCreateTabItem("Servers") $listview_srv = GUICtrlCreateListView("Server|IP", 20, 49, 222, 482, $LVS_SINGLESEL,$LVS_EX_GRIDLINES+$LVS_SORTDESCENDING) _GuiCtrlListView_SetColumnWidth($listview_srv,0,130) _GuiCtrlListView_SetColumnWidth($listview_srv,1,88) ;_GUICtrlListView_HideColumn($listview_srv, 2) GetServers() $btn_srv_AddServer = GUICtrlCreateButton("Add Server", 252, 51, 92, 25) GUICtrlSetOnEvent(-1, "AddServer") $btn_srv_RemoveServer = GUICtrlCreateButton("Remove Server", 252, 81, 94, 25) GUICtrlSetOnEvent(-1, "RemoveServer") $btn_srv_RefreshList = GUICtrlCreateButton("Refresh List", 252, 113, 94, 25) GUICtrlSetOnEvent(-1, "RefreshServer") $btn_srv_Connect = GUICtrlCreateButton("Connect", 252, 145, 94, 25) GUICtrlSetOnEvent(-1, "ConnectToServer") $btn_srv_Ping = GUICtrlCreateButton("Ping", 252, 178, 94, 25) GUICtrlSetOnEvent(-1, "PingServer") ; Main GUI Control------------------------------------------------------------------------------------------------------------------- GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn_srv_AddServer addServer() Case $btn_srv_RefreshList RefreshServer() Case $btn_srv_RemoveServer RemoveServer() Case $btn_srv_Connect ConnectToServer() Case $btn_srv_Ping PingServer() EndSwitch WEnd ; Add Server ------------------------------------------------------------------------------------------------------------------ Func addServer () $hGuiAddServer = GUICreate ("Add Server", 100, 100, 100, 100) $NewServer = InputBox ("Add Server","Please type hostename","","","","",@DesktopWidth - 1100,@DesktopHeight - 800,"",$hGuiAddServer) TCPStartup() $ipAddress = TCPNameToIP ($NewServer) TCPShutdown() if Not $NewServer="" Then IniWrite (@ScriptDir & "\Servers.ini", "Servers", $NewServer, $ipAddress) EndIf While 2 $sMsg = GUIGetMsg($NewServer) Switch $sMsg Case $GUI_EVENT_CLOSE GUICtrlDelete($hGuiAddServer) EndSwitch ExitLoop WEnd _GUICtrlListView_DeleteAllItems($listview_srv) $sItem_srv = GUICtrlRead(GUICtrlRead($listview_srv)) GetServers() EndFunc ; Remove Server -------------------------------------------------------------------------------------------------------------------- Func RemoveServer() Local $hot_Item = _GUICtrlListView_GetSelectionMark($listview_srv) Local $sItem_srv = _GUICtrlListView_GetItemText($listview_srv, $hot_Item) Local $iniRead = IniReadSection (@ScriptDir & "\Servers.ini", "Servers") ;MsgBox (0, "",""&$sItem_srv&"") if not @error Then For $i = 1 To $iniRead[0][0] MsgBox (0,"List Hosts","Hostname: " & $iniRead[$i][0] & @CRLF & "IP: " & $iniRead[$i][1]) Next EndIf IniDelete (@ScriptDir & "\Servers.ini","Servers",$sItem_srv) _GUICtrlListView_DeleteAllItems($listview_srv) $sItem_srv = GUICtrlRead(GUICtrlRead($listview_srv)) GetServers() EndFunc ; Connect to Server --------------------------------------------------------------------------------------------------------------- Func ConnectToServer() $sItem_srv = GUICtrlRead(GUICtrlRead($listview_srv)) if $sItem_srv = "" Then MsgBox(0, "Connect to Server or Host","Please choose a host") Else $Host = StringSplit($sItem_srv,"|",1) MsgBox(0,"",$Host) ShellExecute("mstsc.exe","/admin /v "&$sItem_srv) EndIf EndFunc ; Refresh Serverlist ------------------------------------------------------------------------------------------------------------- Func RefreshServer() _GUICtrlListView_DeleteAllItems($listview_srv) $sItem_srv = GUICtrlRead(GUICtrlRead($listview_srv)) GetServers() EndFunc ; Get Servers from ini file -------------------------------------------------------------------------------------------------- Func GetServers() Local $aServers = IniReadSection (@ScriptDir & "\Servers.ini", "Servers") If Not @error Then For $i = 1 To $aServers[0][0] GUICtrlCreateListViewItem($aServers[$i][0] & '|' & $aServers[$i][1], $listview_srv) ;GUICtrlSetOnEvent(-1, '_ListViewHandler') Next EndIf EndFunc ; Ping Server -------------------------------------------------------------------------------------------------- Func PingServer() $sItem_srv = GUICtrlRead(GUICtrlRead($listview_srv)) $sItem_srv = StringTrimRight($sItem_srv, 3) Local $iPing = Ping ($sItem_srv) ShellExecute("C:\Windows\System32\cmd.exe",$iPing) EndFunc You must delete them by the key name, which you were trying to delete by the Key & Value name. All good? EDIT: Fixed grammar.1 point
-
Go to the url "about:addons" and check to see if it is installed under Extensions. If not, you can install it from here. Once installed, you should have a new sub-menu titled MozRepl under the Tools menu. Check under this menu to be sure MozRepl is started and be sure to enable the Activate on Startup option.1 point
-
It's a mess. Not my usual mess, a messy mess. Using 5 Nodes already pushes the limit. I implemented auto-resizing canvas, canvas dragging, Node selection etc. before givin up on this approach. The new version won't be much different, but the performance will be (a whole) lot better.1 point
-
SnippetBrowser1.0 w/ Search/FindinFile/Syntax Hiliting...
SorryButImaNewbie reacted to l3ill for a topic
This is a little project I started knowing it was over my head to intentionally raise my own experience bar. Pretty Simple Concept and its finally working like I want it to. The Basic Idea: An exe you copy into your Snippet folder and run from there with a shortcut ( or w/out ). Top Part of GUI Get Files - Creates a ListView of all au3 file in the WorkingDir ~ >_RecFileListToArray Thanks M23 !! Clear - clears last search otherwise new search/GetFiles is appended (gets full quick) File Search - search through the WorkingDir for a Keyword ~ >_FindInFile Thanks guinness !! Far Right is a label with the Path of your Working Directory Bottom Part All of these commands work with The Selected File Path From top part: Text Search - searches though preview window for text like F3 (find next) Thanks M23 !! Open in SciTE - Duh... Preview - Shows Preview of Selected File Path in Bottom window with Syntax Hi Liting ~ >RESH Thanks Beege Throw String - Experimental, Sends Selected Text to last Cursor Position in active tab in SciTE (now works w' multiple lines) Only works with one line... >Thanks Jos, guinness Everything you need to try it is in the zip file. Constructive Critics and Suggestions are welcome ;-) Some Pics: Here you see a search for Text in File "@ScriptDir". All the files that have this in them will be listed Then search through the Preview for each instance of "@ScriptDir" until you find the one you want. SnippetBrowser1.0.zip SnippetBrowser_1.0.1.zip ~ update: 14 Dec 2013 SnippetBrowser_1.0.1.zip ~ update: 18 Dec 2013 SnippetBrowser_1.0.2.zip ~ update: 26 Dec 2013 Bill1 point -
Func _SciTE_Send_Command($hWnd, $hSciTE, $sString) If StringStripWS($sString, $STR_STRIPALL) = '' Then Return SetError(2, 0, 0) ; String is blank. EndIf $sString = ':' & Dec(StringTrimLeft($hWnd, 2)) & ':' & $sString Local $tData = DllStructCreate('char[' & StringLen($sString) + 1 & ']') ; wchar DllStructSetData($tData, 1, $sString) Local Const $tagCOPYDATASTRUCT = 'ptr;dword;ptr' ; ';ulong_ptr;dword;ptr' Local $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT) DllStructSetData($tCOPYDATASTRUCT, 1, 1) DllStructSetData($tCOPYDATASTRUCT, 2, DllStructGetSize($tData)) DllStructSetData($tCOPYDATASTRUCT, 3, DllStructGetPtr($tData)) _SendMessage($hSciTE, $WM_COPYDATA, $hWnd, DllStructGetPtr($tCOPYDATASTRUCT)) Return Number(Not @error) EndFunc ;==>_SciTE_Send_Command Updated version of...1 point
-
Example of $WS_EX_CONTEXTHELP
VenusProject2 reacted to AZJIO for a topic
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $TrHelp = 0 $Gui = GUICreate("WS_EX_CONTEXTHELP", 440, 270, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION), $WS_EX_CONTEXTHELP) $iHelp = GUICtrlCreateLabel('Text 1.', 25, 25, 430, 17) $iData = GUICtrlCreateLabel('Text 2', 25, 65, 430, 17) $iButton = GUICtrlCreateButton('Button', 10, 100, 70, 25) GUISetState() GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") While 1 $msg = GUIGetMsg() If $TrHelp Then $a = GUIGetCursorInfo() Switch $a[4] Case $iButton ToolTip('It is the button') Case $iHelp ToolTip('It is the label 1') Case $iData ToolTip('It is the label 2') EndSwitch AdlibRegister('_CloseToolTip', 2000) $TrHelp = 0 ContinueLoop EndIf Switch $msg Case $iButton GUICtrlSetData($iData, 'Done') Case -3 Exit EndSwitch WEnd Func _CloseToolTip() AdlibUnRegister('_CloseToolTip') ToolTip('') EndFunc ;==>_CloseToolTip Func WM_SYSCOMMAND($hWnd, $msg, $wParam, $lParam) If BitAND($wParam, 0xFFFF) = 0xF180 Then $TrHelp = 1 Return $GUI_RUNDEFMSG EndFunc ;==>WM_SYSCOMMAND1 point -
; Authors: Andreas Karlsson (monoceres) & weaponx ; License: Give credit back to the authors when reusing parts of the source. ; ; Notes: Width & Height can be changed but should be kept equal, otherwise errors will arise. ; Constants used by _FillGradientTriangleRect Global Const $GRADIENT_FILL_RECT_H = 0 Global Const $GRADIENT_FILL_RECT_V = 1 Global Const $GRADIENT_FILL_TRIANGLE = 2 ; End #include <GDIPlus.au3> #include <Math.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <Date.au3> Global Const $width = 600 Global Const $height = 600 Global Const $dots = 3 Global $direction = 1 Global $remx[$dots], $remy[$dots] Opt("GUIOnEventMode", 1) $hwnd = GUICreate("Radar", $width, $height,-1,-1,$WS_CAPTION) GUISetOnEvent(-3, "close") GUISetState() GUIRegisterMsg($WM_PAINT, "_Paint") GUIRegisterMsg($WM_MOVE, "_Move") ; Create the dot. Global $UFO[$dots][5] For $a = 0 To UBound($UFO) - 1 $UFO[$a][0] = Random(0, $width, 1) If Random(0, 1, 1) = 0 Then $UFO[$a][1] = 0 Else $UFO[$a][1] = $height EndIf Do $UFO[$a][2] = Random(-0.5, 0.5) $UFO[$a][3] = Random(-0.5, 0.5) Until $UFO[$a][2] + $UFO[$a][3] <> 0 Next _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $background = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backgroundgraphics = _GDIPlus_ImageGetGraphicsContext($background) _AntiAlias($backgroundgraphics, 4) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) _AntiAlias($backbuffer, 4) $brush = _GDIPlus_BrushCreateSolid(0xFF005200) $pen = _GDIPlus_PenCreate(0xFF008800, 3) $pen2 = _GDIPlus_PenCreate(0xFF00BB00, 3) DirCreate(@TempDir & "flags") $lang = @OSLang Switch $lang Case "041d" $res = InetGet("http://www.evl.fi/svenska/skola/bild/flaggor/sverige.gif", @TempDir & "flags~flag.gif") Case "0409" InetGet("http://www.unl.pt/nova/relacoes-internacionais/usa.gif", @TempDir & "flags~flag.gif") Case "0413" InetGet("http://www.traveltoucan.com/files/Netherlands-flag.gif", @TempDir & "flags~flag.gif") Case "0407" InetGet("http://www.mapsofworld.com/images/world-countries-flags/germany-flag.gif", @TempDir & "flags~flag.gif") Case "042a" InetGet("http://www.tofocus.info/images/flags/vietnam-flag.gif", @TempDir & "flags~flag.gif") Case "0809" InetGet("http://www.tofocus.info/images/flags/united-kingdom-flag.gif", @TempDir & "flags~flag.gif") Case "0406" InetGet("http://www1.ocn.ne.jp/~infinite/PeacePath_Flags_Data/DenmarkF.gif", @TempDir & "flags~flag.gif") Case "0414" InetGet("http://www.mapsofworld.com/images/world-countries-flags/norway-flag.gif", @TempDir & "flags~flag.gif") Case "0814" InetGet("http://www.mapsofworld.com/images/world-countries-flags/norway-flag.gif", @TempDir & "flags~flag.gif") Case "0419" InetGet("http://www1.ocn.ne.jp/~infinite/PeacePath_Flags_Data/RussiaF.gif", @TempDir & "flags~flag.gif") Case "0418" InetGet("http://wwp.greenwichmeantime.com/time-zone/europe/european-union/romania/images/romania-flag.gif", @TempDir & "flags~flag.gif") Case "1009" InetGet("http://www.aidanandhilda.org.uk/public_html/images/flag_canada.gif", @TempDir & "flags~flag.gif") Case "0c0c" InetGet("http://www.aidanandhilda.org.uk/public_html/images/flag_canada.gif", @TempDir & "flags~flag.gif") Case "040c" InetGet("http://webmsi.free.fr/HEC-MSI-0712-GR3/france-flag.gif", @TempDir & "flags~flag.gif") Case "040a" InetGet("http://www.spain-flag.eu/photos/spain-flag.gif", @TempDir & "flags~flag.gif") Case "040b" InetGet("http://www.lsa.umich.edu/oip/Images/photo-albums/finland/finland-flag.gif", @TempDir & "flags~flag.gif") Case "0416" InetGet("http://blogs.zdnet.com/open-source/images/brazil%20flag.gif", @TempDir & "flags~flag.gif") Case "0816" InetGet("http://www.geocities.com/bretanha1954/images/portugal-flag.gif", @TempDir & "flags~flag.gif") Case "0411" InetGet("https://www.cia.gov/library/publications/the-world-factbook/flags/ja-lgflag.gif", @TempDir & "flags~flag.gif") Case "0804" InetGet("http://www.national-symbol.com/C/china/china-flag.gif", @TempDir & "flags~flag.gif") Case "0c09" InetGet("http://parenting.leehansen.com/downloads/clipart/Australia/images/australia-flag500.gif", @TempDir & "flags~flag.gif") Case "0410" InetGet("http://shawza.files.wordpress.com/2007/11/italy_flag.gif", @TempDir & "flags~flag.gif") Case "040d" InetGet("http://www.orionservice.biz/images/IsraelFlag.gif", @TempDir & "flags~flag.gif") Case "0405" InetGet("http://www.lsa.umich.edu/oip/Images/photo-albums/czech_republic/czech-flag.gif", @TempDir & "flags~flag.gif") Case "0439" InetGet("http://www.mapsofworld.com/images/world-countries-flags/india-flag.gif", @TempDir & "flags~flag.gif") Case Else InetGet("http://www.mitchmajor.com/images/jolly.gif", @TempDir & "flags~flag.gif") EndSwitch $tpos = WinGetPos($hwnd) $childhwnd = GUICreate("Control Panel", 500, 200, $tpos[0] + ($width - 500) / 2, $tpos[1] + $height + 30, $WS_POPUP, $WS_EX_LAYERED,$hwnd) GUICtrlCreatePic("background.gif", 0, 0, 500, 200) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreatePic(@TempDir & "flags~flag.gif", 45, 35, 80, 50) $edit = GUICtrlCreateEdit("Radar system started at: " & _Now(), 55, 110, 380, 50, BitOR($ES_READONLY, $ES_WANTRETURN, $ES_AUTOVSCROLL)) GUICtrlSetBkColor(-1, 0x444343) GUICtrlSetColor(-1, 0x00BB00) GUISetState() GUISetBkColor(0x123456) _API_SetLayeredWindowAttributes($childhwnd, 0x123456, 255) WinActivate($hwnd) Global $whiteshades[32] For $i = 0 To UBound($whiteshades) - 1 $whiteshades[$i] = _GDIPlus_BrushCreateSolid("0x" & Hex(((32 - $i) * 8 - 1), 2) & "AAFFAA") Next _GDIPlus_GraphicsClear($backgroundgraphics, 0xFF000000) _GDIPlus_GraphicsFillEllipse($backgroundgraphics, 0, 0, $width, $height, $brush) _GDIPlus_GraphicsDrawLine($backgroundgraphics, $width / 2, 0, $width / 2, $height, $pen) _GDIPlus_GraphicsDrawLine($backgroundgraphics, 0, $height / 2, $width, $height / 2, $pen) _GDIPlus_GraphicsDrawEllipse($backgroundgraphics, 50, 50, $width - (50 * 2), $height - (50 * 2), $pen) _GDIPlus_GraphicsDrawEllipse($backgroundgraphics, 175, 175, $width - (175 * 2), $height - (175 * 2), $pen) $inc = 0 $tx = 200 $ty = 100 Do _Draw() Sleep(20) Until False Func _Draw() ; Clear the backbuffer and draw the background on it. _GDIPlus_GraphicsClear($backbuffer, 0xFF000000) _GDIPlus_GraphicsDrawImageRect($backbuffer, $background, 0, 0, $width, $height) ; Get the x and y position to draw the line on $temparray = _GetXY($inc) $x = $temparray[0] $y = $temparray[1] ; Check if the line is intercepted For $a = 0 To UBound($UFO) - 1 $result = PointDistanceFromLine($width / 2, $height / 2, $x, $y, $UFO[$a][0], $UFO[$a][1]) If CircleIntersection($result, 10) And $UFO[$a][4] = 0 Then $UFO[$a][4] = 1 $remx[$a] = $UFO[$a][0] $remy[$a] = $UFO[$a][1] If ($remx[$a] - $width / 2) ^ 2 + ($remy[$a] - $height / 2) ^ 2 <= (($width - (175 * 2)) / 2) ^ 2 Then If $remx[$a] < $width / 2 Then If $remy[$a] < $height / 2 Then _GUICtrlEdit_AppendText($edit, @CRLF & @HOUR&":"&@MIN&":"&@SEC&": "&"Object intercepted in sector A1") Else _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector A3") EndIf Else If $remy[$a] < $height / 2 Then _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector A2") Else _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector A4") EndIf EndIf ElseIf ($remx[$a] - $width / 2) ^ 2 + ($remy[$a] - $height / 2) ^ 2 <= (($width - (50 * 2)) / 2) ^ 2 Then If $remx[$a] < $width / 2 Then If $remy[$a] < $height / 2 Then _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector B1") Else _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector B3") EndIf Else If $remy[$a] < $height / 2 Then _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector B2") Else _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector B4") EndIf EndIf Else If $remx[$a] < $width / 2 Then If $remy[$a] < $height / 2 Then _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector C1") Else _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector C3") EndIf Else If $remy[$a] < $height / 2 Then _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector C2") Else _GUICtrlEdit_AppendText($edit, @CRLF &@HOUR&":"&@MIN&":"&@SEC&": "& "Object intercepted in sector C4") EndIf EndIf EndIf EndIf ConsoleWrite("Result: " & $result & @CRLF) Next _GDIPlus_GraphicsDrawLine($backbuffer, $width / 2, $height / 2, $x, $y, $pen2) Local $temp[3][3] $temp[0][0] = $width / 2 $temp[0][1] = $height / 2 $temp[0][2] = "0x00005200" $temp[1][0] = $x $temp[1][1] = $y $temp[1][2] = "0xFF00BB00" $xy = _GetXY($inc - 0.0005 * $direction * 7) $temp[2][0] = $xy[0] $temp[2][1] = $xy[1] $temp[2][2] = "0x00005200" $dc = _GDIPlus_GraphicsGetDC($backbuffer) _FillGradientTriangleRect($dc, $temp, $GRADIENT_FILL_TRIANGLE) _GDIPlus_GraphicsReleaseDC($backbuffer, $dc) ; If the dot has been found For $a = 0 To UBound($UFO) - 1 If $UFO[$a][4] > 0 Then _GDIPlus_GraphicsFillEllipse($backbuffer, $remx[$a], $remy[$a], 10, 10, $whiteshades[$UFO[$a][4] - 1]) $UFO[$a][4] += 1 If $UFO[$a][4] > 32 Then $UFO[$a][4] = 0 EndIf EndIf ; Move the dot (regardless of state) $UFO[$a][0] += $UFO[$a][2] $UFO[$a][1] += $UFO[$a][3] ; If the dot is of screen recreate it If $UFO[$a][0] > $width Or $UFO[$a][0] < 0 Or $UFO[$a][1] > $height Or $UFO[$a][1] < 0 Then $UFO[$a][0] = Random(0, $width, 1) If Random(0, 1, 1) = 0 Then $UFO[$a][1] = 0 Else $UFO[$a][1] = $height EndIf Do $UFO[$a][2] = Random(-0.5, 0.5) $UFO[$a][3] = Random(-0.5, 0.5) Until $UFO[$a][2] + $UFO[$a][3] <> 0 EndIf Next _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) $inc += 0.0005 * $direction EndFunc ;==>_Draw Func _GetXY($value) Local $array[2] $cos = Cos(_Degree($value)) $sin = Sin(_Degree($value)) $fx = $cos * ($width / 2) + ($width / 2) $fy = $sin * ($height / 2) + ($height / 2) $array[0] = $fx $array[1] = $fy Return $array EndFunc ;==>_GetXY Func close() For $i = 0 To UBound($whiteshades) - 1 _GDIPlus_BrushDispose($whiteshades[$i]) Next _GDIPlus_PenDispose($pen) _GDIPlus_PenDispose($pen2) _GDIPlus_BrushDispose($brush) _WinAPI_DeleteObject($bitmap) _WinAPI_DeleteObject($background) _GDIPlus_GraphicsDispose($backgroundgraphics) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_Shutdown() Exit EndFunc ;==>close Func _Paint() _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) Return "GUI_RUNDEFMSG" EndFunc ;==>_Paint Func _Move() _Draw() $tpos = WinGetPos($hwnd) WinMove($childhwnd, "", $tpos[0] + ($width - 500) / 2, $tpos[1] + $height + 30) Return "GUI_RUNDEFMSG" EndFunc ;==>_Move ; Thanks weaponx for these three functions :) ;distance: Center point distance from line ;radius: circle radius Func CircleIntersection($distance, $Radius) If $distance < $Radius Then ;MsgBox(0,"","Circle intersects line") Return True Else ;MsgBox(0,"","Circle doesn't intersect line") Return False EndIf EndFunc ;==>CircleIntersection ;xa,ya: Start X,Y ;xb,yb: End X,Y ;xp,yp: Point X,Y Func PointDistanceFromLine($xa, $ya, $xb, $yb, $xp, $yp) ;Xa,Ya is point 1 on the line segment. ;Xb,Yb is point 2 on the line segment. ;Xp,Yp is the point. $xu = $xp - $xa $yu = $yp - $ya $xv = $xb - $xa $yv = $yb - $ya If ($xu * $xv + $yu * $yv < 0) Then Return Sqrt(($xp - $xa) ^ 2 + ($yp - $ya) ^ 2) EndIf $xu = $xp - $xb $yu = $yp - $yb $xv = -$xv $yv = -$yv If ($xu * $xv + $yu * $yv < 0) Then Return Sqrt(($xp - $xb) ^ 2 + ($yp - $yb) ^ 2) EndIf Return Abs(($xp * ($ya - $yb) + $yp * ($xb - $xa) + ($xa * $yb - $xb * $ya)) / Sqrt(($xb - $xa) ^ 2 + ($yb - $ya) ^ 2)) EndFunc ;==>PointDistanceFromLine Func _AntiAlias($hGraphics, $iMode) Local $aResult $aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $iMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_AntiAlias ; #FUNCTION#;=============================================================================== ; ; Name...........: _FillGradientTriangleRect() ; Description ...: Draws a gradient triangle or rect on a device context ; Syntax.........: _FillGradientTriangleRect(ByRef $hDc, ByRef $aVertexes, $iFlag) ; Parameters ....: $hDc - Handle to a device context ; $sVertexes - A 2 dimension array that specifies the triangle (or rect) The array has this structure:" ; |$aVertexes[n][0] = x coord ; |$aVertexes[n][1] = y coord ; |$aVertexes[n][2] = Color of the vertex in 0xAARRGGBB format ; $iFlag - Flag that specifies the drawing, flags: ; |$GRADIENT_FILL_RECT_H - Rectangle with horizontal gradient ; |$GRADIENT_FILL_RECT_V - Rectangle with vertical gradient ; |$GRADIENT_FILL_TRIANGLE - Triangle ; Return values .: Success - 1 ; Failure - Returns -1 and sets error to 1 ; Author ........: Andreas Karlsson (monoceres) ; Modified.......: ; Remarks .......: Pass 3 vertexes for triangles and 2 for rects ; Related .......: ; Link ..........; http://msdn.microsoft.com/en-us/library/ms532348(VS.85).aspx ; Example .......; No ; ;;========================================================================================== Func _FillGradientTriangleRect(ByRef $hDc, ByRef $aVertexes, $iFlag) Local $sTRIVERTEXString, $vTRIVERTEX, $aReturn Local $iColor Local $GRADIENT_STRUCT If $iFlag = $GRADIENT_FILL_TRIANGLE Then $GRADIENT_STRUCT = DllStructCreate("ulong V1;ulong V2;ulong V3;") DllStructSetData($GRADIENT_STRUCT, "V1", 0) DllStructSetData($GRADIENT_STRUCT, "V2", 1) DllStructSetData($GRADIENT_STRUCT, "V3", 2) Else $GRADIENT_STRUCT = DllStructCreate("ulong UpperLeft;ulong LowerRight;") DllStructSetData($GRADIENT_STRUCT, "UpperLeft", 0) DllStructSetData($GRADIENT_STRUCT, "LowerRight", 1) EndIf For $i = 0 To UBound($aVertexes) - 1 $sTRIVERTEXString &= "ulong x" & $i & ";ulong y" & $i & ";short Red" & $i & ";short Green" & $i & ";short Blue" & $i & ";" Next $vTRIVERTEX = DllStructCreate($sTRIVERTEXString) For $i = 0 To UBound($aVertexes) - 1 $iColor = StringRight($aVertexes[$i][2], 8) DllStructSetData($vTRIVERTEX, "x" & $i, $aVertexes[$i][0]) DllStructSetData($vTRIVERTEX, "y" & $i, $aVertexes[$i][1]) DllStructSetData($vTRIVERTEX, "Alpha" & $i, "0x" & Hex(Dec(StringLeft($iColor, 2)) * 256, 4)) DllStructSetData($vTRIVERTEX, "Red" & $i, "0x" & Hex(Dec(StringMid($iColor, 3, 2)) * 256, 4)) DllStructSetData($vTRIVERTEX, "Green" & $i, "0x" & Hex(Dec(StringMid($iColor, 5, 2)) * 256, 4)) DllStructSetData($vTRIVERTEX, "Blue" & $i, "0x" & Hex(Dec(StringRight($iColor, 2)) * 256, 4)) Next $aReturn = DllCall("Msimg32.dll", "int", "GradientFill", "ptr", $hDc, "ptr", DllStructGetPtr($vTRIVERTEX), "ulong", UBound($aVertexes), "ptr", DllStructGetPtr($GRADIENT_STRUCT), "ulong", 1, "ulong", $iFlag) If Not IsArray($aReturn) Or $aReturn[0] = 0 Then Return SetError(1, 0, -1) Else Return SetError(0, 0, 1) EndIf EndFunc ;==>_FillGradientTriangleRect ;=============================================================================== ; ; Function Name: _API_SetLayeredWindowAttributes ; Description:: Sets Layered Window Attributes:) See MSDN for more informaion ; Parameter(s): ; $hwnd - Handle of GUI to work on ; $i_transcolor - Transparent color ; $Transparency - Set Transparancy of GUI ; $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color ; Requirement(s): Layered Windows ; Return Value(s): Success: 1 ; Error: 0 ; @error: 1 to 3 - Error from DllCall ; @error: 4 - Function did not succeed - use ; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information ; Author(s): Prog@ndy ; ;=============================================================================== ; Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False) Local Const $AC_SRC_ALPHA = 1 Local Const $ULW_ALPHA = 2 Local Const $LWA_ALPHA = 0x2 Local Const $LWA_COLORKEY = 0x1 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, 0, 0) Case Else Return 1 EndSelect EndFunc ;==>_API_SetLayeredWindowAttributes Br, UEZ1 point