MyEarth 10 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 Share this post Link to post Share on other sites
JLogan3o13 1,624 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! Share this post Link to post Share on other sites
MyEarth 10 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 Share this post Link to post Share on other sites
water 2,369 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 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
MyEarth 10 Posted April 3, 2013 Thanks, now i have understood Share this post Link to post Share on other sites
water 2,369 Posted April 3, 2013 My example doesn't work when $a1 = 0. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
MyEarth 10 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? Share this post Link to post Share on other sites
water 2,369 Posted April 3, 2013 a2 = (a1xb2)/b1 Simple math. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
water 2,369 Posted April 3, 2013 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
AZJIO 155 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 Share this post Link to post Share on other sites