Leaderboard
Popular Content
Showing content with the highest reputation on 03/21/2016 in all areas
-
Control Viewer - AutoIt Window Info Tool
mythicalzxc reacted to Yashied for a topic
LAST VERSION - 1.1 18-May-12 Control Viewer (CV) is a replacement of AutoIt Window Info with a number of advantages. I tried to stick to the interface of the last, so you almost do not have to be retrained. During testing, I never managed to find any controls that could not be identified by CV (on the contrary, shows a lot of hidden controls, especially for the system windows). The all program settings are stored in the following registry key: HKEY_CURRENT_USERSoftwareY'sControl Viewer The main differences CV from AWI Shows the complete list of all existing controls for the window that are interested (visible, hidden and deleted controls are displayed with different colors that can be changed to any other).Dynamically changing information during search for the windows and their controls.Ability to quickly switch between controls in the list.Ability to show/hide any controls from the list (useful for the overlaping controls).Information for the Style and ExStyle parameters shown in the form of hexadecimal values, and as its flags.Added the PID and Path parameters in the Window tab and ability to quickly open a folder that containing the process file.Added the coordinate system relative to the selected control.Shows a color of the selected pixel in RGB and BGR formats.Shows an example fill of the selected color.Ability to select the text encoding (affects the Text parameter in the Control tab).The complete change the appearance of pop-up frame for the selected controls.Simple and convenient tool to get a screenshot of the part screen of interest for publication on the forum (Capture tab).Create a report in the clipboard or a text file for subsequent publication on the forum.Search all running AutoIt scripts and their windows in the system (AutoIt tab).User-friendly interface. Used shortcuts Ctrl+Alt+T - Enable/Disable "Always On Top" mode (also available from the menu). Ctrl+Alt+H - Enable/Disable highlight selected controls (also available from the menu). Ctrl+A - Select all text (works in any input field). Ctrl - Hold down when moving the mouse to scroll the screenshot (Capture tab). Shift - Hold down when stretching/compression of the contour frame for an equilateral resizing screenshots (Capture tab). DoubleClick (on the screenshot) - Save the image to a file (Capture tab). DoubleClick (on any list item) - Open a folder with the file of the process or AutoIt script (AutoIt tab). Del (on any list item) - Close process (AutoIt tab). F5 - Updating the list (AutoIt tab). If anyone have any questions or comments about CV, please post it in this thread. I will be glad to any feedback and suggestions. Files to download Binary (x86 and x64) Redirection to CV_bin.zip, 1.14 MB CV_bin.html Source Redirection to CV_source.zip, 691 KB CV_source.html1 point -
Version 1.7.0.1
10,051 downloads
Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None1 point -
functions with parameters in OnEvent and HotKeys
Messy_Code_Guy reacted to martin for a topic
The UDF function SetOnEventA can replace the inbuilt AutoIt functions GuiCtrlSetOnEvent, GuiSetOnEvent, HotKeySet and TraySetOnEvent providing an easy way for an event to call functions with parameters. Example1 - no parameters GuiCtrlCreateButton("Open",20,20,80,22) SetOnEventA(-1,"OpenIt");same as using GuiCtrlSetOnEvent because no parameters listed for the function "OpenIt" Example 2 - 3 parameters Parameters are added to the SetOnEvent function in 2 parts. The first part tells SetOnEvent whether the parameter is a value or a variable, and the second part is the value or variable to be passed to the function. GuiCtrlCreateButton("Open",20,20,80,22) SetOnEventA(-1,"Function1",$paramByVal,$param1,$ParamByVal, $Param2,$ParamByRef, "$VarABC")where $ParamByVal and $ParamByRef are constants defined in the UDF. $ParamByVal means the following parameter for the function is a value. It could be 12 or $SomeVar but whatever it is the value will be used. $ParamByRef means the following parameter is the variable to use. It must be enclosed in quotes as shown above (but with or without the $ prefix). Then, when the function for the event is called the parameter passed will be the value of that variable at the time of the event. So Function1 will appear like this in the script. Func Function1($a,$b) If within the function you need to know the Control which created the event then instead of using @GUI_CtrlId use GetCtrlID() or GetCtrlHandle(). If within the function you need to know the drag ids then use the function EventGetDragIDs Example 3 - Set a Hotkey for Alt k to call the function "StartKerning" with 2 parameters. SetOnEventA("!k","StartKerning",$ParamByVal,26,$ParamByRef,"$margin") Example 4 - Set a Gui event For gui events the first parameter must be passed by Val and the value must either be 0 or the handle of the window the event is for. If you only have one window then the gui handle is not relevant but it must still be the first parameter. SetOnEventA($GUI_EVENT_CLOSE,"AllDone", $paramByVal, $gui,$paramByRef,"$rrdd") Example 5 - Set a Tray menu item event (Version 12 of the UDF or later) $iTrayIt1 =TrayCreateItem("BackGround") TraySetOnEventA(-1,"SetGuiCol", $paramByVal, $iLastGuiCol) Limitations I have only allowed for the function to be called to have up to 5 parameters. (Instructions are in the UDF on how to increase this.) A better solution would be to write your function to have an array as a parameter. If a parameter is a variable then it has to be a Global variable. Although you can have variables passed as parameters, ByRef for a parameter in the function called will have no effect. Here is the udf with an example OnEventFunc downloader But the latest udf is attached to post #49 untill I upload it and correct the link. UPDATES: 12th December 2008 UDF changed to a version which doesn't need you to specify the number of parameters passed to the on event function when you call SetOnEventA. It makes things simpler but it isn't compatible with the earlier version. So I've kept the old function SetOnEvent which simply calls the new function without the unnecessary parameter. New scripts can call the new function which is SetOnEventA. 12th Jan 2009. Error in last version corrected. Thanks to FireFox for pointing out something was wrong. 4th Feruary 2009 -V10. Added setting Gui Events, thanks to GaRydelaMer 5th Feb 2009 -V11 corrected error in HotKey event setting in the udf and error in the example. 27th February 2010. Added TraySetOnEventA for Tray menu Items. (Thanks to FireFox) 14th Oct 2011. Corrected forgetting to declare $iParCount in 2 functions. (Thanks to ovideo.) 30th August 2014 Correct overlooking removing a function for an event and allowed for no parameters. (Thanks to PsiLink) mgrefOnEvent1 point -
So in my time of coding I found a better, precise and more powerful way of finding element objects by classname and by tags. Its called querySelectorAll and it looks like this. Now I can forget needing to use a combination of _ietagnameget... and _iegetobjbyclassname... and just use one function. I have not tested this on the latest version of autoit, due to the many script braking changes, but I think it should still work. Credit to Dale Hohm who built the foundation of IE UDF and mLipok who made the error checking better on a previous post. DO note: This a relatively recent add-on to IE so it requires IE 9 and above. If you find you receive a com error of "unknown name" its likely the site is using meta tag attribute X-UA-Compatible which has reverted the browser to forget about it. Comments welcome ;#FUNCTION#============================================================================================================= ; Name...........: _IEquerySelectorAll() ; Description ...: Returns an Object or a Colection of objects ; Syntax.........: (ByRef $oDoc, $sQuery, $iItemIndex = Default) ; Parameters ....: $oDoc - The document object from IE ; $sQuery - String of Query. Example: _IEquerySelectorAll($oDoc, '"div.note, div.alert"', Default) will return a colection of div elements with classes of note and alert ; $iItemIndex - [optional] Default returns a colection, else use a 0 based index to indicate the object in sequence ; Return values .: Success - Object or a Colection of objects ; Failure - returns 0 sets the @error flag to non-zero. ; 3 ($_IEStatus_InvalidDataType) - Invalid Data Type ; 4 ($_IEStatus_InvalidObjectType) - Invalid Object Type ; 5 ($_IEStatus_InvalidValue) - Invalid Value ; 7 ($_IEStatus_NoMatch) - No Match ; Author ........: XThrax aka uncommon ; Remarks .......: This fuction was pretty much stolen from Dale Hohm the IE UDF creator so much credit to him, also to mLipok who made the error checking better. ; Also note that this a relatively recent add-on to IE so it requires IE 9 and above. ; If you find you receive a com error of "unknown name" its likely the site is using meta tag attribute X-UA-Compatible which has reverted the browser to forget about it. ; ; Related .......: _IETagNameAllGetCollection();_IEClassNameGetCollection() ; Link ..........;https://www.autoitscript.com/forum/topic/181376-_iequeryselectorall/ ; https://msdn.microsoft.com/en-us/library/cc304115(v=vs.85).aspx ; Example .......; No ; ===================================================================================================================== Func _IEquerySelectorAll(ByRef $oDoc, $sQuery, $iItemIndex = Default) If Not IsObj($oDoc) Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IEStatus_InvalidDataType & " Invalid DataType" & @LF) Return SetError($_IEStatus_InvalidDataType, 1, 0) ElseIf Not __IEIsObjType($oDoc, "browserdom") Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IEStatus_InvalidObjectType & " Invalid ObjectType" & @LF) Return SetError($_IEStatus_InvalidObjectType, 2, 0) ElseIf Not IsNumber($iItemIndex) And $iItemIndex <> Default Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IEStatus_InvalidValue & " Invalid Index" & @LF) Return SetError($_IEStatus_InvalidValue, 3, 0) ElseIf $iItemIndex = Default Or $iItemIndex >= 0 Then Local $oTemp = Null If __IEIsObjType($oDoc, "documentcontainer") Then $oTemp = _IEDocGetObj($oDoc) ConsoleWriteError("--> _IEDocGetObj Error: " & @error & " Ext: " & @extended & @LF) If @error Then Return SetError(@error, @extended, 0) Else $oTemp = $oDoc EndIf Local $oClassColl = $oTemp.querySelectorAll($sQuery) If @error Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IESTATUS_GeneralError & " GeneralError1: " & @error & @LF) Return SetError($_IESTATUS_GeneralError, 3, 0) ElseIf (Not IsObj($oClassColl)) Or $oClassColl = Null Or $oClassColl.length = 0 Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IEStatus_NoMatch & " NoMatch" & @LF) Return SetError($_IEStatus_NoMatch, 0, 0) ; Could be caused by parameter 2, 3 or both Else If $iItemIndex = Default Then Return SetError($_IEStatus_Success, $oClassColl.length, $oClassColl) ElseIf $iItemIndex > $oClassColl.length Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IEStatus_InvalidValue & " Invalid Value" & @LF) Return SetError($_IEStatus_InvalidValue, $oClassColl.length, 0) Else $oItem = $oClassColl.Item($iItemIndex) If @error Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IESTATUS_GeneralError & " GeneralError2: " & @error & @LF) Return SetError($_IESTATUS_GeneralError, 3, 0) ElseIf (Not IsObj($oItem)) Or $oItem = Null Then ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IEStatus_NoMatch & " NoMatch Index: " & $iItemIndex & @LF) Return SetError($_IEStatus_NoMatch, 0, 0) ; Could be caused by parameter 2, 3 or both Else Return SetError($_IEStatus_Success, 0, $oItem) EndIf EndIf EndIf Else ConsoleWriteError("--> _IEquerySelectorAll Error: " & $_IEStatus_InvalidValue & " Invalid Value: " & $iItemIndex & @LF) Return SetError($_IEStatus_InvalidValue, 3, 0) EndIf EndFunc ;==>_IEquerySelectorAll1 point
-
1 point
-
storing a lot non-subsequent and uneven digit of numbers somewhere
FMS reacted to InunoTaishou for a topic
You can store them in a file with a delimiter. When you need to retrieve them then use string split to split it by the delimiter. Giving you an array with each element. #include <Array.au3> #include <File.au3> Local $aData[255] Local $sFileData = "" For $i = 0 to 254 $aData[$i] = Round(Random(1, 65536), 3) Next $sFileData = _ArrayToString($aData, "|") _ArrayDisplay($aData, "$aData Array") FileWrite(@TempDir & "\Numbers.txt", $sFileData) ShellExecute(@TempDir & "\Numbers.txt") Sleep(1000) $aData = 0 ConsoleWrite("A data has been destroyed" & @CRLF) ConsoleWrite("Contents of our 'Numbers.txt' file: " & FileRead(@TempDir & "\Numbers.txt") & @CRLF) Local $aLoadedData = StringSplit(FileRead(@TempDir & "\Numbers.txt"), "|") _ArrayDisplay($aLoadedData, "$aLoadedData Array") FileDelete(@TempDir & "$sFileData")1 point -
Need a sample of how to find a picture and add a hypelink in a Word document.
Messy_Code_Guy reacted to water for a topic
The UDFs are written in AutoIt as well. Can you please post the code to create the template? It should be easy to add the links.1 point -
awful error : recursion level has been exceeded
DrAhmed reacted to InunoTaishou for a topic
Func Connect($IP, $Port) Local $iConnectAttempts = 0 TCPStartup() Do $ConnectedSocket = TCPConnect($IP, $Port) Sleep(1000) Until ($ConnectedSocket > 0 or $iConnectAttempts > 10) Return ($ConnectedSocket > 0 ? True : SetError(1, 0, 0)) EndFunc ;==>Connect1 point -
First I would like to thank all of the great programmers here on the AutoIt forums. Your examples are extremely helpful because sometimes the help files don't give quite enough information. My problem is I just finished a program and wanted to compile it so I could let a few friends have a copy of it for beta testing. I've searched the forums, and there just doesn't seem to be enough information that I fully understand. The help files are also of little use if you are not 100% sure what you are searching for. What I would like to do: I want the compiled program to have an install, so that I can tell it where the program is to be located on the user computer. I would like to include folders that contain images and or other files that are in the program such as an INI. I am pretty new to programming, but did my best to keep the code clean as well as documented. I maybe didn't need to insert the entire code which is over 800 lines of code, but if you want to see how it works It's now available. Well, the code is There are 6 images not included. #cs ====================================================================================================================== Built with Autoit v3.6.0 Program Name: Swing Calculator WGT Version v0.0.0.2 Beta Design Date: March 20, 2016 Author: Larry Whaley Company: Integral Dezign Contributions: AutoIt Forums, and all of the great post by so many talented programers! Program Overview: This program is to only be used to help you figure out shot distance on WGT. All formulas are free for download and available in the ABOUT page on the website. Use the Unknown feature when you find yourself coming up short or long. More information will be available soon. ============================================================================================================================ #ce ; For some reason even though my script is saved in the "To Work With Folder" @ScriptDir, and @WorkingDir do not work! I've got to use full path. ; Trying to include images in my exe after compile, but can't seem to get it to work. Need HELP!! Local $aFileInstall = FileInstall("C:\AutoIt3 Test Programs\To Work With\swing calculator\images\cross_dn_arrow.bmp", "c:\Program Files (86)\Swing Bot Calc\images", 1) Local $bFileInstall = FileInstall("C:\AutoIt3 Test Programs\To Work With\swing calculator\images\cross_up_arrow.bmp", "c:\Program Files (86)\Swing Bot Calc\images", 1) Local $cFileInstall = FileInstall("C:\AutoIt3 Test Programs\To Work With\swing calculator\images\dn_arrow.bmp", "c:\Program Files (86)\Swing Bot Calc\images", 1) Local $dFileInstall = FileInstall("C:\AutoIt3 Test Programs\To Work With\swing calculator\images\side_arrow.bmp", "c:\Program Files (86)\Swing Bot Calc\images", 1) Local $eFileInstall = FileInstall("C:\AutoIt3 Test Programs\To Work With\swing calculator\images\up_arrow.bmp", "c:\Program Files (86)\Swing Bot Calc\images", 1) Local $fFileInstall = FileInstall("C:\AutoIt3 Test Programs\To Work With\swing calculator\images\Golf_flag.ico", "c:\Program Files (86)\Swing Bot Calc\images", 1) #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Global $Form1 = GUICreate("Distance Calculator WGT", 533, 460, 579, 488) GUISetIcon("c:\AutoIt3 Test Programs\To Work With\swing calculator\images\Golf_flag.ico", -1) ;~ Create Group for radio buttons wind direction Global $WRadioGroup = GUICtrlCreateGroup("", 77, 60, 55, 165) ;~ Picture that reads a message Local $MsgEdit = GUICtrlCreateLabel("", 303, 70, 210, 150, BitOR($GUI_SS_DEFAULT_EDIT, $ES_CENTER)) GUICtrlSetData(-1, "This Program Is For The Purpose Of Assisting You In Making Different Shots. We Make No Claim To Have 100% Accuracy. Use the Unknown Box For Roll Out Or Where the Lie Plays Longer." & _ @CRLF & @CRLF & "WGT Distance Calculator" & @CRLF & "Ver. 0.0.0.2 Beta") GUICtrlSetState(-1, $GUI_ENABLE) ;~ wind direction images with radio buttons Local $PicAU = GUICtrlCreatePic("c:\AutoIt3 Test Programs\To Work With\swing calculator\images\up_arrow.bmp", 79, 70, 25, 25) GUICtrlSetGraphic($PicAU, "") Global $RadioAU = GUICtrlCreateRadio("", 110, 75, 17, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHTBUTTON)) Local $PicAD = GUICtrlCreatePic("c:\AutoIt3 Test Programs\To Work With\swing calculator\images\dn_arrow.bmp", 79, 100, 25, 25) GUICtrlSetGraphic($PicAD, "") Global $RadioAD = GUICtrlCreateRadio("", 110, 105, 17, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHTBUTTON)) Local $PicAS = GUICtrlCreatePic("c:\AutoIt3 Test Programs\To Work With\swing calculator\images\side_arrow.bmp", 79, 130, 25, 25) GUICtrlSetGraphic($PicAS, "") Global $RadioAS = GUICtrlCreateRadio("", 110, 135, 17, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHTBUTTON)) Local $PicACU = GUICtrlCreatePic("c:\AutoIt3 Test Programs\To Work With\swing calculator\images\cross_up_arrow.bmp", 79, 160, 25, 25) GUICtrlSetGraphic($PicACU, "") Global $RadioACU = GUICtrlCreateRadio("", 110, 165, 17, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHTBUTTON)) Local $PicACD = GUICtrlCreatePic("c:\AutoIt3 Test Programs\To Work With\swing calculator\images\cross_dn_arrow.bmp", 79, 190, 25, 25) GUICtrlSetGraphic($PicACD, "") Global $RadioACD = GUICtrlCreateRadio("", 110, 195, 17, 17, BitOR($GUI_SS_DEFAULT_RADIO, $BS_RIGHTBUTTON)) GUICtrlCreateGroup("", -99, -99, 1, 1) ;~ end wind directions with images ;~ Inputs Global $InputDistance = GUICtrlCreateInput("", 16, 38, 40, 21) Global $InputWind = GUICtrlCreateInput("", 78, 38, 40, 21) Global $InputHeightFtU = GUICtrlCreateInput("", 159, 38, 40, 21) GUICtrlSetBkColor(-1, 0xFFFF00) Global $InputHeightFtD = GUICtrlCreateInput("", 159, 64, 40, 21) GUICtrlSetBkColor(-1, 0xFFFF00) Global $InputHeightInU = GUICtrlCreateInput("", 231, 38, 40, 21) Global $InputHeightInD = GUICtrlCreateInput("", 231, 64, 40, 21) Global $InputUnknown = GUICtrlCreateInput("", 465, 38, 40, 21) ;~ Combo box additionals Global $ComboRough = GUICtrlCreateCombo("Fairway", 303, 38, 60, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData($ComboRough, "10-20%|20-25%|30-40%|40-50%|50-60%|60-70%|70-80%", "Fairway") Global $ComboSand = GUICtrlCreateCombo("None", 384, 38, 60, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData($ComboSand, "10-20%|20-25%|30-40%|40-50%|50-60%|60-70%|70-80%", "None") ;~ Labels Global $HeightFtUpLabel = GUICtrlCreateLabel("UP", 140, 42, 20, 21) Global $HeightFtDnLabel = GUICtrlCreateLabel("DN", 140, 68, 20, 21) Global $HeightInUpLabel = GUICtrlCreateLabel("UP", 212, 42, 20, 21) Global $HeightInDnLabel = GUICtrlCreateLabel("DN", 212, 68, 20, 21) Global $DistanceLabel = GUICtrlCreateLabel("Distance", 15, 16, 46, 17) Global $WindLabel = GUICtrlCreateLabel("Wind", 85, 16, 29, 17) Global $HeightFtLabel = GUICtrlCreateLabel("Elev. FT.", 159, 16, 50, 17) Global $HeightInLabel = GUICtrlCreateLabel("Elev. IN.", 231, 16, 50, 17) Global $RoughtLabel = GUICtrlCreateLabel("Rough", 315, 16, 36, 17) Global $SandLabel = GUICtrlCreateLabel("Sand", 400, 16, 29, 17) Global $UnknownLabel = GUICtrlCreateLabel("Unknown", 462, 16, 50, 17) Global $FullLabel = GUICtrlCreateLabel("Full:", 32, 233, 23, 17) Global $PunchLabel = GUICtrlCreateLabel("Punch:", 17, 267, 38, 17) Global $PitchLabel = GUICtrlCreateLabel("Pitch:", 24, 302, 31, 17) Global $FlopLabel = GUICtrlCreateLabel("Flop:", 28, 337, 27, 17) Global $ChipLabel = GUICtrlCreateLabel("Chip:", 27, 370, 28, 17) ;~ Output Global $ChipOutLabel = GUICtrlCreateLabel("", 69, 370, 50, 17) Global $FlopOutLabel = GUICtrlCreateLabel("", 69, 337, 50, 17) Global $PitchOutLabel = GUICtrlCreateLabel("", 69, 302, 50, 17) Global $PunchOutLabel = GUICtrlCreateLabel("", 69, 267, 50, 17) Global $FullOutLabel = GUICtrlCreateLabel("", 69, 233, 50, 17) ;~ Putting Group Labels Global $PuttingGroup = GUICtrlCreateGroup("Putting", 143, 220, 375, 195) Global $PDistanceLabel = GUICtrlCreateLabel("Distance", 167, 240, 46, 17) Global $PVerySlowLabel = GUICtrlCreateLabel("Very Slow:", 180, 317, 54, 17) Global $PUnknownLabel = GUICtrlCreateLabel("Unknown", 439, 240, 50, 17) Global $PSlowLabel = GUICtrlCreateLabel("Slow:", 180, 340, 30, 17) Global $PStandardLabel = GUICtrlCreateLabel("Standard:", 180, 364, 50, 17) Global $PFastLabel = GUICtrlCreateLabel("Fast:", 180, 387, 27, 17) Global $PHeightInLabel = GUICtrlCreateLabel("Elev. IN.", 257, 240, 50, 17) Global $PHeightFtLabel = GUICtrlCreateLabel("Elev. FT.", 349, 240, 50, 17) Global $PVeryFastLabel = GUICtrlCreateLabel("Very Fast:", 343, 317, 51, 17) Global $PT11Label = GUICtrlCreateLabel("Tournament 11:", 343, 340, 76, 17) Global $PT12Label = GUICtrlCreateLabel("Tournament 12:", 343, 364, 76, 17) Global $PT13Label = GUICtrlCreateLabel("Tournament 13:", 343, 387, 76, 17) Global $PHeightInULabel = GUICtrlCreateLabel("UP", 237, 264, 20, 21) Global $PHeightInDLabel = GUICtrlCreateLabel("DN", 237, 292, 20, 21) Global $PHeightFtULabel = GUICtrlCreateLabel("UP", 330, 264, 20, 21) Global $PHeightFtDLabel = GUICtrlCreateLabel("DN", 330, 292, 20, 21) ;~ Output Global $PVerySlowOutLabel = GUICtrlCreateLabel("", 243, 317, 50, 17) Global $PSlowOutLabel = GUICtrlCreateLabel("", 243, 340, 50, 17) Global $PFastOutLabel = GUICtrlCreateLabel("", 243, 387, 50, 17) Global $PStandardOutLabel = GUICtrlCreateLabel("", 243, 364, 50, 17) Global $PT11OutLabel = GUICtrlCreateLabel("", 434, 340, 50, 17) Global $PVeryFastOutLabel = GUICtrlCreateLabel("", 434, 317, 50, 17) Global $PT13OutLabel = GUICtrlCreateLabel("", 434, 387, 50, 17) Global $PT12OutLabel = GUICtrlCreateLabel("", 434, 364, 50, 17) ;~ Input Global $PDistanceInput = GUICtrlCreateInput("", 167, 262, 40, 21) Global $PHeightInUInput = GUICtrlCreateInput("", 257, 262, 40, 21) Global $PHeightInDInput = GUICtrlCreateInput("", 257, 290, 40, 21) Global $PHeightFtUInput = GUICtrlCreateInput("", 350, 262, 40, 21) GUICtrlSetBkColor(-1, 0xFFFF00) Global $PHeightFtDInput = GUICtrlCreateInput("", 350, 290, 40, 21) GUICtrlSetBkColor(-1, 0xFFFF00) Global $PUnknownInput = GUICtrlCreateInput("", 442, 262, 40, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) ;~ Reset Button Global $ResetButton = GUICtrlCreateButton("RESET", 270, 427, 250, 21) ;~ Calculate Button Global $CalButton = GUICtrlCreateButton("Calculate", 16, 427, 250, 21) ;~ New Command for Function GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") ;~ End New Command GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ResetButton GUICtrlSetData($PDistanceInput, "") GUICtrlSetData($PHeightFtUInput, "") GUICtrlSetData($PHeightFtDInput, "") GUICtrlSetData($PHeightInUInput, "") GUICtrlSetData($PHeightInDInput, "") GUICtrlSetData($PUnknownInput, "") GUICtrlSetData($ComboRough, "Fairway") GUICtrlSetData($ComboSand, "None") GUICtrlSetData($InputHeightFtU, "") GUICtrlSetData($InputHeightFtD, "") GUICtrlSetData($InputDistance, "") GUICtrlSetData($InputHeightInU, "") GUICtrlSetData($InputHeightInD, "") GUICtrlSetData($InputUnknown, "") GUICtrlSetData($InputWind, "") GUICtrlSetState($ComboRough, $GUI_ENABLE) GUICtrlSetState($ComboSand, $GUI_ENABLE) GUICtrlSetState($InputHeightInU, $GUI_ENABLE) GUICtrlSetState($InputHeightInD, $GUI_ENABLE) GUICtrlSetState($InputHeightFtU, $GUI_ENABLE) GUICtrlSetState($InputHeightFtD, $GUI_ENABLE) GUICtrlSetState($PHeightFtUInput, $GUI_ENABLE) GUICtrlSetState($PHeightFtDInput, $GUI_ENABLE) GUICtrlSetState($PHeightInUInput, $GUI_ENABLE) GUICtrlSetState($PHeightInDInput, $GUI_ENABLE) ;~ Label Resets GUICtrlSetData($ChipOutLabel, "") GUICtrlSetData($FlopOutLabel, "") GUICtrlSetData($PitchOutLabel, "") GUICtrlSetData($PunchOutLabel, "") GUICtrlSetData($FullOutLabel, "") GUICtrlSetData($PVerySlowOutLabel, "") GUICtrlSetData($PSlowOutLabel, "") GUICtrlSetData($PFastOutLabel, "") GUICtrlSetData($PStandardOutLabel, "") GUICtrlSetData($PT11OutLabel, "") GUICtrlSetData($PVeryFastOutLabel, "") GUICtrlSetData($PT13OutLabel, "") GUICtrlSetData($PT12OutLabel, "") ;~ radio buttResets GUICtrlSetState($RadioAU, $GUI_UNCHECKED) GUICtrlSetState($RadioAD, $GUI_UNCHECKED) GUICtrlSetState($RadioAS, $GUI_UNCHECKED) GUICtrlSetState($RadioACU, $GUI_UNCHECKED) GUICtrlSetState($RadioACD, $GUI_UNCHECKED) ;~ Check to see if an area has been set and disable or enable Case $ComboRough If GUICtrlRead($ComboRough) <> "Fairway" Then GUICtrlSetState($ComboSand, $GUI_DISABLE) ElseIf GUICtrlRead($ComboRough) = "Fairway" Then GUICtrlSetState($ComboSand, $GUI_ENABLE) EndIf Case $ComboSand If GUICtrlRead($ComboSand) <> "None" Then GUICtrlSetState($ComboRough, $GUI_DISABLE) ElseIf GUICtrlRead($ComboSand) = "None" Then GUICtrlSetState($ComboRough, $GUI_ENABLE) EndIf Case $InputHeightFtU If GUICtrlRead($InputHeightFtU) <> 0 Then GUICtrlSetState($InputHeightInU, $GUI_DISABLE) GUICtrlSetState($InputHeightFtD, $GUI_DISABLE) GUICtrlSetState($InputHeightInD, $GUI_DISABLE) ElseIf GUICtrlRead($InputHeightFtU) = 0 Then GUICtrlSetState($InputHeightInU, $GUI_ENABLE) GUICtrlSetState($InputHeightFtD, $GUI_ENABLE) GUICtrlSetState($InputHeightInD, $GUI_ENABLE) EndIf Case $InputHeightFtD If GUICtrlRead($InputHeightFtD) <> 0 Then GUICtrlSetState($InputHeightInU, $GUI_DISABLE) GUICtrlSetState($InputHeightFtU, $GUI_DISABLE) GUICtrlSetState($InputHeightInD, $GUI_DISABLE) ElseIf GUICtrlRead($InputHeightFtD) = 0 Then GUICtrlSetState($InputHeightInU, $GUI_ENABLE) GUICtrlSetState($InputHeightFtU, $GUI_ENABLE) GUICtrlSetState($InputHeightInD, $GUI_ENABLE) EndIf Case $InputHeightInU If GUICtrlRead($InputHeightInU) <> 0 Then GUICtrlSetState($InputHeightFtU, $GUI_DISABLE) GUICtrlSetState($InputHeightFtD, $GUI_DISABLE) GUICtrlSetState($InputHeightInD, $GUI_DISABLE) ElseIf GUICtrlRead($InputHeightInU) = 0 Then GUICtrlSetState($InputHeightFtU, $GUI_ENABLE) GUICtrlSetState($InputHeightFtD, $GUI_ENABLE) GUICtrlSetState($InputHeightInD, $GUI_ENABLE) EndIf Case $InputHeightInD If GUICtrlRead($InputHeightInD) <> 0 Then GUICtrlSetState($InputHeightFtU, $GUI_DISABLE) GUICtrlSetState($InputHeightFtD, $GUI_DISABLE) GUICtrlSetState($InputHeightInU, $GUI_DISABLE) ElseIf GUICtrlRead($InputHeightInD) = 0 Then GUICtrlSetState($InputHeightFtU, $GUI_ENABLE) GUICtrlSetState($InputHeightFtD, $GUI_ENABLE) GUICtrlSetState($InputHeightInU, $GUI_ENABLE) EndIf Case $PHeightInUInput If GUICtrlRead($PHeightInUInput) <> 0 Then GUICtrlSetState($PHeightFtUInput, $GUI_DISABLE) GUICtrlSetState($PHeightFtDInput, $GUI_DISABLE) GUICtrlSetState($PHeightInDInput, $GUI_DISABLE) ElseIf GUICtrlRead($PHeightInUInput) = 0 Then GUICtrlSetState($PHeightFtUInput, $GUI_ENABLE) GUICtrlSetState($PHeightFtDInput, $GUI_ENABLE) GUICtrlSetState($PHeightInDInput, $GUI_ENABLE) EndIf Case $PHeightInDInput If GUICtrlRead($PHeightInDInput) <> 0 Then GUICtrlSetState($PHeightFtUInput, $GUI_DISABLE) GUICtrlSetState($PHeightFtDInput, $GUI_DISABLE) GUICtrlSetState($PHeightInUInput, $GUI_DISABLE) ElseIf GUICtrlRead($PHeightInDInput) = 0 Then GUICtrlSetState($PHeightFtUInput, $GUI_ENABLE) GUICtrlSetState($PHeightFtDInput, $GUI_ENABLE) GUICtrlSetState($PHeightInUInput, $GUI_ENABLE) EndIf Case $PHeightFtUInput If GUICtrlRead($PHeightFtUInput) <> 0 Then GUICtrlSetState($PHeightInUInput, $GUI_DISABLE) GUICtrlSetState($PHeightInDInput, $GUI_DISABLE) GUICtrlSetState($PHeightFtDInput, $GUI_DISABLE) ElseIf GUICtrlRead($PHeightFtUInput) = 0 Then GUICtrlSetState($PHeightInUInput, $GUI_ENABLE) GUICtrlSetState($PHeightInDInput, $GUI_ENABLE) GUICtrlSetState($PHeightFtDInput, $GUI_ENABLE) EndIf Case $PHeightFtDInput If GUICtrlRead($PHeightFtDInput) <> 0 Then GUICtrlSetState($PHeightInUInput, $GUI_DISABLE) GUICtrlSetState($PHeightInDInput, $GUI_DISABLE) GUICtrlSetState($PHeightFtUInput, $GUI_DISABLE) ElseIf GUICtrlRead($PHeightFtDInput) = 0 Then GUICtrlSetState($PHeightInUInput, $GUI_ENABLE) GUICtrlSetState($PHeightInDInput, $GUI_ENABLE) GUICtrlSetState($PHeightFtUInput, $GUI_ENABLE) EndIf Case $CalButton ;~ Call Functions _full() _punch() _Pitch() _flop() _chip() _putt() EndSwitch WEnd ;~ Special Thanks to Melba23 for this peice of script! Removing the ability to anything but numbers and still allow negatives GUIRegisterMsg($WM_COMMAND, "") Func MY_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $Form1 = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord If $iCode = $EN_CHANGE Then Switch $Form1 Case $InputDistance $Read_InputDistance = GUICtrlRead($InputDistance) If StringRegExp($Read_InputDistance, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_InputDistance = StringRegExpReplace($Read_InputDistance, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($InputDistance, $Read_InputDistance) Case $InputHeightFtU $Read_InputHeightFt = GUICtrlRead($InputHeightFtU) If StringRegExp($Read_InputHeightFt, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_InputHeightFt = StringRegExpReplace($Read_InputHeightFt, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($InputHeightFtU, $Read_InputHeightFt) Case $InputHeightFtD $Read_InputHeightFtD = GUICtrlRead($InputHeightFtD) If StringRegExp($Read_InputHeightFtD, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_InputHeightFtD = StringRegExpReplace($Read_InputHeightFtD, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($InputHeightFtD, $Read_InputHeightFtD) Case $InputHeightInU $Read_InputHeightIn = GUICtrlRead($InputHeightInU) If StringRegExp($Read_InputHeightIn, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_InputHeightIn = StringRegExpReplace($Read_InputHeightIn, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($InputHeightInU, $Read_InputHeightIn) Case $InputHeightInD $Read_InputHeightInD = GUICtrlRead($InputHeightInD) If StringRegExp($Read_InputHeightInD, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_InputHeightInD = StringRegExpReplace($Read_InputHeightInD, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($InputHeightInD, $Read_InputHeightInD) Case $InputUnknown $Read_InputUnknown = GUICtrlRead($InputUnknown) If StringRegExp($Read_InputUnknown, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_InputUnknown = StringRegExpReplace($Read_InputUnknown, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($InputUnknown, $Read_InputUnknown) Case $InputWind $Read_InputWind = GUICtrlRead($InputWind) If StringRegExp($Read_InputWind, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_InputWind = StringRegExpReplace($Read_InputWind, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($InputWind, $Read_InputWind) Case $PDistanceInput $Read_PDistanceInput = GUICtrlRead($PDistanceInput) If StringRegExp($Read_PDistanceInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_PDistanceInput = StringRegExpReplace($Read_PDistanceInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($PDistanceInput, $Read_PDistanceInput) Case $PHeightFtUInput $Read_PHeightFtInput = GUICtrlRead($PHeightFtUInput) If StringRegExp($Read_PHeightFtInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_PHeightFtInput = StringRegExpReplace($Read_PHeightFtInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($PHeightFtUInput, $Read_PHeightFtInput) Case $PHeightFtDInput $Read_PHeightFtDInput = GUICtrlRead($PHeightFtDInput) If StringRegExp($Read_PHeightFtDInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_PHeightFtDInput = StringRegExpReplace($Read_PHeightFtDInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($PHeightFtDInput, $Read_PHeightFtDInput) Case $PHeightInUInput $Read_PHeightInInput = GUICtrlRead($PHeightInUInput) If StringRegExp($Read_PHeightInInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_PHeightInInput = StringRegExpReplace($Read_PHeightInInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($PHeightInUInput, $Read_PHeightInInput) Case $PHeightInDInput $Read_PHeightInDInput = GUICtrlRead($PHeightInDInput) If StringRegExp($Read_PHeightInDInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_PHeightInDInput = StringRegExpReplace($Read_PHeightInDInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($PHeightInDInput, $Read_PHeightInDInput) Case $PUnknownInput $Read_PUnknownInput = GUICtrlRead($PUnknownInput) If StringRegExp($Read_PUnknownInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]') Then $Read_PUnknownInput = StringRegExpReplace($Read_PUnknownInput, '[^\d.-]|([{0-9,1}^\A-])[^\d.]', '\1') GUICtrlSetData($PUnknownInput, $Read_PUnknownInput) EndSwitch EndIf EndFunc ;==>MY_WM_COMMAND ; Full Shot Calculations Func _full() Local $Df = GUICtrlRead($InputDistance) Local $Wf = GUICtrlRead($InputWind) Local $HFUf = GUICtrlRead($InputHeightFtU) / 2 Local $HFDf = GUICtrlRead($InputHeightFtD) / 3 * -1 Local $HIUf = GUICtrlRead($InputHeightInU) / 12 Local $HIDf = GUICtrlRead($InputHeightInD) / 12 * -1 Local $Rf = GUICtrlRead($ComboRough) Local $Sf = GUICtrlRead($ComboSand) Local $Uf = GUICtrlRead($InputUnknown) Local $Wdf = 0 ;~ Get Wind If GUICtrlRead($RadioAU) = $GUI_CHECKED Then $Wdf = $Wf / 2 * -1 If GUICtrlRead($RadioAD) = $GUI_CHECKED Then $Wdf = $Wf / 2 If GUICtrlRead($RadioAS) = $GUI_CHECKED Then $Wdf = 0 If GUICtrlRead($RadioACU) = $GUI_CHECKED Then $Wdf = $Wf / 3 * -1 If GUICtrlRead($RadioACD) = $GUI_CHECKED Then $Wdf = $Wf / 3 ;~ If for rough If $Rf = "Fairway" Then $Rf = 0 If $Rf = "10-20%" Then $Rf = 2 If $Rf = "20-25%" Then $Rf = 5 If $Rf = "30-40%" Then $Rf = 10 If $Rf = "40-50%" Then $Rf = 20 If $Rf = "50-60%" Then $Rf = 60 If $Rf = "60-70%" Then $Rf = 70 If $Rf = "70-80%" Then $Rf = 80 ;~ If for Sand If $Sf = "None" Then $Sf = 0 If $Sf = "10-20%" Then $Sf = 5 If $Sf = "20-25%" Then $Sf = 10 If $Sf = "30-40%" Then $Sf = 16 If $Sf = "40-50%" Then $Sf = 25 If $Sf = "50-60%" Then $Sf = 35 If $Sf = "60-70%" Then $Sf = 50 If $Sf = "70-80%" Then $Sf = 80 If $Sf > 0 Then $Cal_Full = Round($Df + $HFUf + $HFDf + $HIUf + $HIDf + $Uf + $Wdf + $Sf, 1) $Cal_FullOutLabel = $Cal_Full GUICtrlSetData($FullOutLabel, $Cal_FullOutLabel) GUISetState() Else $Cal_Full = Round($Df + $HFUf + $HFDf + $HIUf + $HIDf + $Uf + +$Wdf + $Rf, 1) $Cal_FullOutLabel = $Cal_Full ConsoleWrite($Df & @CRLF) ConsoleWrite($HFUf & @CRLF) ConsoleWrite($HFDf & @CRLF) ConsoleWrite($HIUf & @CRLF) ConsoleWrite($HIDf & @CRLF) ConsoleWrite($Uf & @CRLF) ConsoleWrite($Rf) GUICtrlSetData($FullOutLabel, $Cal_FullOutLabel) GUISetState() EndIf EndFunc ;==>_full ;Punch Shot Calculations Func _punch() Local $Dp = GUICtrlRead($InputDistance) Local $Wp = GUICtrlRead($InputWind) Local $HFUp = GUICtrlRead($InputHeightFtU) / 2 Local $HFDp = GUICtrlRead($InputHeightFtD) / 3 * -1 Local $HIUp = GUICtrlRead($InputHeightInU) / 12 Local $HIDp = GUICtrlRead($InputHeightInD) / 12 * -1 Local $Rp = GUICtrlRead($ComboRough) Local $Sp = GUICtrlRead($ComboSand) Local $Up = GUICtrlRead($InputUnknown) Local $Wdpf = 0 Local $Wdps = 0 Local $Rpf = 0 Local $Rps = 0 Local $Spf = 0 Local $Sps = 0 ;~ Get Wind Standard Shot If GUICtrlRead($RadioAU) = $GUI_CHECKED Then $Wdpf = $Wp / 2 * -1 If GUICtrlRead($RadioAD) = $GUI_CHECKED Then $Wdpf = $Wp / 2 If GUICtrlRead($RadioAS) = $GUI_CHECKED Then $Wdpf = 0 If GUICtrlRead($RadioACU) = $GUI_CHECKED Then $Wdpf = $Wp / 3 * -1 If GUICtrlRead($RadioACD) = $GUI_CHECKED Then $Wdpf = $Wp / 3 ;~ Get Wind Short Shots If GUICtrlRead($RadioAU) = $GUI_CHECKED Then $Wdps = $Wp / 12 * -1 If GUICtrlRead($RadioAD) = $GUI_CHECKED Then $Wdps = $Wp / 12 If GUICtrlRead($RadioAS) = $GUI_CHECKED Then $Wdps = 0 If GUICtrlRead($RadioACU) = $GUI_CHECKED Then $Wdps = $Wp / 12 * -1 If GUICtrlRead($RadioACD) = $GUI_CHECKED Then $Wdps = $Wp / 12 ;~ If for rough Standard Shot If $Rp = "Fairway" Then $Rpf = 0 If $Rp = "10-20%" Then $Rpf = 2 If $Rp = "20-25%" Then $Rpf = 5 If $Rp = "30-40%" Then $Rpf = 10 If $Rp = "40-50%" Then $Rpf = 20 If $Rp = "50-60%" Then $Rpf = 60 If $Rp = "60-70%" Then $Rpf = 70 If $Rp = "70-80%" Then $Rpf = 80 ;~ If for rough Short Shot If $Rp = "Fairway" Then $Rps = 0 If $Rp = "10-20%" Then $Rps = 2 If $Rp = "20-25%" Then $Rps = 3 If $Rp = "30-40%" Then $Rps = 4 If $Rp = "40-50%" Then $Rps = 5 If $Rp = "50-60%" Then $Rps = 6 If $Rp = "60-70%" Then $Rps = 7 If $Rp = "70-80%" Then $Rps = 8 ;~ If for Sand Standard Shot If $Sp = "None" Then $Spf = 0 If $Sp = "10-20%" Then $Spf = 4 If $Sp = "20-25%" Then $Spf = 6 If $Sp = "30-40%" Then $Spf = 10 If $Sp = "40-50%" Then $Spf = 20 If $Sp = "50-60%" Then $Spf = 30 If $Sp = "60-70%" Then $Spf = 40 If $Sp = "70-80%" Then $Spf = 60 ;~ If for Sand Short Shot If $Sp = "None" Then $Sps = 0 If $Sp = "10-20%" Then $Sps = 4 If $Sp = "20-25%" Then $Sps = 5 If $Sp = "30-40%" Then $Sps = 8 If $Sp = "40-50%" Then $Sps = 10 If $Sp = "50-60%" Then $Sps = 12 If $Sp = "60-70%" Then $Sps = 14 If $Sp = "70-80%" Then $Sps = 16 ;~ Formula If $Dp > 100 Then $Cal_Punch = Round($Dp + $HFUp + $HFDp + $HIUp + $HIDp + $Up + $Spf + $Rpf + $Wdpf, 1) $Cal_PunchOutLabel = $Cal_Punch GUICtrlSetData($PunchOutLabel, $Cal_PunchOutLabel) GUISetState() Else $Cal_Punch = Round($Dp + $HFUp + $HFDp + $HIUp + $HIDp + $Up + $Sps + $Rps + $Wdps, 1) $Cal_PunchOutLabel = $Cal_Punch GUICtrlSetData($PunchOutLabel, $Cal_PunchOutLabel) GUISetState() EndIf EndFunc ;==>_punch ; Pitch Shot Calculations Func _Pitch() Local $Dpi = GUICtrlRead($InputDistance) Local $Wpi = GUICtrlRead($InputWind) Local $HFUpi = GUICtrlRead($InputHeightFtU) / 2 Local $HFDpi = GUICtrlRead($InputHeightFtD) / 3 * -1 Local $HIUpi = GUICtrlRead($InputHeightInU) / 12 Local $HIDpi = GUICtrlRead($InputHeightInD) / 12 * -1 Local $Spi = GUICtrlRead($ComboSand) Local $Upi = GUICtrlRead($InputUnknown) Local $Wdpi = 0 ;~ If for Sand If $Spi = "None" Then $Spi = 0 If $Spi = "10-20%" Then $Spi = 2 If $Spi = "20-25%" Then $Spi = 4 If $Spi = "30-40%" Then $Spi = 8 If $Spi = "40-50%" Then $Spi = 10 If $Spi = "50-60%" Then $Spi = 12 If $Spi = "60-70%" Then $Spi = 14 If $Spi = "70-80%" Then $Spi = 16 ;~ Get Wind If GUICtrlRead($RadioAU) = $GUI_CHECKED Then $Wdpi = $Wpi / 12 * -1 If GUICtrlRead($RadioAD) = $GUI_CHECKED Then $Wdpi = $Wpi / 12 If GUICtrlRead($RadioAS) = $GUI_CHECKED Then $Wdpi = 0 If GUICtrlRead($RadioACU) = $GUI_CHECKED Then $Wdpi = $Wpi / 12 * -1 If GUICtrlRead($RadioACD) = $GUI_CHECKED Then $Wdpi = $Wpi / 12 If $Dpi > 30 Then $Cal_PitchOutLabel = "" GUICtrlSetData($PitchOutLabel, $Cal_PitchOutLabel) GUISetState() EndIf If $Dpi <= 30 Then $Cal_Pitch = Round($Dpi + $Wdpi + $HFUpi + $HFDpi + $HIUpi + $HIDpi + $Spi + $Upi) $Cal_PitchOutLabel = $Cal_Pitch GUICtrlSetData($PitchOutLabel, $Cal_PitchOutLabel) EndIf EndFunc ;==>_Pitch ; Flop Shot Calculations Func _flop() Local $Dfl = GUICtrlRead($InputDistance) Local $Wfl = GUICtrlRead($InputWind) Local $HFUfl = GUICtrlRead($InputHeightFtU) / 3 Local $HFDfl = GUICtrlRead($InputHeightFtD) / 3 * -1 Local $Rfl = GUICtrlRead($ComboRough) Local $Sfl = GUICtrlRead($ComboSand) Local $Ufl = GUICtrlRead($InputUnknown) Local $Wdfl = 0 ;~ Get Wind If GUICtrlRead($RadioAU) = $GUI_CHECKED Then $Wdfl = $Wfl / 12 * -1 If GUICtrlRead($RadioAD) = $GUI_CHECKED Then $Wdfl = $Wfl / 12 If GUICtrlRead($RadioAS) = $GUI_CHECKED Then $Wdfl = 0 If GUICtrlRead($RadioACU) = $GUI_CHECKED Then $Wdfl = $Wfl / 12 * -1 If GUICtrlRead($RadioACD) = $GUI_CHECKED Then $Wdfl = $Wfl / 12 ;~ If for Rough If $Rfl = "Fairway" Then $Rfl = 0 If $Rfl = "10-20%" Then $Rfl = 1 If $Rfl = "20-25%" Then $Rfl = 2 If $Rfl = "30-40%" Then $Rfl = 4 If $Rfl = "40-50%" Then $Rfl = 5 If $Rfl = "50-60%" Then $Rfl = 6 If $Rfl = "60-70%" Then $Rfl = 7 If $Rfl = "70-80%" Then $Rfl = 8 ;~ If for Sand If $Sfl = "None" Then $Sfl = 0 If $Sfl = "10-20%" Then $Sfl = 1 If $Sfl = "20-25%" Then $Sfl = 2 If $Sfl = "30-40%" Then $Sfl = 4 If $Sfl = "40-50%" Then $Sfl = 5 If $Sfl = "50-60%" Then $Sfl = 6 If $Sfl = "60-70%" Then $Sfl = 7 If $Sfl = "70-80%" Then $Sfl = 8 If $Dfl > 30 Then $Cal_FlopOutLabel = "" GUICtrlSetData($FlopOutLabel, $Cal_FlopOutLabel) GUISetState() EndIf If $Sfl > 4 Then $Cal_FlopOutLabel = "" GUICtrlSetData($FlopOutLabel, $Cal_FlopOutLabel) GUISetState() EndIf If $Dfl <= 30 Then $Cal_Flop = Round($Dfl + $Wdfl + $HFUfl + $HFDfl + $Sfl + $Rfl + $Ufl, 1) $Cal_FlopOutLabel = $Cal_Flop GUICtrlSetData($FlopOutLabel, $Cal_FlopOutLabel) EndIf EndFunc ;==>_flop ; Chip Shot Calculations Func _chip() Local $Dc = GUICtrlRead($InputDistance) Local $Wc = GUICtrlRead($InputWind) Local $HFUc = GUICtrlRead($InputHeightFtU) / 3 Local $HFDc = GUICtrlRead($InputHeightFtD) / 3 * -1 Local $HIUc = GUICtrlRead($InputHeightFtU) / 3 Local $HIDc = GUICtrlRead($InputHeightFtD) / 3 * -1 Local $Rc = GUICtrlRead($ComboRough) Local $Sc = GUICtrlRead($ComboSand) Local $Uc = GUICtrlRead($InputUnknown) Local $Wdc = 0 ;~ Get Wind If GUICtrlRead($RadioAU) = $GUI_CHECKED Then $Wdc = $Wc / 12 * -1 If GUICtrlRead($RadioAD) = $GUI_CHECKED Then $Wdc = $Wc / 12 If GUICtrlRead($RadioAS) = $GUI_CHECKED Then $Wdc = 0 If GUICtrlRead($RadioACU) = $GUI_CHECKED Then $Wdc = $Wc / 12 * -1 If GUICtrlRead($RadioACD) = $GUI_CHECKED Then $Wdc = $Wc / 12 ;~ If for rough ignore it If $Rc = "Fairway" Then $Rc = 0 If $Rc = "5-10%" Then $Rc = 0 If $Rc = "10-20%" Then $Rc = 0 If $Rc = "20-30%" Then $Rc = 0 If $Rc = "30-40%" Then $Rc = 0 If $Rc = "40-50%" Then $Rc = 0 If $Rc = "50-60%" Then $Rc = 0 If $Rc = "70-80%" Then $Rc = 0 ;~ If for Sand If $Sc = "None" Then $Sc = 0 If $Sc = "5-10%" Then $Sc = 0 If $Sc = "10-20%" Then $Sc = 0 If $Sc = "20-30%" Then $Sc = 0 If $Sc = "30-40%" Then $Sc = 0 If $Sc = "40-50%" Then $Sc = 0 If $Sc = "50-60%" Then $Sc = 0 If $Sc = "70-80%" Then $Sc = 0 If $Dc > 10 Then $Cal_ChipOutLabel = "" GUICtrlSetData($ChipOutLabel, $Cal_ChipOutLabel) GUISetState() EndIf If $Dc <= 10 Then $Cal_Chip = Round($Dc + $Wdc + $HFUc + $HFDc + $HIUc + $HIDc + $Uc, 1) $Cal_ChipOutLabel = $Cal_Chip GUICtrlSetData($ChipOutLabel, $Cal_ChipOutLabel) GUISetState() EndIf If $Sc > 0 Then $Cal_ChipOutLabel = "" GUICtrlSetData($ChipOutLabel, $Cal_ChipOutLabel) GUISetState() EndIf EndFunc ;==>_chip ; Putting calculations Func _putt() Local $PD = GUICtrlRead($PDistanceInput) Local $PHFU = GUICtrlRead($PHeightFtUInput) * 12 Local $PHFD = GUICtrlRead($PHeightFtDInput) * 12 * -1 Local $PHIU = GUICtrlRead($PHeightInUInput) Local $PHID = GUICtrlRead($PHeightInDInput) * -1 Local $PU = GUICtrlRead($PUnknownInput) $Cal_PVerySlow = Round(($PD * .15) + $PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PVerySlowOutLabel = $Cal_PVerySlow GUICtrlSetData($PVerySlowOutLabel, $Cal_PVerySlowOutLabel) GUISetState() $Cal_PSlow = Round(($PD * .1) + $PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PSlowOutLabel = $Cal_PSlow GUICtrlSetData($PSlowOutLabel, $Cal_PSlowOutLabel) GUISetState() $Cal_PStandard = Round($PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PStandardOutLabel = $Cal_PStandard GUICtrlSetData($PStandardOutLabel, $Cal_PStandardOutLabel) GUISetState() $Cal_PFast = Round(($PD * -.1) + $PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PFastOutLabel = $Cal_PFast GUICtrlSetData($PFastOutLabel, $Cal_PFastOutLabel) GUISetState() $Cal_PVeryFast = Round(($PD * -.2) + $PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PVeryFastOutLabel = $Cal_PVeryFast GUICtrlSetData($PVeryFastOutLabel, $Cal_PVeryFastOutLabel) GUISetState() $Cal_PT11 = Round(($PD * -.3) + $PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PT11OutLabel = $Cal_PT11 GUICtrlSetData($PT11OutLabel, $Cal_PT11OutLabel) GUISetState() $Cal_PT12 = Round(($PD * -.35) + $PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PT12OutLabel = $Cal_PT12 GUICtrlSetData($PT12OutLabel, $Cal_PT12OutLabel) GUISetState() $Cal_PT13 = Round(($PD * -.4) + $PD + $PHFU + $PHFD + $PHIU + $PHID + $PU, 1) $Cal_PT13OutLabel = $Cal_PT13 GUICtrlSetData($PT13OutLabel, $Cal_PT13OutLabel) GUISetState() EndFunc ;==>_putt I will be very thankful if you can assist me with this. I'm also having issue's with using @ScriptDir, and @WorkingDir, and I'm not sure why. If I use those in the file path the images will not display, so I have to use the entire directory listing. Thank you! Syx1 point
-
http://www.nirsoft.net/utils/rtmp_dump_helper.html What are you looking to do differently than the helper does?1 point
-
years ago when i was downloading all the austin city limits streams off of PBS I had to resort to rtmpdump. Then just play it local.1 point
-
Hi. Just for fun. #include <WinAPIFiles.au3> #include <WinAPI.au3> #include <Memory.au3> Global Const $sTag_STORAGE_DEVICE_NUMBER = "dword DeviceType;dword DeviceNumber;int PartitionNumber" Local $sMainDisk=@HomeDrive Local $sPartition="D:" Local $DiskNumber1 = _GetDiskNumber($sMainDisk) Local $DiskNumber2 = _GetDiskNumber($sPartition) If $DiskNumber1 And $DiskNumber2 Then If $DiskNumber1=$DiskNumber2 Then ConsoleWrite("Current system HD(" & $sMainDisk & ") contains a partition " & $sPartition & @CRLF) ;~ do something EndIf Else ;~ do something EndIf Func _GetDiskNumber($sDrive) Local $hDevice = _WinAPI_CreateFile("\\.\" & $sDrive, $FILE_SHARE_READ, 0) Local $tStorageDevNumber = DllStructCreate($sTag_STORAGE_DEVICE_NUMBER) Local $bRet = _WinAPI_DeviceIoControl($hDevice, $IOCTL_STORAGE_GET_DEVICE_NUMBER, 0, 0, $tStorageDevNumber, DllStructGetSize($tStorageDevNumber)) _WinAPI_CloseHandle($hDevice) If Not $bRet Then Return 0 If DllStructGetData($tStorageDevNumber, "DeviceType") = $FILE_DEVICE_DISK Then; FILE_DEVICE_DISK Return SetError(0, 0, DllStructGetData($tStorageDevNumber, "DeviceNumber")+1) EndIf Return 0 EndFunc ;==>_GetDiskNumber Saludos1 point
-
Need a sample of how to find a picture and add a hypelink in a Word document.
Messy_Code_Guy reacted to water for a topic
If it doesn't work please post a small sample document (with all sensitive information removed) so i have something to play with.1 point -
How to Create 'Password Protected Icon or Exe'
ChaitanyaK reacted to JohnOne for a topic
InputBox ask for password exit if wrong That seem too simple? Perhaps you're trying to ask a different question.1 point -
Print table from script using internet browser
Skysnake reacted to JanZoudlik for a topic
Hello everyone, here is my little contribution to AutoIt community. I was looking for a way to print tables from my scripts. None of the solutions was exactly working for me as there were always some limitations. If you need to be able to print table, while making sure that header is printed on each page (if large table), rows won't split up(across several pages) and you want to be able to adjust table size on page or each column size, you in the right place. Also you can choose between landscape and portrait mode It uses a browser to print table out. Simply, it generates a html file which is then open within browser and it initialize print. This version is tested with Chrome browser... Please be aware that there is a bug. When you try to disable row numbers, it will also remove table borders(lines). If anybody can figure out why, it would be appreciated by me and I am sure by others as well. Enjoy Jan UPDATE: found today that geniuses from Google stopped following standards and it no longer prints correctly with Chrome. It also ignores the portrait/landscape settings. However, I tested it with latest IE on Win 7 and it works fine!!! so I suggest you use IE to print... In case you don't have IE as main browser and you do have issues with your current browser then replace shellexecute and winwaitactive at the end of function with: local $hIE=run('"C:\Program Files\Internet Explorer\iexplore.exe" "' & $sFile & '"') ProcessWait($hIE) ; AutoIt Version: 3.3.10 ; Language: English ; Platform: Win ; Author: Jan Zoudlik ; NOTE: big thanks to DoctorDestructo from http://stackoverflow.com/ for main script with css styling etc ; and guinness, tproli, Lupo73 from https://www.autoitscript.com/forum/ for inspiration with their listview to html function ; Script Function: ; table print - example + _table_print function #include <File.au3> Local $aTestArray[4][4] = [[20, 50, 20, 7], ["head", "heading<br/>accross two lines", "heading", "X"],["data row 1",5,"data",6],["data row 2",5&"<br/>"&6,"data",6]] _table_print("test title",100,$aTestArray,True) Func _table_print($Title,$Table_Size,ByRef $2D_array, $Landscape=True, $Row_Numbers=True) ;table that will print as table should (tested with chrome and ie browsers)> header on each page, table cell won't be printed across two pages > so even multi line row will always stay on one page or will be as whole pushed to next page ;to break the line within the cell or heading use "<br/>" not @LF or @CRLF as it is html... if word within cell is wider then column width it will adjust columnm width so word will fit, it will auto(line)break sentance if wider than column ;the allingment withing table is : vertical middle - horizontal left(header is vertical down - horizontal middle) and row numbers are vertical middle - horizontal right... sufficient for me... ;file name automatically generated and saved in temp folder ;Title - self explaining - displayed on the top of the table on first page only ;Table_Size - in percent - how big table(width) should be compare to the paper size so 100 - table will spread accross whole paper printable area, 50 - table size will be approx half of the paper size ;2D_array - row 0, number in percent per each column (width of column) - all together it should add up 100%(97% if row_numbers are used as 3% is used as size for row count column) ;2D_array - row 1, column header - will repeat on each page ;2D_array - row 2-n, data ;$Row_Numbers - first column will contain row number(so there will be one extra column in table) ;$Landscape - to print in landscape or portrait mode... ;paper size is as per printer settings ;font size is set to 10; if adjustment needed for blind people, then search for font-size: 10px; and don't forget to also adjust line-height: 13px accordingly(so it is bigger than font) ;_table_print function CREATED BY Jan Zoudlik ;big thanks to DoctorDestructo from http://stackoverflow.com/ for main script with css styling etc and guinness, tproli, Lupo73 from https://www.autoitscript.com/forum/ for inspiration with their listview to html function $sHTMLTable='<!DOCTYPE html>' & @CRLF & _ '<html>' & @CRLF & _ ' <body>' & @CRLF & _ ' <table ' if $Row_Numbers then $sHTMLTable=$sHTMLTable & 'class="print t1" ' $sHTMLTable=$sHTMLTable & 'width="' & $Table_Size & '%"> <!-- Delete "t1" class to remove row numbers. -->' & @CRLF & _ ' <caption>' & $Title & '</caption>' & @CRLF if $Row_Numbers then $sHTMLTable=$sHTMLTable & ' <col width="3%">' & @CRLF for $column=0 to ubound($2D_array,2)-1 $sHTMLTable=$sHTMLTable & ' <col width="' & $2D_array[0][$column] & '%">' & @CRLF Next $sHTMLTable=$sHTMLTable & ' <thead>' & @CRLF & _ ' <tr>' & @CRLF if $Row_Numbers then $sHTMLTable=$sHTMLTable & ' <th>#</th>' & @CRLF for $column=0 to ubound($2D_array,2)-1 $sHTMLTable=$sHTMLTable & ' <th>' & $2D_array[1][$column] & '</th>' & @CRLF Next $sHTMLTable=$sHTMLTable & ' </tr>' & @CRLF & _ ' </thead>' & @CRLF & _ ' <tbody>' & @CRLF for $row=2 to ubound($2D_array)-1 $sHTMLTable=$sHTMLTable & ' <tr>' & @CRLF if $Row_Numbers then $sHTMLTable=$sHTMLTable & ' <td></td>' & @CRLF for $column=0 to ubound($2D_array,2)-1 $sHTMLTable=$sHTMLTable & ' <td>' & $2D_array[$row][$column] & '</td>' & @CRLF Next $sHTMLTable=$sHTMLTable & ' </tr>' & @CRLF Next $sHTMLTable=$sHTMLTable & ' </tbody>' & @CRLF & _ ' </table>' & @CRLF & _ ' </body>' & @CRLF & _ '</html>' & @CRLF $sCSSstyle='<style>' & @CRLF & _ ' /* THE FOLLOWING CSS IS REQUIRED AND SHOULD NOT BE MODIFIED. */' & @CRLF & _ ' div.fauxRow {' & @CRLF & _ ' display: inline-block;' & @CRLF & _ ' vertical-align: top;' & @CRLF & _ ' width: 100%;' & @CRLF & _ ' page-break-inside: avoid;' & @CRLF & _ ' }' & @CRLF & _ ' table.fauxRow {border-spacing: 0;}' & @CRLF & _ ' table.fauxRow > tbody > tr > td {' & @CRLF & _ ' padding: 0;' & @CRLF & _ ' overflow: hidden;' & @CRLF & _ ' }' & @CRLF & _ ' table.fauxRow > tbody > tr > td > table.print {' & @CRLF & _ ' display: inline-table;' & @CRLF & _ ' vertical-align: top;' & @CRLF & _ ' }' & @CRLF & _ ' table.fauxRow > tbody > tr > td > table.print > caption {caption-side: top;}' & @CRLF & _ ' .noBreak {' & @CRLF & _ ' float: right;' & @CRLF & _ ' width: 100%;' & @CRLF & _ ' visibility: hidden;' & @CRLF & _ ' }' & @CRLF & _ ' .noBreak:before, .noBreak:after {' & @CRLF & _ ' display: block;' & @CRLF & _ ' content: "";' & @CRLF & _ ' }' & @CRLF & _ ' .noBreak:after {margin-top: -594mm;}' & @CRLF & _ ' .noBreak > div {' & @CRLF & _ ' display: inline-block;' & @CRLF & _ ' vertical-align: top;' & @CRLF & _ ' width:100%;' & @CRLF & _ ' page-break-inside: avoid;' & @CRLF & _ ' }' & @CRLF & _ ' /*table.print > thead {white-space: nowrap;}*/ /* Uncomment if line-wrapping causes problems. */' & @CRLF & _ ' table.print > tbody > tr {page-break-inside: avoid;}' & @CRLF & _ ' table.print > tbody > .metricsRow > td {border-top: none !important;}' & @CRLF & _ '' & @CRLF & _ ' /* THE FOLLOWING CSS IS REQUIRED, but the values may be adjusted. */' & @CRLF & _ ' /* NOTE: All size values that can affect an elements height should use the px unit! */' & @CRLF & _ ' table.fauxRow, table.print {' & @CRLF & _ ' font-size: 10px;' & @CRLF & _ ' line-height: 13px;' & @CRLF & _ ' }' & @CRLF & _ '' & @CRLF & _ ' /* THE FOLLvOWING CSS IS OPTIONAL. */' & @CRLF if $Landscape then $sCSSstyle=$sCSSstyle & ' @page {size: landscape;} /* Delete to print in portrait mode*/' & @CRLF if $Row_Numbers then $sCSSstyle=$sCSSstyle & ' body {counter-reset: t1;} /* Delete to remove row numbers. */' & @CRLF & _ ' .noBreak .t1 > tbody > tr > :first-child:before {counter-increment: none;} /* Delete to remove row numbers. */' & @CRLF & _ ' .t1 > tbody > tr > :first-child:before { /* Delete to remove row numbers. */' & @CRLF & _ ' display: block;' & @CRLF & _ ' text-align: right;' & @CRLF & _ ' counter-increment: t1 1;' & @CRLF & _ ' content: counter(t1);' & @CRLF & _ ' }' & @CRLF $sCSSstyle=$sCSSstyle & ' table.fauxRow, table.print {' & @CRLF & _ ' font-family: Tahoma, Verdana, Georgia; /* Try to use fonts that dont get bigger when printed. */' & @CRLF & _ ' margin: 0 auto 0 auto; /* Delete if you dont want table to be centered. */' & @CRLF & _ ' }' & @CRLF & _ ' table.print {border-spacing: 0;}' & @CRLF & _ ' table.print > * > tr > * {' & @CRLF & _ ' border-right: 1px solid black;' & @CRLF & _ ' border-bottom: 1px solid black;' & @CRLF & _ ' padding: 0 3px 0 3px;' & @CRLF & _ ' }' & @CRLF & _ ' table.print > * > :first-child > * {border-top: 1px solid black;}' & @CRLF & _ ' table.print > thead ~ * > :first-child > *, table.print > tbody ~ * > :first-child > * {border-top: none;} ' & @CRLF & _ ' table.print > * > tr > :first-child {border-left: 1px solid black;}' & @CRLF & _ ' table.print > thead {vertical-align: bottom;}' & @CRLF & _ ' table.print > thead > .borderRow > th {border-bottom: none;}' & @CRLF & _ ' table.print > tbody {vertical-align:middle;}' & @CRLF & _ ' table.print > caption {font-weight: bold;}' & @CRLF & _ '</style>' & @CRLF & _ '' & @CRLF & _ '<script>' & @CRLF & _ '' & @CRLF & _ ' (function() { // THIS FUNCTION IS REQUIRED.' & @CRLF & _ ' if(/Firefox|MSIE |Trident/i.test(navigator.userAgent))' & @CRLF & _ ' var formatForPrint = function(table) {' & @CRLF & _ ' var noBreak = document.createElement("div")' & @CRLF & _ ' , noBreakTable = noBreak.appendChild(document.createElement("div")).appendChild(table.cloneNode())' & @CRLF & _ ' , tableParent = table.parentNode' & @CRLF & _ ' , tableParts = table.children' & @CRLF & _ ' , partCount = tableParts.length' & @CRLF & _ ' , partNum = 0' & @CRLF & _ ' , cell = table.querySelector("tbody > tr > td");' & @CRLF & _ ' noBreak.className = "noBreak";' & @CRLF & _ ' for(; partNum < partCount; partNum++) {' & @CRLF & _ ' if(!/tbody/i.test(tableParts[partNum].tagName))' & @CRLF & _ ' noBreakTable.appendChild(tableParts[partNum].cloneNode(true));' & @CRLF & _ ' }' & @CRLF & _ ' if(cell) {' & @CRLF & _ ' noBreakTable.appendChild(cell.parentNode.parentNode.cloneNode()).appendChild(cell.parentNode.cloneNode(true));' & @CRLF & _ ' if(!table.tHead) {' & @CRLF & _ ' var borderRow = document.createElement("tr");' & @CRLF & _ ' borderRow.appendChild(document.createElement("th")).colSpan="1000";' & @CRLF & _ ' borderRow.className = "borderRow";' & @CRLF & _ ' table.insertBefore(document.createElement("thead"), table.tBodies[0]).appendChild(borderRow);' & @CRLF & _ ' }' & @CRLF & _ ' }' & @CRLF & _ ' tableParent.insertBefore(document.createElement("div"), table).style.paddingTop = ".009px";' & @CRLF & _ ' tableParent.insertBefore(noBreak, table);' & @CRLF & _ ' };' & @CRLF & _ ' else' & @CRLF & _ ' var formatForPrint = function(table) {' & @CRLF & _ ' var tableParent = table.parentNode' & @CRLF & _ ' , cell = table.querySelector("tbody > tr > td");' & @CRLF & _ ' if(cell) {' & @CRLF & _ ' var topFauxRow = document.createElement("table")' & @CRLF & _ ' , fauxRowTable = topFauxRow.insertRow(0).insertCell(0).appendChild(table.cloneNode())' & @CRLF & _ ' , colgroup = fauxRowTable.appendChild(document.createElement("colgroup"))' & @CRLF & _ ' , headerHider = document.createElement("div")' & @CRLF & _ ' , metricsRow = document.createElement("tr")' & @CRLF & _ ' , cells = cell.parentNode.cells' & @CRLF & _ ' , cellNum = cells.length' & @CRLF & _ ' , colCount = 0' & @CRLF & _ ' , tbods = table.tBodies' & @CRLF & _ ' , tbodCount = tbods.length' & @CRLF & _ ' , tbodNum = 0' & @CRLF & _ ' , tbod = tbods[0];' & @CRLF & _ ' for(; cellNum--; colCount += cells[cellNum].colSpan);' & @CRLF & _ ' for(cellNum = colCount; cellNum--; metricsRow.appendChild(document.createElement("td")).style.padding = 0);' & @CRLF & _ ' cells = metricsRow.cells;' & @CRLF & _ ' tbod.insertBefore(metricsRow, tbod.firstChild);' & @CRLF & _ ' for(; ++cellNum < colCount; colgroup.appendChild(document.createElement("col")).style.width = cells[cellNum].offsetWidth + "px");' & @CRLF & _ ' var borderWidth = metricsRow.offsetHeight;' & @CRLF & _ ' metricsRow.className = "metricsRow";' & @CRLF & _ ' borderWidth -= metricsRow.offsetHeight;' & @CRLF & _ ' tbod.removeChild(metricsRow);' & @CRLF & _ ' tableParent.insertBefore(topFauxRow, table).className = "fauxRow";' & @CRLF & _ ' if(table.tHead)' & @CRLF & _ ' fauxRowTable.appendChild(table.tHead);' & @CRLF & _ ' var fauxRow = topFauxRow.cloneNode(true)' & @CRLF & _ ' , fauxRowCell = fauxRow.rows[0].cells[0];' & @CRLF & _ ' fauxRowCell.insertBefore(headerHider, fauxRowCell.firstChild).style.marginBottom = -fauxRowTable.offsetHeight - borderWidth + "px";' & @CRLF & _ ' if(table.caption)' & @CRLF & _ ' fauxRowTable.insertBefore(table.caption, fauxRowTable.firstChild);' & @CRLF & _ ' if(tbod.rows[0])' & @CRLF & _ ' fauxRowTable.appendChild(tbod.cloneNode()).appendChild(tbod.rows[0]);' & @CRLF & _ ' for(; tbodNum < tbodCount; tbodNum++) {' & @CRLF & _ ' tbod = tbods[tbodNum];' & @CRLF & _ ' rows = tbod.rows;' & @CRLF & _ ' for(; rows[0]; tableParent.insertBefore(fauxRow.cloneNode(true), table).rows[0].cells[0].children[1].appendChild(tbod.cloneNode()).appendChild(rows[0]));' & @CRLF & _ ' }' & @CRLF & _ ' tableParent.removeChild(table);' & @CRLF & _ ' }' & @CRLF & _ ' else' & @CRLF & _ ' tableParent.insertBefore(document.createElement("div"), table).appendChild(table).parentNode.className="fauxRow";' & @CRLF & _ ' };' & @CRLF & _ ' var tables = document.body.querySelectorAll("table.print")' & @CRLF & _ ' , tableNum = tables.length;' & @CRLF & _ ' for(; tableNum--; formatForPrint(tables[tableNum]));' & @CRLF & _ ' })();' & @CRLF & _ '</script>' $sFile=_TempFile ( @TempDir , "~", ".html" ) ;~ $sFile= @ScriptDir & "\Export.html" $hFile= FileOpen($sFile, 2 + 8) FileWrite($hFile,$sHTMLTable & $sCSSstyle) FileClose($hFile) If @error Then msgbox(0,"Print Error","Failed to close the file!") EndIf ShellExecute($sFile) WinWaitActive(StringTrimLeft($sFile,StringInStr($sFile,"\","",-1))) send("^p") EndFunc ;==>_table_print1 point -
Making While loop
cherrylatte reacted to Jfish for a topic
You are testing your condition twice. The first $search is superseded by the second. The second $search is in your while loop and when it becomes false it exits the loop (i.e. when the image detected changes so it is no longer 'a.bmp,0,0,0,0'). Delete the first line and run it again to see what happens. Should be the same result. If you explain what you are trying to do folks could offer suggestions.1 point -
Process Close leaves Icon in Tray
maniootek reacted to Xenobiologist for a topic
Hi, try this: ; =================================================================== ; _RefreshSystemTray($nDealy = 1000) ; ; Removes any dead icons from the notification area. ; Parameters: ; $nDelay - IN/OPTIONAL - The delay to wait for the notification area to expand with Windows XP's ; "Hide Inactive Icons" feature (In milliseconds). ; Returns: ; Sets @error on failure: ; 1 - Tray couldn't be found. ; 2 - DllCall error. ; =================================================================== Func _RefreshSystemTray($nDelay = 1000) ; Save Opt settings Local $oldMatchMode = Opt("WinTitleMatchMode", 4) Local $oldChildMode = Opt("WinSearchChildren", 1) Local $error = 0 Do; Pseudo loop Local $hWnd = WinGetHandle("classname=TrayNotifyWnd") If @error Then $error = 1 ExitLoop EndIf Local $hControl = ControlGetHandle($hWnd, "", "Button1") ; We're on XP and the Hide Inactive Icons button is there, so expand it If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then ControlClick($hWnd, "", $hControl) Sleep($nDelay) EndIf Local $posStart = MouseGetPos() Local $posWin = WinGetPos($hWnd) Local $y = $posWin[1] While $y < $posWin[3] + $posWin[1] Local $x = $posWin[0] While $x < $posWin[2] + $posWin[0] DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y) If @error Then $error = 2 ExitLoop 3; Jump out of While/While/Do EndIf $x = $x + 8 WEnd $y = $y + 8 WEnd DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart[0], "int", $posStart[1]) ; We're on XP so we need to hide the inactive icons again. If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then ControlClick($hWnd, "", $hControl) EndIf Until 1 ; Restore Opt settings Opt("WinTitleMatchMode", $oldMatchMode) Opt("WinSearchChildren", $oldChildMode) SetError($error) EndFunc; _RefreshSystemTray() Mega1 point