Leaderboard
Popular Content
Showing content with the highest reputation on 03/08/2015 in all areas
-
This is my modification of the editor based on SciTE 3.2.5.99. Too many changes are made. Added new plugins (.lua) and rewrited existing, added Toolbar and Sidebar, expanded main and context menu, and more... I will not list all the changes, just download and try it. I also want to say a big thank the staff of Ru-Board for the excellent work on the modification of the editor and writing great plugins (.lua). Compiler Wrapper (CW) - a new tool that is part of SciTE 3.2.5.99 and designed to replace the AutoItWrapper. CW only works with "pragma" directives and does not use "AutoIt3Wrapper" directives. CW differs from AutoItWrapper both externally and internally but has a similar logic. Here are some possibilities utility - more friendly GUI, all options of "pragma" directives are located in one window, the ability to add digital signature, and a simple way to add resources (.rcs and .res files). The current version of CW is compatible with AutoIt 3.3.10.x, 3.3.12.x, and 3.3.14.x. How to install? Unpack CW to Compiler Wrapper folder and copy it to your SciTE or SciTE\Tools directory. Note that if you download SciTE 3.2.5.99 then you need not do anything because CW is already installed in the package. Command lines for SciTE: #Command line for compilation command.compile.au3="$(SciteDefaultHome)\Compiler Wrapper\CW.exe" "$(FilePath)" /m:1 /c:0 command.compile.subsystem.au3=1 #Command line for building (without GUI) command.build.au3="$(SciteDefaultHome)\Compiler Wrapper\CW.exe" "$(FilePath)" /m:1 /c:0 /s:1 command.build.subsystem.$(au3)=1 #Command line for changing "pragma" options only command.90.au3="$(SciteDefaultHome)\Compiler Wrapper\CW.exe" "$(FilePath)" /m:2 command.name.90.au3=Compiler Options... command.shortcut.90.au3=Shift+F7 command.subsystem.90.au3=1 command.save.before.90.au3=1 Command lines for Windows Explorer context menu: ;Command line for compilation "C:\Program Files (x86)\SciTE\Tools\Compiler Wrapper\CW.exe" "%1" /m:0 /c:0 ;Command line for building (without GUI) "C:\Program Files (x86)\SciTE\Tools\Compiler Wrapper\CW.exe" "%1" /m:0 /c:0 /s:1 Screenshots Files to download You can download latest SciTE build on this page (bottom of the post) or by using the SciTE Updater.2 points
-
Hi I have written "plink_wrapper.au3" UDF to assist utilizing the command line terminal emulation program know as "plink". For more information about plink and putty see "http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html". The plink_wrapper.au3 UDF contains a few basic functions: _Start_plink($_plink_loc,$_plinkserver); is used to start your terminal session _Plink_close(); is used to close the session _Init_plink_log($_plink_logfile); used to create a log file of the information sent to the screen _Expect($match_text); wait's for text to appear on screen before continuing _Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3); performs one of three tasks based on information on screen _Expectlog($match_text); logs text for an individual Expect command; used when main logging is turned off _Say($output); Sends text to screen input _SayPlus($output); Sends text to screen input and a carrage return _Plink_close_logfile($_plink_logfile_handle); closes the log file _Collect_stdout($time); collect _stdout stream for designated period of time _ExpectTimed($match_text,$time); waits for specified time to check for string value in terminal output stream General Comments - This code has been in use for a few months and is not very sophisticated. - When entering your userid and password strings add an extra space at the end. - Finding a valid string to wait for can be tricky. I suggest using putty to record your sessions to find such strings. - New Function _Collect_stdout($time) added 7/10/2011 - New Function _ExpectTimed($match_text, $time) added 7/12/2011 #include-Once ; ==================================================================================================================================== ; Title....................: plink_wrapper ; AutoIt Version...........: 3.3.6.1 ; Language.................: English ; Description..............: UDF Functions to Control "plink.exe" allowing intelligent response to text displayed in terminal sessions ; Author...................: Joel Susser (susserj) ; Last Modified............: 07/12/2011 ; Status:..................: In Production ; Testing Workstation......; WinXP sp3, win7 32bit (It likely works with other versions of Windows but I cannot confirm this right now ) ; Tested Version of Autoit.; Autoit 3.3.6.1 ; What is plink? ;plink is a command line terminal emulation program similar to putty that allows rudimentary scripting. ;Requirements ; Autoit 3.3.6.X ; putty.exe, plink.exe. You can acquire these programs at "http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html". ; Hints ; If you are using the ssh protocol I suggest you connect to your server first ; with putty before you use plink for the first time so that you will not ; be disrupted by the authentication certificate requests. ; When entering your userid and password variables I suggest that you add an ; additional space at the end of these strings. I'm not sure why but if you don't it will likely ; cut off the last letters of your userid and password. ; Figuring out what screen information to wait for before continuing the data input stream ; can sometimes be difficult. I suggest using the putty logging feature to record the text that appears on each screen. ; I beleive it is advisable to do so in small chunks. ; Also, choose strings to recognize that are unique and at the end of the putty screen capture logging sessions ; for each screen. Avoid terminal escape coding. ; ================================================================================================================================ #comments-start Changelog: 6-09-2011 changed example script to use equivalent path with spaces 7-09-2011 added function _Collect_stdout and modified example script 7-12-2011 added function _ExpectTimed and modified example script #comments-end ;#Current List of Functions======================================================================================================= ;_Start_plink($_plink_loc,$_plinkserver) ;_Plink_close() ;_Init_plink_log($_plink_logfile) ;_Expect($match_text) ;_Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3) ;_Expectlog($match_text) ;_Say($output) ;_SayPlus($output) ;_Plink_close_logfile($_plink_logfile_handle) ;_Collect_stdout($time) ;_ExpectTimed($match_text, $_plink_timeout) ; =============================================================================================================================== ; #VARIABLES# ==================================================================================================================== global $_plinkhandle="" ; used to handle starting of plink global $_plinkserver="" ; name of server you wish to connect to global $_plink_loc ="" ; location of plink.exe executable on workstation global $_plink_display_messages=false ; display interim messages to screen (default false) global $_plink_display_message_time=1 ; time in seconds messages are displayed global $_plink_logging=false ; record plink log file (default false) global $_plink_logfile="" ; location of plink log file global $_plink_logfile_handle="" ; plink log file handle ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Plink_close ; Description ...: closes plink.exe process ; Author ........: Joel Susser (susserj) ; Syntax.........: $_Plink_close() ; Parameters ....: none required ; example .......: _Plink_close() ; ; Remarks .......: plink.exe should only be running once ; =============================================================================================================================== func _Plink_close() ;If there are any stray plink sessions kill them if ProcessExists("plink.exe") then ProcessClose("plink.exe") Else return false endif EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Start_plink ; Description ...: open a new plink.exe terminal session ; Author ........: Joel Susser (susserj) ; Syntax.........: $_plinkhandle=_Start_plink($_plink_loc, $_plinkserver) ; Parameters ....: $_plink_loc is the location of the plink.exe ececutable on you workstation ; Parameters ....: $_plinkserver is the location of the server you wish to access ; Example........: $_plinkhandle = _Start_plink("c:/putty/plink.exe", "testserver.com") ; Return values .: $plinkhandle, pid of cmd processor ; Remarks........; Currently configured to use ssh protocol ; Remarks .......: Needs to be made more robust ; =============================================================================================================================== ;start the plink session func _Start_plink($_plink_loc,$_plinkserver) _Plink_close(); close any stray plink sessions before starting if $_plink_loc = "" then MsgBox(0, "Error", "Unable to open plink.exe",10) return false Exit endif if $_plinkserver = "" then MsgBox(0, "Error", "Unable to open server",10) Exit return false endif $_plinkhandle = Run(@comspec & " /c" & $_plink_loc & " -ssh " & $_plinkserver,"",@SW_HIDE,7) return $_plinkhandle endFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Init_plink_log ; Description ...: open a new file handle for saving a log file recording your plink terminal session ; Syntax.........: _Init_plink_log($_plink_logfile) ; Parameters ....: $_plink_logfile is the location of the log file ; Example........: _Init_plink_log("c:/putty/plink.log") ; Author ........: Joel Susser (susserj) ; Remarks .......: If the file exists it will be ovewritten (2) ; Remarks........: Initializing the log file does not mean logging gets turned on. ; remarks........; Logging gets turned on with the flag $_plink_logging=true. The default is false ; Remarks........; Sometimes the log files get too long and you just want to log a small section of code see $_Expectlog() ; Remarks........; ; =============================================================================================================================== ;Initialize plink session log file func _Init_plink_log($_plink_logfile) $_plink_logfile_handle = FileOpen($_plink_logfile, 2) ; Check if file opened for writing OK If $_plink_logfile_handle = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf return true endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Expect ; Description ...: Pause until expected text is displayed on output stream of terminal ; Syntax.........: _Expect("text string") ; Parameters ....: one parameter containing a text string. ; Example........: _Expect("Password:") ; Author ........: Joel Susser (susserj) ; Remarks .......: If the flag $_plink_logging is set to true then it will record all the data sent to the output screen ; Remarks........: while it is waiting for the required text to appear. If it runs to long and doesn't find the text this ; remarks........; file can get very big so be careful. ; Remarks........; If the flag $plink_display_message is set to true then it will popup a messages showing you that the text is found. ; Remarks........; I usaully leave the $_plink_display_messages flag on but reduce the time display to 1 second. However, during ; Remards........; development I usually bump it up to 5 seconds. ; =============================================================================================================================== func _Expect($match_text) local $text local $found While 1 $text = StdoutRead($_plinkhandle) if $_plink_logging Then filewriteline($_plink_logfile_handle,"**********************NEW SECTION************************") filewrite($_plink_logfile_handle,$match_text) filewrite($_plink_logfile_handle,$text) filewriteline($_plink_logfile_handle,"**********************END SECTION************************") endif $found = StringRegExp($text,$match_text) If $found = 1 Then If $_plink_display_messages Then MsgBox(4096, $match_text, $text, $_plink_display_message_time) ExitLoop endif sleep(100) Wend EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Expector ; Description ...: Depending on the text that is found in the input stream, perform one of three different tasks ; Syntax.........: _Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3) ; Parameters ....: If string in $match_text1 is found then sent the text in $say1 input string ; Parameters ....: If string in $match_text2 is found then sent the text in $say2 input string ; Parameters ....: If string in $match_text3 is found then give the user a popup message and exit script ; Author ........: Joel Susser (susserj) ; Remarks .......: ; Example........: _Expector("Press <Space Bar> to continue", " ", "Do you wish to continue", "y" "Error no data found", "Script shutting down") ; Remarks .......: ; Remarks........: I'm not fully satified with this function. It requires exactly 6 parameters. It should be more fexable to handle ; remarks........; a variable number of parameters. ; Remarks........; Also, it should perhaps have some error handling to check that the parameters it receives are correct. ; Remarks........; Right now when I only need only two choices, not three choices I put dummy data in my second pair of data variables ; Remards........; ; =============================================================================================================================== func _Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3) local $text While 1 $text = StdoutRead($_plinkhandle) if $_plink_logging then filewrite($_plink_logfile_handle,"**********************NEW SECTION************************") filewrite($_plink_logfile_handle,"Expector") filewrite($_plink_logfile_handle,$text) filewrite($_plink_logfile_handle,"**********************END SECTION************************") endif If $_plink_display_messages Then MsgBox(4096, $match_text1 & $match_text2, $text, $_plink_display_message_time) sleep(5000) If StringRegExp($text,$match_text3) then MsgBox(4096, "System Error", $say3, 6) ProcessClose("plink.exe") FileClose($_plink_logfile) exit; close program endif If StringRegExp($text,$match_text2) then _Say($say2) ExitLoop Endif If StringRegExp($text,$match_text1) then _Say($say1) ExitLoop Endif sleep(100) Wend EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Expectlog ; Description ...: Similar to _Expect but if forces a logging of the data for a particular search patern in the input stream ; Description ...: Pause until text is displayed on output stream of terminal ; Syntax.........: _Expectlog("text string") ; Parameters ....: one parameter containing a text string. ; Example........: _Epector("Password:") ; Author ........: Joel Susser (susserj) ; Remarks .......: ; Remarks........: As I indicated previously, the log files can get very big. ; remarks........; This function allows targeted logging related to a specific area of your script. ; Remarks........; It is primarily used for debugging. After your script is functional, you will likely convert your _Expectlog ; Remarks........; function calls to _Expect. ; Remards........; ; =============================================================================================================================== func _Expectlog($match_text) local $text local $found While 1 $text = StdoutRead($_plinkhandle) filewrite($_plink_logfile_handle,"**********************" & $match_text & "************************" ) filewrite($_plink_logfile_handle,$match_text) filewrite($_plink_logfile_handle,$text) $found = StringRegExp($text,$match_text) If $found = 1 Then MsgBox(4096, $match_text, $text, 10) ExitLoop endif sleep(100) Wend EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Say ; Description ...: Send the following text string to the input stream of the terminal session ; Syntax.........: _Say("text") ; Parameters ....: Function takes on parameter which contains the text to sent to the input stream. ; Example........: _Say("y") ; Author ........: Joel Susser (susserj) ; Remarks .......: Don't try and say to much at once. Wait for the screen to appear with the prompt for information ; Remards........; This say does not perform a carrage return. If you need a carrage return use _SayPlus ; =============================================================================================================================== ; Say Function func _Say($output) StdinWrite($_plinkhandle, $output) endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _SayPlus ; Description ...: Send the following text string to the input stream of the terminal session ; Syntax.........: _SayPlus("text") ; Parameters ....: Function takes on parameter which contains the text to sent to the input stream. ; Example........: _SayPlus("y") ; Author ........: Joel Susser (susserj) ; Remarks .......: Don't try and say to much at once. Wait for the screen to appear with the prompt for information ; Remards........; This type of say performs a carrage return. If you don't need a carrage return use _Say() ; =============================================================================================================================== func _SayPlus($output) StdinWrite($_plinkhandle, $output & @CR) endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Plink_close_logfile ; Description ...: close the plink logging file ; Syntax.........: _Plink_close_logfile($_plink_logfile_handle_) ; Parameters ....: $_Plink_close_logfile_handle ; Example........: N/A ; Author ........: Joel Susser (susserj) ; Remarks .......: ; Remards........; ; =============================================================================================================================== ;Close log file func _Plink_close_logfile($_plink_logfile_handle) FileClose($_plink_logfile_handle) endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Collect_stdout ; Description ...: Collects text sent to output stream of terminal for specified period of time ; Syntax.........: $variable = _Collect_stdout($time) ; Parameters ....: Function takes one parameter which specifies time(milliseconds) to collect the input buffer. ; Returns........: Returns the contents of stdout collected during specified time interval ; Example........: $output_buffer = $_Collect_stdout(500); 500 is half a second ; Author ........: Joel Susser (susserj) ; ; Remarks........; This function was inspired by comments made by (Phil; justhatched) and jp10558 ; Remarks .......: There are certain situations which can benefit from the ability to collectively parse the stdout stream. ; Remarks........: The potential problem with this approach is that it can sometimes be difficult to predict how long it takes for certain ; remarks........; screens to output their text due to variables such as server load and internet speed etc. ; Remarks........; That being said, with proper testing the time interval can potentially be evaluated for such situations and ; Remarks........; upon potential failure to succeed, the procedure can be repeated. ; Remarks........; See New Sample Script ; ; =============================================================================================================================== Func _Collect_stdout($_plink_timeout) local $text local $sBuffertext local $iBegin = TimerInit() While 1 $text = StdoutRead($_plinkhandle) $sBuffertext = $sBuffertext & $text if $_plink_logging Then filewriteline($_plink_logfile_handle, $text) endif If TimerDiff($iBegin) > $_plink_timeout then ExitLoop endif sleep(100) Wend return $sBuffertext EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _ExpectTimed ; Description ...: Searches for a string in the stdout stream which was collected for a specified period of time ; Syntax.........: $variable = _Epect_timed("string", $time) ; Parameters ....: Function takes two parameters. First is string to find, second is period of in time(milliseconds) to collect the input buffer ; Returns........: Returns the contents of stdout collected during specified time interval ; Example........: $output_buffer = $_Expect__timed("Login:", 5000); 5 seconds ; Author ........: Joel Susser (susserj) ; ; Remarks........; This function was inspired by comments made by (Phil; justhatched) and jp10558 ; Remarks .......: There are certain situations which can benefit from the ability to collectively parse the stdout stream. ; Remarks........: The potential problem with this approach is that it can sometimes be difficult to predict how long it takes for certain ; remarks........; screens to output their text due to variables such as server load and internet speed etc. ; Remarks........; That being said, with proper testing the time interval can potentially be evaluated for such situations and ; Remarks........; upon potential failure to succeed, the procedure can be repeated. ; Remarks........; See New Sample Script ; =============================================================================================================================== Func _ExpectTimed($match_text, $_plink_timeout) local $found local $sBuf_text $sBuf_text = _Collect_stdout($_plink_timeout) $found = StringRegExp($sBuf_text, $match_text) If $found Then If $_plink_display_messages Then MsgBox(4096, $match_text, $sBuf_text, $_plink_display_message_time) return $sBuf_text endif EndFunc ; =============================================================================================================================== ; Sample Script Starts Here============================================================================================================= ; #cs #include plink_wrapper.au3 ;Initialize Variables------------------------------------------------------------------------------------------------------------ $username="admin " ; It seems necessary to put an extra space after the login name. The last character is being cut off. $password="admin1 "; It seems necessary to put an extra space after the password. The last characters is being cut off. $_plink_logging=true ; Turn Logging ON (default is off) $_plink_display_messages=true ; Turn Screen Messages ON (default is on) $_plink_display_message_time=5 ; Display message for 5 secs (default 1 sec) ;-------------------------------------------------------------------------------------------------------------------------------- ; Initizations------------------------------------------------------------------------------------------------------------------- $_plinkhandle=_Start_plink("c:\PROGRA~1\1putty\plink.exe","hostname.com"); Initialized plink connection to server _Init_plink_log("c:\PROGRA~1\putty\plink.log"); Initialize log file. Required even it not being used ;(Special Notes for Windows 7. If you are puttying plink, putty, and plink.log in a subdirectory of "c:\Program Files\" make sure ; you give your user account sufficient rights. Otherwises it may fail to run properly. ; To find the short file name, navigate to directory with cmd console, then type "command". This will show you the short name) ; ------------------------------------------------------------------------------------------------------------------------------- ; Terminal Emulation Session Interaction _Expect("login as:") _SayPlus($username) _Expect("Password:") _SayPlus($password) _Expect("hostname >") _SayPlus("ls") _Expect("hostname >") ;--------Sample Coding to illustrate using _Collect_stdout function----------------- _SayPlus("vncserver") $buf_collect = _Collect_stdout(5000); (5 sec) If StringInStr($buf_collect, "computer:0",1) then ;some function ElseIf StringInStr($buf_collect, "computer:1",1) then ; some function ElseIf StringInStr($buf_collect, "computer:2",1) then ; some function Elseif ... Else MsgBox(0,"Error", "Unable to find required string") Endif ;---------------------------------------------------------------------------------- ;--------Sample Coding to illustrate using _ExpectTimed function ----------------- ; Terminal Emulation Session Interaction $buf_collect = _ExpectTimed("login as:", 1000) if not $buf_collect then MsgBox(4096, "error", "unable to log into server", $_plink_display_message_time) exit Endif _SayPlus($username) _ExpectTimed("Password:", 1000) _SayPlus($password) _ExpectTimed("hostname >", 1000) _SayPlus("ls") _ExpectTimed("hostname >", 1000) ;---------------------------------------------------------------------------------- _SayPlus("exit") ;SHUTDOWN----------------------------------------------------------------------------------------------------------------------- _Plink_close(); shutdown plink session _Plink_close_logfile($_plink_logfile_handle);shutdown log file ; ------------------------------------------------------------------------------------------------------------------------------ #ce If you have any questions or comments please let me know. Thanks1 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
-
I was looking for some examples of custom drawn TreeViews. I didn't find any so here is two. I have made the examples for ListViews too. The first example shows some named colors from the MS HTML documentation. The colors are sorted in different ways in five text files in the zipfile. The forecolor, backcolor, color name and RGB value is shown in the GUI's. Remark that the forecolor in the first column in the ListView is bold. Click on the colors in the TreeView to see some of the effects of custom drawing. The second example enumerates the fonts for the character sets in FontConstants.au3 and shows the fonts in the GUI's. Click on the fonts in the TreeView to see the name of the fonts. The zipfile contains 5 text files with color definitions and 4 au3-files with GUI's. CustDrawTvLv.zip 2016-03-22: For colors and fonts in listviews take a look at Colors and fonts in custom drawn ListViews - UDF version.1 point
-
OK, I'll make it. Thanks a lot minx. regards.1 point
-
Have you looked in the scite options files?1 point
-
Never new that about the minus key. very useful.1 point
-
To visualize a flow or connection of elements with different properties. Take a look at the Blender node system. This kind of visualisation is also used in a Color Grading (Davinci Resolve), Music Production (various synths) and VFX apps. A bezier connecting two nodes. It's control points are fixed at 50% width or height of the bezier.1 point
-
just use this combination SHIFT + NUMPADPLUS ​SHIFT + NUMPADMINUS1 point
-
How to prevent "-" key to make a line as comment in SciTE
kcvinu reacted to markyrocks for a topic
Just use the -and + that is not in the number pad. The ones I'm top row of keyboard. What you're talking about are very useful features, I don't have number pad on my keyboard and I find it very annoying that I can't use it in the way you describe1 point -
Here's the thing. I would like to have option with compiled script (GUI EXE) to be able to communicate with console if that script (exe) is run with command prompt or by another process (except explorer.exe). So, if parent is explorer.exe GUI mode is on and if parent is anything else CUI mode is forced. This is what I have: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=Test.exe #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #NoTrayIcon Opt("MustDeclareVars", 1) Global $sParent = _GetParent() If @Compiled Then Switch $sParent Case "explorer.exe" Run("Test.exe") Case "cmd.exe" _ExecuteCommandLineAttachConsole($CmdLineRaw) Case Else _ExecuteCommandLine($CmdLineRaw) EndSwitch Else Switch $sParent Case "cmd.exe" _ExecuteCommandLine($CmdLineRaw) Case Else Run("Test.exe", "", @SW_SHOW, 1) ; $STDIN_CHILD EndSwitch EndIf Func _GetParent() Local $sParent Local $aCall = DllCall("kernel32.dll", "int", "GetCurrentProcess") If @error Or Not $aCall[0] Then Return SetError(1, 0, "") EndIf Local $hProcess = $aCall[0] Local $tPROCESS_BASIC_INFORMATION = DllStructCreate("dword ExitStatus;" & _ "ptr PebBaseAddress;" & _ "dword AffinityMask;" & _ "dword BasePriority;" & _ "dword UniqueProcessId;" & _ "dword InheritedFromUniqueProcessId") Local $aCall = DllCall("ntdll", "int", "NtQueryInformationProcess", _ "hwnd", $hProcess, _ "dword", 0, _ "ptr", DllStructGetPtr($tPROCESS_BASIC_INFORMATION), _ "dword", DllStructGetSize($tPROCESS_BASIC_INFORMATION), _ "dword*", 0) If @error Then Return SetError(2, 0, "") EndIf Local $iParentPID = DllStructGetData($tPROCESS_BASIC_INFORMATION, "InheritedFromUniqueProcessId") $aCall = DllCall("kernel32.dll", "hwnd", "OpenProcess", _ "dword", 1040, _ ; PROCESS_QUERY_INFORMATION|PROCESS_VM_READ "int", 0, _ "dword", $iParentPID) If @error Or Not $aCall[0] Then Return SetError(3, 0, "") EndIf Local $hParentHandle = $aCall[0] $aCall = DllCall("psapi.dll", "dword", "GetModuleBaseNameW", _ "hwnd", $hParentHandle, _ "ptr", 0, _ "wstr", "", _ "dword", 65536) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hParentHandle) Return SetError(4, 0, "") EndIf $sParent = $aCall[3] DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hParentHandle) Return SetError(0, 0, $sParent) EndFunc ;==>_GetParent Func _ExecuteCommandLine($sCommandLine) If $sCommandLine Then _ExecuteCommandLineAttachConsole($sCommandLine) Return SetError(@error, 1, "") EndIf Local $aCall = DllCall("kernel32.dll", "int", "AllocConsole") If @error Or Not $aCall[0] Then Return SetError(1, 0, "") EndIf Local $hConIn = FileOpen("CONIN$", 4) ; reading handle ; _WinAPI_GetStdHandle(0) Local $hConOut = FileOpen("CONOUT$", 1) ; _WinAPI_GetStdHandle(1) FileWrite($hConOut, "Resources Viewer And Compiler >") FileClose($hConOut) Local $sPrintString While 1 Sleep(100) Switch BinaryToString(FileRead($hConIn, 512)) Case "?" & @CRLF $sPrintString = @CRLF & "... help string goes here ..." & @CRLF & @CRLF ConsoleWrite($sPrintString) ; write to the STDOUT stream $sPrintString &= "Resources Viewer And Compiler >" $hConOut = FileOpen("CONOUT$", 1) ; writing handle FileWrite($hConOut, $sPrintString) ; write to a console FileClose($hConOut) ; flush Case "gui mode" & @CRLF $sPrintString = "Switching to GUI mode..." & @CRLF ConsoleWrite($sPrintString) $hConOut = FileOpen("CONOUT$", 1) FileWrite($hConOut, $sPrintString) FileClose($hConOut) Sleep(300) DllCall("kernel32.dll", "int", "FreeConsole") Exit Case "exit" & @CRLF, "quit" & @CRLF Exit Case Else $sPrintString = @CRLF & "Invalid input. Type ? for help." & @CRLF & @CRLF ConsoleWrite($sPrintString) $sPrintString &= "Resources Viewer And Compiler >" $hConOut = FileOpen("CONOUT$", 1) FileWrite($hConOut, $sPrintString) FileClose($hConOut) EndSwitch WEnd FileClose($hConIn) Return EndFunc ;==>_ExecuteCommandLine Func _ExecuteCommandLineAttachConsole($sCommandLine) Local $aCall = DllCall("kernel32.dll", "int", "AttachConsole", _ "dword", -1) ; ATTACH_PARENT_PROCESS If @error Or Not $aCall[0] Then Return SetError(1, 0, "") EndIf Local $sPrintString Switch $sCommandLine ; let's say this is ok Case True $sPrintString = @CRLF & "Something was typed." & @CRLF & @CRLF Case Else $sPrintString = @CRLF & "Nothing typed." & @CRLF & @CRLF EndSwitch ConsoleWrite($sPrintString) Local $hConOut = FileOpen("CONOUT$", 1) FileWrite($hConOut, $sPrintString) FileClose($hConOut) ;Send("{ENTER}"); <- this is complete shit EndFunc ;==>_ExecuteCommandLineAttachConsoleHalf of the script works as I expect it to. The problem is with _ExecuteCommandLineAttachConsole() function. If you compile that script without changing AutoIt3Wrapper_GUI directives you and run exe from command prompt you will see what I mean. I need proper way of doing Send("{ENTER}") and before that I need not to lose console when I hit ENTER to run it (this sentence sounds dumb even to me, but I cannot explain it any better, so please just run it as I said). You don't even need to compile the script, you can run it from command prompt to see the issues. Any help is appreciated, of course.1 point
-
Here is my solution, I installed RAdmin Viewer to test it and it works fine also with IP containing custom port :-) so you can use: connection1,10.1.2.3 or connection1,10.1.2.3:8000 Note: As input file use TXT file saved from Excel using File/SaveAs (TXT delimited with comma) ; get file name $saFile = FileOpenDialog( "Select file with computer names", @WorkingDir & "\", "All (*.*)", 1 ) If @error Then MsgBox( 0, "Error","No file selected" ) Exit EndIf ; open file with list of computer names $oFile = FileOpen( $saFile, 0 ) ; Check if file opened for reading OK If $oFile = -1 Then MsgBox( 0, "Error", "Unable to open specified file" ) Exit EndIf ; Read in lines of text until the EOF is reached While 1 $saLine = FileReadLine( $oFile ) If @error = -1 Then ExitLoop EndIf $Line = StringSplit( $saLine , ',' ) ; name,ip on each line for example: connection1,10.1.1.1 or connection1,10.1.1.1:8000 ; beware: here is no checking of correct syntax on each line! each line must be: name,ip or name,ip:port $name = $Line[1] $ip = $Line[2] $port = '' If StringInStr($ip,':') Then ; IP contains also port $ip_port = StringSplit( $ip , ':' ) ; ip:port for example: 10.1.1.1:8000 $ip = $ip_port[1] ; no checking here! $port = $ip_port[2] EndIf ; Activate Radmin Viewer window WinActivate( "Radmin Viewer" ) ; send 'Insert' key ( 'Add new connection' ) to Radmin Viewer Send( "{INSERT}" ) ; wait for the 'New Connection' window WinWait( "New Connection" ); ; add computer name / IP address ControlSetText( "New Connection", "", "Edit1", $name ) ControlSetText( "New Connection", "", "Edit2", $ip ) If $port <> '' Then ; IP contains also port ControlCommand( "New Connection", "", "Button3", "UnCheck", "" ) ; uncheck checkbox of default port ControlSetText( "New Connection", "", "Edit3", $port ) ; Port EndIf ; send 'Enter' key to add computer Send( "{ENTER}" ) Wend ; close file FileClose( $ofile )1 point
-
Ctrl + Break is not working
kcvinu reacted to sdfaheemuddin for a topic
Your laptop may have fn key use Ctrl + Fn key + Break1 point -
https://www.autoitscript.com/autoit3/docs/libfunctions/_FileListToArray.htm1 point
-
BTW you should avoid the use of For/in/Next loops (_Array* funcs mainly work using indexes ) Example #include <Array.au3> Local $aArray[5] = ["test0", "test2", "test4", "test6", "test8"] ;_ArrayDisplay($aArray, "Original") For $vElement In $aArray If StringInStr($vElement, "6") Then Msgbox(0,"", $vElement) _ArrayDelete($aArray, $vElement) ; <== doesnt work EndIf Next _ArrayDisplay($aArray, "Element deleted")1 point
-
_GDIPlus_BitmapCreateFromScan0() Pixelformat: $GDIP_PXF01INDEXED = 1 bit per pixel, indexed $GDIP_PXF04INDEXED = 4 bits per pixel, indexed $GDIP_PXF08INDEXED = 8 bits per pixel, indexed $GDIP_PXF16GRAYSCALE = 16 bits per pixel, grayscale $GDIP_PXF16RGB555 = 16 bits per pixel; 5 bits for each RGB component $GDIP_PXF16RGB565 = 16 bits per pixel; 5 bits for red, 6 bits for green and 5 bits blue $GDIP_PXF16ARGB1555 = 16 bits per pixel; 1 bit for alpha and 5 bits for each RGB component $GDIP_PXF24RGB = 24 bits per pixel; 8 bits for each RGB component $GDIP_PXF32RGB = 32 bits per pixel; 8 bits for each RGB component. No alpha component. $GDIP_PXF32ARGB = 32 bits per pixel; 8 bits for each RGB and alpha component $GDIP_PXF32PARGB = 32 bits per pixel; 8 bits for each RGB and alpha component, pre-mulitiplied1 point
-
The new file is created according with the current lexer.1 point
-
Having a Problem with some calculations (inaccuracies)
jchd reacted to markyrocks for a topic
i think this says it best.... from the help file Arrays in Arrays You may save an array in an array element (item). The thing is, there is no way to directly access that array stored in the element. You have to go through a variable to get access to the embedded array which may make your code overly complicated and difficult to debug. Remember that there may be issues if you pass an array containing arrays into a function and the embedded array is changed inside that function. So, to conclude this, try not to embed arrays within arrays unless you absolutely need to and are prepared to do rigorous testing to make sure your code will always work as expected. what i really think is that your trying to break your computer or get out on the system. or maybe you took one of those pills that unlocked 100% of your brain idk.1 point -
FileMove And iF File Exists Rename
ahmeddzcom reacted to markyrocks for a topic
https://www.autoitscript.com/autoit3/docs/functions/FileMove.htm1 point -
Are you using an utf8 encoded scriptfile? Quick search gave me this answer by adding the following lines to the UDF If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body $objEmail.HTMLBodyPart.CharSet = "UTF-8" Else $objEmail.Textbody = $as_Body & @CRLF $objEmail.TextBodyPart.CharSet = "UTF-8" EndIf ... else please attach a scriptfile for me to test with. Jos1 point
-
Theo Jansen
jaberwacky reacted to corgano for a topic
I was extremely bored, so I started working on this. Still needs a little polishing, but its mostly complete The Theo Jansen Mechanism Done: -Change length of almost all rods -Full rotation -Allows multiple leg sets to be placed over each other -Allows 3 settings for fading out back legs -Color coded (yay) -partial projecting circles (Tells a little about how the points are calculated) To do -Complete color coding and allow for all lengths to be changed (this is easy) -Complete circle projecting -Rename variables -Suggestions? Updates -Drawing many (100+) sets on full is now significantly faster -Drawing many (100+) sets on fade and dim is now faster (Thanks UEZ) here is the code #include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <WinAPI.au3> Global $gui, $pic, $lev1x, $circ1y, $lev1l, $s4, $s5, $circ2r, $msg Global $unit = 0.5 ;VERY IMPORTANT $gui = GUICreate("Theo test", 850, 600) $pic = GUICtrlCreatePic("", 0, 0, 600, 600) $Tab1 = GUICtrlCreateTab( 610, 8, 230, 533) $TabSheet1 = GUICtrlCreateTabItem("Global options") GUICtrlCreateLabel("Size ($unit)", 630, 40) $slev1l = GUICtrlCreateSlider( 620, 55, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 200, 1) GUICtrlSetData(-1, 80) GUICtrlCreateLabel("Crank rotation ($angle)", 630, 90) $sRotation = GUICtrlCreateSlider( 620, 105, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 900, 0) GUICtrlSetData(-1, 90) GUICtrlCreateLabel("Crank length ($crankl)", 620, 140) $scrankl = GUICtrlCreateSlider( 620, 155, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 300, 0) GUICtrlSetData(-1, 120) GUICtrlCreateLabel("Bodyrod width ($bodywidth)",620, 190) $sBodyWidth = GUICtrlCreateSlider( 620, 205, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 500, 0) GUICtrlSetData(-1, 286) ;~ GUICtrlCreateLabel("sssssss", 620, 240) ;~ $sss = GUICtrlCreateSlider( 620, 255, 200, 30) ;~ GUICtrlSetBkColor(-1,0xffffff) ;~ GUICtrlSetLimit(-1, 300, 10) ;~ GUICtrlSetData(-1, 120) ;~ GUICtrlCreateLabel("ddddddddd", 620, 290) ;~ $ddd = GUICtrlCreateSlider( 620, 305, 200, 30) ;~ GUICtrlSetBkColor(-1,0xffffff) ;~ GUICtrlSetLimit(-1, 300, 10) ;~ GUICtrlSetData(-1, 120) GUICtrlCreateLabel("Show....", 620, 340) $chkcircles = GUICtrlCreateCheckbox("Circles?", 620, 370) $chkColors = GUICtrlCreateCheckbox("Colors?", 720, 370) GUICtrlSetState(-1,$GUI_CHECKED) $chklines = GUICtrlCreateCheckbox("Lines?", 620, 400) GUICtrlSetState(-1,$GUI_CHECKED) $chkpnt = GUICtrlCreateCheckbox("Points?", 620, 430) $radFull = GUICtrlCreateRadio("Full", 620, 475) $radDim = GUICtrlCreateRadio("Dim", 660, 475) $radFade = GUICtrlCreateRadio("Fade", 700, 475) GUICtrlSetState($radFull, $GUI_CHECKED) $inputsets = GUICtrlCreateInput("1", 620, 500, 200) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateLabel("Red", 630, 40) $sRED = GUICtrlCreateSlider(620, 55, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 600, 1) GUICtrlSetData(-1, 400) GUICtrlCreateLabel("Green", 630, 90) $green = GUICtrlCreateSlider(620, 105, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 900, 10) GUICtrlSetData(-1, 400) GUICtrlCreateLabel("BLUE", 620, 140) $sBLUE = GUICtrlCreateSlider(620, 155, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 600, 10) GUICtrlSetData(-1, 275) GUICtrlCreateLabel("Cyan", 620, 190) $sCYAN = GUICtrlCreateSlider(620, 205, 200, 30) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetLimit(-1, 600, 10) GUICtrlSetData(-1, 290) ;~ GUICtrlCreateLabel("tttttttttt", 620, 240) ;~ $ttt = GUICtrlCreateSlider(620, 255, 200, 30) ;~ GUICtrlSetBkColor(-1,0xffffff) ;~ GUICtrlSetLimit(-1, 300, 10) ;~ GUICtrlSetData(-1, 120) ;~ GUICtrlCreateLabel("yyyyyyy", 620, 290) ;~ $yyy = GUICtrlCreateSlider(620, 305, 200, 30) ;~ GUICtrlSetBkColor(-1,0xffffff) ;~ GUICtrlSetLimit(-1, 300, 10) ;~ GUICtrlSetData(-1, 120) $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $lev1x, $circ1y, $lev1l, $lev1x, $sRotation refresh() Sleep(10) EndSwitch WEnd Func refresh() $unit = GUICtrlRead($slev1l) / 200 ;get size multiplier $vangle = GUICtrlRead($sRotation) ;Crank rotation $vcrankl = GUICtrlRead($scrankl) ;Crank length $vBodyrodwidth = GUICtrlRead($sBodyWidth) ;Width of body $vPushrodL = GUICtrlRead($green) ;green bars $vHypL = GUICtrlRead($sRED) ;Red bars $vBotTril = GUICtrlRead($sBLUE) ;Blue bars $vOutParl = GUICtrlRead($scyan) ;cyan bars $tcirclesYN = GUICtrlRead($chkcircles) ;show circles? $tlinesYN = GUICtrlRead($chklines) ;Show lines? $tpntYN = GUICtrlRead($chkpnt) ;Show points? $tcolors = GUICtrlRead($chkColors) ;Show pretty colors? If GUICtrlRead($radFull) = $GUI_CHECKED Then $vfademode = 1 If GUICtrlRead($radDim) = $GUI_CHECKED Then $vfademode = 2 If GUICtrlRead($radFade) = $GUI_CHECKED Then $vfademode = 3 $vnumbersets = GUICtrlRead($inputsets) ;how many sets of lags? test($pic, $vangle, $vcrankl, $vBodyrodwidth, $vPushrodL, $vHypL, $vBotTril, $vOutParl, $vnumbersets, $vfademode, $tcirclesYN, $tlinesYN, $tcolors, $tpntYN) EndFunc Func test($ctrl, $angle, $crankl, $Bodyrodwidth, $PushrodL, $HypL, $BotTril, $OutParl, $number = 1, $fademode = 1, $circlesYN = 0, $linesYN = 1, $colorsYN = 1, $pointsYN = 0) Local $hBmp, $hBitmap1, $hGraphic, $hBitmap2, $OldBmp, $one, $two $hBmp = _WinAPI_CreateBitmap(600, 600, 1, 32) _GDIPlus_Startup() $redpen = _GDIPlus_PenCreate(0xFFFF3333) $Greenpen = _GDIPlus_PenCreate(0xFF33ff33) $bluepen = _GDIPlus_PenCreate(0xFF3333ff) $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) $Bodyrodwidth *= $unit $crankl *= $unit $PushrodL *= $unit $HypL *= $unit $BotTril *= $unit $OutParl *= $unit $pcenterx = 300 $pcentery = 200 $pleftx = $pcenterx - $Bodyrodwidth $plefty = $pcentery $prightx = $pcenterx + $Bodyrodwidth $prighty = $pcentery $lev1l = 275 * $unit $llev2l = 290 * $unit $rlev2l = 290 * $unit $llev3l = 275 * $unit shaft($hGraphic, $pleftx, $plefty, $prightx, $prighty,$redpen);"body" bar If $number = "" Then $number = 1 $fade = "0xFF";if somehow the fademode returns not 1, 2, or 3, this will draw it as full $hpen = _GDIPlus_PenCreate($fade&"FFFFFF") If $colorsYN = 1 Then $Redpen = _GDIPlus_PenCreate($fade&"FF3333") $Greenpen = _GDIPlus_PenCreate($fade&"33ff33") $Bluepen = _GDIPlus_PenCreate($fade&"3333ff") $cyanpen = _GDIPlus_PenCreate($fade&"33ddff") Else $Redpen = $hpen $Greenpen = $hpen $Bluepen = $hpen $cyanpen = $hpen EndIf For $i = 0 to ($number-1) step 1 ;If there is no need to fade the pens will be pre declaired once instead of every Step If $fademode <> 1 And $number > 1 Then $fade = "0xFF";if somehow the fademode returns not 1, 2, or 3, this will draw it as full If $fademode = 2 Then $fade = "0x" & Hex(175/$number+75,2) ElseIf $fademode = 3 Then $fade = "0x" & Hex(200/($i + 1)+50,2) EndIf _GDIPlus_PenSetColor($hpen,$fade&"FFFFFF") If $colorsYN = 1 Then _GDIPlus_PenSetColor($Redpen,$fade&"FF3333") _GDIPlus_PenSetColor($Greenpen,$fade&"33ff33") _GDIPlus_PenSetColor($Bluepen,$fade&"3333ff") _GDIPlus_PenSetColor($cyanpen,$fade&"33ddff") Else $Redpen = $hpen $Greenpen = $hpen $Bluepen = $hpen $cyanpen = $hpen EndIf EndIf $crankpos = Angle($pcenterx, $pcentery, $angle, $crankl, $circlesYN) shaft($hGraphic, $crankpos[0],$crankpos[1],$pcenterx, $pcentery,$hpen);crank ;~ ;=====================================================================================================, ;~ || || ;~ || MESUREMENTS : calculations for all the points || ;~ || || ;~ ;=====================================================================================================, $pTopRightTriTip = intcircles($prightx, $prighty, $lev1l, $crankpos[0], $crankpos[1], $PushrodL) If ($pTopRightTriTip[0] + $pTopRightTriTip[2]) = 0 Then Return 0 $pTopRightHypPar = intcircles($prightx, $prighty, $rlev2l, $pTopRightTriTip[0],$pTopRightTriTip[1], $HypL) $pBotRightHypPar = intcircles($pTopRightTriTip[2], $pTopRightTriTip[3], $rlev2l, $pTopRightHypPar[0],$pTopRightHypPar[1], $OutParl) $pBotRightTriTip = intcircles($pBotRightHypPar[0],$pBotRightHypPar[1], $HypL, $pTopRightTriTip[2],$pTopRightTriTip[3], $BotTril) $pTopLeftTriTip = intcircles($pLeftx, $pLefty, $lev1l, $crankpos[0], $crankpos[1], $PushrodL) If ($pTopLeftTriTip[02] + $pTopLeftTriTip[0]) = 0 Then Return 0 $pTopLeftHypPar = intcircles($pLeftx, $pLefty, $rlev2l, $pTopLeftTriTip[2],$pTopLeftTriTip[3], $HypL) $pBotLeftHypPar = intcircles($pTopLeftTriTip[0], $pTopLeftTriTip[1], $rlev2l, $pTopLeftHypPar[2],$pTopLeftHypPar[3], $OutParl) $pBotLeftTriTip = intcircles($pTopLeftTriTip[0],$pTopLeftTriTip[1],$BotTril ,$pBotLeftHypPar[2],$pBotLeftHypPar[3],$HypL) ;~ ;=====================================================================================================, ;~ || || ;~ || LINES : Actual drawing of the lines || ;~ || || ;~ ;=====================================================================================================, If $linesYN = 1 Then shaft($hGraphic, $pTopRightTriTip[2], $pTopRightTriTip[3], $crankpos[0], $crankpos[1], $greenpen);top left pushrod shaft($hGraphic, $pTopRightTriTip[0], $pTopRightTriTip[1], $crankpos[0], $crankpos[1], $greenpen);bottom left pushrod shaft($hGraphic, $pTopRightTriTip[0], $pTopRightTriTip[1], $prightx, $prighty, $hpen);Right side top triangle shaft($hGraphic, $pTopRightTriTip[0], $pTopRightTriTip[1], $pTopRightHypPar[0], $pTopRightHypPar[1], $redpen);long side top triangel shaft($hGraphic, $prightx, $prighty, $pTopRightHypPar[0], $pTopRightHypPar[1], $hpen);Bottom side top triangle shaft($hGraphic, $pTopRightTriTip[2], $pTopRightTriTip[3], $prightx, $prighty, $hpen);inside parallel bar shaft($hGraphic, $pBotRightHypPar[0], $pBotRightHypPar[1], $pTopRightHypPar[0], $pTopRightHypPar[1], $cyanpen);outside parallel bar shaft($hGraphic, $pTopRightTriTip[2], $pTopRightTriTip[3], $pBotRightHypPar[0], $pBotRightHypPar[1], $hpen);top side bottom triangel shaft($hGraphic, $pBotRightHypPar[0], $pBotRightHypPar[1], $pBotRightTriTip[2], $pBotRightTriTip[3], $redpen);long side bottom triangel shaft($hGraphic, $pTopRightTriTip[2], $pTopRightTriTip[3], $pBotRightTriTip[2], $pBotRightTriTip[3], $Bluepen);right side bottom triangel shaft($hGraphic, $pTopLeftTriTip[0],$pTopLeftTriTip[1],$crankpos[0],$crankpos[1],$greenpen);top left pushrod shaft($hGraphic, $pTopLeftTriTip[2],$pTopLeftTriTip[3],$crankpos[0],$crankpos[1],$greenpen);bottom left pushrod shaft($hGraphic, $pTopLeftTriTip[2], $pTopLeftTriTip[3], $pLeftx, $pLefty, $hpen);Left side top triangle shaft($hGraphic, $pTopLeftTriTip[2], $pTopLeftTriTip[3], $pTopLeftHypPar[2], $pTopLeftHypPar[3], $redpen);long side top triangel shaft($hGraphic, $pLeftx, $pLefty, $pTopLeftHypPar[2], $pTopLeftHypPar[3], $hpen);Bottom side top triangle shaft($hGraphic, $pTopLeftTriTip[0], $pTopLeftTriTip[1], $pLeftx, $pLefty, $hpen); Inside parallel bar shaft($hGraphic, $pBotLeftHypPar[2], $pBotLeftHypPar[3], $pTopLeftHypPar[2], $pTopLeftHypPar[3], $cyanpen);Outside par bqr shaft($hGraphic, $pTopLeftTriTip[0], $pTopLeftTriTip[1], $pBotLeftHypPar[2], $pBotLeftHypPar[3], $hpen);top side bottom triangel shaft($hGraphic, $pBotLeftHypPar[2], $pBotLeftHypPar[3], $pBotLeftTriTip[2], $pBotLeftTriTip[3], $redpen);long side bottom triangel shaft($hGraphic, $pTopLeftTriTip[0], $pTopLeftTriTip[1], $pBotLeftTriTip[2], $pBotLeftTriTip[3], $Bluepen);Left side bottom triangel EndIf ;~ ;=====================================================================================================, ;~ || || ;~ || Circles : drawing of the Circles || ;~ || || ;~ ;=====================================================================================================, If $circlesYN = 1 Then _GDIPlus_GraphicsDrawEllipse($hGraphic, $pleftx-$lev1l, $plefty-$lev1l, $lev1l*2, $lev1l*2, $hpen) _GDIPlus_GraphicsDrawEllipse($hGraphic, $prightx-$lev1l, $prighty-$lev1l, $lev1l*2, $lev1l*2, $hpen) _GDIPlus_GraphicsDrawEllipse($hGraphic, $crankpos[0]-$PushrodL, $crankpos[1]-$PushrodL, $PushrodL*2, $PushrodL*2, $hpen) ;~ _GDIPlus_GraphicsDrawEllipse($hGraphic, $pcenterx - ($crankl), $pcentery - ($crankl), $crankl*2, $crankl*2, $hpen) ;~ _GDIPlus_GraphicsDrawEllipse($hGraphic, $pTopRightTriTip[0] - ($HypL), $pTopRightTriTip[1] - ($HypL), $HypL*2, $HypL*2, $hpen) _GDIPlus_GraphicsDrawEllipse($hGraphic, $pTopRightHypPar[0] - ($lev1l), $pTopRightHypPar[1] - ($lev1l), $lev1l*2, $lev1l*2, $hpen) ;~ _GDIPlus_GraphicsDrawEllipse($hGraphic, $pBotRightHypPar[0] - ($HypL), $pBotRightHypPar[1] - ($HypL), $HypL*2, $HypL*2, $hpen) _GDIPlus_GraphicsDrawEllipse($hGraphic, $pTopRightTriTip[2] - ($lev1l), $pTopRightTriTip[3] - ($lev1l), $lev1l*2, $lev1l*2, $hpen) If $pointsYN = 1 Then $circlesYN = 5 EndIf ;~ ;=====================================================================================================, ;~ || || ;~ || Points : Only drawn if lines are off || ;~ || || ;~ ;=====================================================================================================, If $linesYN <> 1 And $pointsYN = 1 Then point($hGraphic,$prightx,$prighty,$hpen) point($hGraphic,$crankpos[0],$crankpos[1],$hpen) point($hGraphic,$pTopRightTriTip[2],$pTopRightTriTip[3],$hpen) point($hGraphic,$pTopRightTriTip[0],$pTopRightTriTip[1],$hpen) point($hGraphic,$pTopRightHypPar[0],$pTopRightHypPar[1],$hpen) point($hGraphic,$pBotRightHypPar[0],$pBotRightHypPar[1],$hpen) point($hgraphic,$pBotRightTriTip[2],$pBotRightTriTip[3],$hpen) point($hGraphic,$pLeftx,$pLefty,$hpen) point($hGraphic,$crankpos[0],$crankpos[1],$hpen) point($hGraphic,$pTopLeftTriTip[2],$pTopLeftTriTip[3],$hpen) point($hGraphic,$pTopLeftTriTip[0],$pTopLeftTriTip[1],$hpen) point($hGraphic,$pTopLeftHypPar[2],$pTopLeftHypPar[3],$hpen) point($hGraphic,$pBotLeftHypPar[2],$pBotLeftHypPar[3],$hpen) point($hgraphic,$pBotLeftTriTip[2],$pBotLeftTriTip[3],$hpen) EndIf $angle += (360 / $number) Next $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $oldbmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_PenDispose($redpen) _GDIPlus_PenDispose($bluepen) _GDIPlus_PenDispose($greenpen) _GDIPlus_PenDispose($hpen) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBmp) ;~ Sleep(10) EndFunc ;==>fracircle ;~ ;=====================================================================================================, ;~ || || ;~ || Angle : point $return is $length away from $input XY @ $angle || ;~ || || ;~ ;=====================================================================================================, Func Angle($x1, $y1, $Ang, $Length, $round = 0) If $Ang >= 360 Then $Ang -= 360 Local $Return[2] $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>Angle ;~ ;=============================================================================================================, ;~ || || ;~ || intcircles : Finds where circle at X/Y1 with a radius of R1 meats a circle at X/Y0 with a radius of R0 || ;~ || return[0/1] = x/y of 1rst point the circles meet || ;~ || return[2/3] = x/y of 2rst point the circles meet || ;~ || || ;~ ;=============================================================================================================, func intcircles($x0,$y0,$r0,$x1,$y1,$r1) Local $xp2, $yp2, $dx, $dy, $d Local $return[4] $dx = $x1 - $x0; $dy = $y1 - $y0; $d = sqrt(($x1 - $x0)^2 + ($y1 - $y0)^2) if ($d > ($r0 + $r1)) Then ;no solution. circles do not intersect. SetError(1,"no solution. circles do not intersect.") ConsoleWrite($d & @crlf) Return $return Elseif ($d < $r0 - $r1) Then ;no solution. one circle is contained in the other */ SetError(2);unsaluveable ConsoleWrite($d & @crlf) Return $return EndIf ;Determine the distance from point 0 to point 2. $a = ($r0^2 - $r1^2 + $d^2) / (2.0 * $d) ;Determine the coordinates of point 2. */ $x2 = $x0 + ($dx * $a/$d); $y2 = $y0 + ($dy * $a/$d); ;Determine the distance from point 2 to either of the intersection points. $h = sqrt(($r0*$r0) - ($a*$a)) ; Now determine the offsets of the intersection points from point 2. $rx = -$dy * ($h/$d); $ry = $dx * ($h/$d); ; Determine the absolute intersection points. ; $return[0] = ($x2 + $rx);+($d/2) $return[2] = ($x2 - $rx);+($d/2) $return[1] = ($y2 + $ry);-($d/2) $return[3] = ($y2 - $ry);-($d/2) If ($return[0] + $return[2]) = 0 Then SetError(3) EndIf return $return EndFunc ;~ ;=====================================================================================================, ;~ || || ;~ || GetAngle : X/Y1 is $return degrees from X/Y2 || ;~ || || ;~ ;=====================================================================================================, Func GetAngle($X1, $Y1, $X2, $Y2) Dim $XDiff Dim $YDiff Dim $TempAngle $YDiff = Abs($Y2 - $Y1) If $X1 = $X2 And $Y1 = $Y2 Then Return 0 If $YDiff = 0 And $X1 < $X2 Then Return 0 ElseIf $YDiff = 0 And $X1 > $X2 Then Return 3.14159265358979 * 57.2957795130823 EndIf $XDiff = Abs($X2 - $X1) $TempAngle = ATan($XDiff / $YDiff) If $Y2 > $Y1 Then $TempAngle = 3.14159265358979 - $TempAngle If $X2 < $X1 Then $TempAngle = -$TempAngle $TempAngle = 1.5707963267949 - $TempAngle If $TempAngle < 0 Then $TempAngle = 6.28318530717959 + $TempAngle Return $TempAngle * 57.2957795130823 endFunc ;~ ;=====================================================================================================, ;~ || || ;~ || shaft: use is same as drawing a line, output si a graphicly superior version || ;~ || || ;~ ;=====================================================================================================, Func shaft($hGraphic,$x1,$y1,$x2,$y2,$hpen) $angle = getangle($x1,$y1,$x2,$y2) ;~ ConsoleWrite($angle & @crlf) $dist = sqrt(($x2 - $x1)^2 + ($y2 - $y1)^2) $pos1 = Angle($x1, $y1, $angle + 90, 5) $pos2 = Angle($x1, $y1, $angle - 90, 5) $pos3 = Angle($x2, $y2, $angle + 90, 5) $pos4 = Angle($x2, $y2, $angle - 90, 5) _GDIPlus_GraphicsDrawLine($hGraphic,$pos1[0],$pos1[1],$pos3[0],$pos3[1],$hpen) _GDIPlus_GraphicsDrawLine($hGraphic,$pos2[0],$pos2[1],$pos4[0],$pos4[1],$hpen) _GDIPlus_GraphicsDrawEllipse($hGraphic, $x1-5, $y1-5, 10, 10, $hpen) _GDIPlus_GraphicsDrawEllipse($hGraphic, $x2-5, $y2-5, 10, 10, $hpen) EndFunc ;~ ;=====================================================================================================, ;~ || || ;~ || Point : Because i am lazy || ;~ || || ;~ ;=====================================================================================================, Func point($hGraphic,$x,$y,$hpen,$r = 10) _GDIPlus_GraphicsDrawEllipse($hGraphic, $x-($r/2), $y-($r/2), $r, $r, $hpen) EndFunc1 point