MyEarth Posted April 3, 2013 Share Posted April 3, 2013 (edited) Hi, if i have: $a = 1280 $b = 720 and i want to change the $a to: $a = 752 How to make the $b value proprotional to $a like this? $a = 752 $b = 423 I'd like also the opposite, if i change $b i want the $a to be proportional to $b Thanks Edited April 3, 2013 by MyEarth Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 3, 2013 Moderators Share Posted April 3, 2013 Hi, MyEarth. Why not set a third variable, which could even be an inputbox, to do the calculation for you? $a = 1280 $b = 720 $c = InputBox("Calculate Vars Example", "What would you like the calculation to be?") $a = $a / $c $b = $b / $c MsgBox(0, "", "$a is now " & $a & ". $b is now " & $b) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MyEarth Posted April 3, 2013 Author Share Posted April 3, 2013 (edited) I need to set manually the value, with your solution i can't write it, example, $a = 124.5 then calculate $b or viceversa Edited April 3, 2013 by MyEarth Link to comment Share on other sites More sharing options...
water Posted April 3, 2013 Share Posted April 3, 2013 $a1 = 1280 $a2 = 752 $b1 = 720 $b2 = $b1 * $a2 / $a1 ConsoleWrite($b2 & @LF) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MyEarth Posted April 3, 2013 Author Share Posted April 3, 2013 Thanks, now i have understood Link to comment Share on other sites More sharing options...
water Posted April 3, 2013 Share Posted April 3, 2013 My example doesn't work when $a1 = 0. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MyEarth Posted April 3, 2013 Author Share Posted April 3, 2013 It's not a problem, $a and $b is always <> 0 Sorry, but if i want to calculate $a starting from $b what type of calc i need to do? Link to comment Share on other sites More sharing options...
water Posted April 3, 2013 Share Posted April 3, 2013 a2 = (a1xb2)/b1 Simple math. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MyEarth Posted April 3, 2013 Author Share Posted April 3, 2013 Cool, thanks again Link to comment Share on other sites More sharing options...
water Posted April 3, 2013 Share Posted April 3, 2013 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
AZJIO Posted April 3, 2013 Share Posted April 3, 2013 Mathematics, proportions, the 5th class at school expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> Global $k = 0 GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL") $GUI = GUICreate("horis", 1020, 285, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_HSCROLL)) $slider1 = GUICtrlCreateSlider(10, 5, 1000, 30) GUICtrlSetLimit(-1, 1000, 0) $hSlider_Handle1 = GUICtrlGetHandle(-1) GUICtrlSetData(-1, 120) $slider2 = GUICtrlCreateSlider(10, 35, 1000, 30) GUICtrlSetLimit(-1, 1000, 0) $hSlider_Handle2 = GUICtrlGetHandle(-1) GUICtrlSetData(-1, 72) $koef = 72/120 $condition = GUICtrlCreateLabel('', 10, 75, 300, 55) GUISetState() Do Until GUIGetMsg() = -3 Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) ; _WinAPI_LoWord Local $value = BitShift($wParam, 16) ; _WinAPI_HiWord Switch $lParam Case $hSlider_Handle1 $sMsg = 'Slider = 1' & @LF & 'value = ' Switch $nScrollCode Case $SB_THUMBTRACK $sMsg &= $value & @LF & 'mode = Keeping by the left button of a mouse' Case $SB_THUMBPOSITION $sMsg &= $value & @LF & 'mode = Trundle mouse' Case $SB_LINELEFT $value = GUICtrlRead($slider1) $sMsg &= $value & @LF & 'mode = Arrow L/Up' Case $SB_LINERIGHT $value = GUICtrlRead($slider1) $sMsg &= $value & @LF & 'mode = Arrow R/Down' Case $SB_PAGELEFT $value = GUICtrlRead($slider1) $sMsg &= $value & @LF & 'mode = Click Left' Case $SB_PAGERIGHT $value = GUICtrlRead($slider1) $sMsg &= $value & @LF & 'mode = Click R' EndSwitch If $nScrollCode <> 8 Then GUICtrlSetData($condition, $sMsg) GUICtrlSetData($slider2, $value*$koef) EndIf Case $hSlider_Handle2 If $nScrollCode = $SB_THUMBTRACK Then GUICtrlSetData($condition, '2 - ' & $value) GUICtrlSetData($slider1, $value/$koef) EndIf Case 0 If $nScrollCode = $SB_THUMBTRACK Then GUICtrlSetData($condition, '3 - ' & $value) EndSwitch $k += 1 WinSetTitle($GUI, '', 'call ' & $k & ', c=' & $nScrollCode & ', v=' & $value) Return $GUI_RUNDEFMSG EndFunc My other projects or all Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now