autoitxp Posted November 25, 2007 Share Posted November 25, 2007 (edited) hi well i donno y im nt getting true results while using this method If $idrecord > $idrecord Then $idrecord -= 1 it works fine when use simple If $idrecord > 1 Then $idrecord -= 1 i want to put somthing like this $idrecord = 3 $idrecord > $idrecord -1 then $idrecord -= 1but it returns not to 2 why is that help!!!!!!!!REGARDSsim Edited November 25, 2007 by autoitxp Link to comment Share on other sites More sharing options...
Nahuel Posted November 25, 2007 Share Posted November 25, 2007 ?What do you mean "it returns not to 2"?$idrecord = 3 So, we can replace $idrecord with 3, right?If 3 > 2 then 3-1And we get 2 as a result Link to comment Share on other sites More sharing options...
autoitxp Posted November 25, 2007 Author Share Posted November 25, 2007 yaa not to 2 and i dont want to replace $idrecord to 3 coz $idrecord will change time 2 time with other method #include <GUIConstants.au3> #Include <GuiStatusBar.au3> Local $gui Local $a_PartsText[3] Local $a_PartsRightEdge[3] = [200, 500, -1] $add = 3 $gui = GUICreate("Database Gui", 800,600) $StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText) $next = GUICtrlCreateButton ("add", 100, 500,100) $prv = GUICtrlCreateButton ("subtract", 300, 500,100) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $next $add = 1 + $add call("_next") Case $msg = $prv If $add > $add Then $add -= 1 _prv() EndSelect Wend func _prv() _GUICtrlStatusBarSetText($StatusBar1,$add) EndFunc func _next() _GUICtrlStatusBarSetText($StatusBar1,$add) EndFunc Link to comment Share on other sites More sharing options...
Nahuel Posted November 25, 2007 Share Posted November 25, 2007 I was just showing you an example of how your script is working. I have no idea what you are trying to do, but this adds and substracts the number in the status bar: expandcollapse popup#include <GUIConstants.au3> #Include <GuiStatusBar.au3> Local $gui Local $a_PartsText[3] Local $a_PartsRightEdge[3] = [200, 500, -1] $add = 3 $gui = GUICreate("Database Gui", 800, 600) $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText) $next = GUICtrlCreateButton("add", 100, 500, 100) $prv = GUICtrlCreateButton("subtract", 300, 500, 100) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $next $add = 1 + $add Call("_next") Case $msg = $prv If $add > $add - 1 Then $add -= 1 _prv() EndSelect WEnd Func _prv() _GUICtrlStatusBarSetText($StatusBar1, $add) EndFunc ;==>_prv Func _next() _GUICtrlStatusBarSetText($StatusBar1, $add) EndFunc ;==>_next You'll need to speak clrearer, i can't really understand what you say. Link to comment Share on other sites More sharing options...
autoitxp Posted November 25, 2007 Author Share Posted November 25, 2007 (edited) well this is not subtracting any thing i want to subtract 1 from current value of $add If $add > $add Then $add -= 1 and this method acsseed 1 to -1 when call previous button If $add > $add -1 Then $add -= 1 and this works fine but its not subtracting current value of $add If $add > 1 Then $add -= 1 hope u got this time Edited November 25, 2007 by autoitxp Link to comment Share on other sites More sharing options...
Xandl Posted November 25, 2007 Share Posted November 25, 2007 Hello autoitxp, the symbol ">" is for comparing *two* values. So you will need two different variables. If $add > $add Then $add -= 1 Here, there is only one value, "$add", so this can not work. The variable $add can never be bigger than $add, at the same time (line of code). If $add > $add -1 Then $add -= 1 In this example, comparing $add with $add-1 is useless, as this will always be true, so you would simply write $add -= 1, but thats not what you want, i guess. If $add > 1 Then $add -= 1 This will work correct, if $add > 1. I think you would need a second variable as a reference, to compare it to $add. Link to comment Share on other sites More sharing options...
autoitxp Posted November 25, 2007 Author Share Posted November 25, 2007 thanks dude i will try Link to comment Share on other sites More sharing options...
autoitxp Posted November 25, 2007 Author Share Posted November 25, 2007 (edited) Hi thanks man this method works local $add = 3 local $add1 = $add If $add > $add1 -1 Then $add -= 1 Edited November 25, 2007 by autoitxp Link to comment Share on other sites More sharing options...
Nevin Posted November 25, 2007 Share Posted November 25, 2007 lol? Anyone else think this is weird? Link to comment Share on other sites More sharing options...
JustinReno Posted November 25, 2007 Share Posted November 25, 2007 I do, its making my brain hurt.. I don't understand this at all. Sorry... Link to comment Share on other sites More sharing options...
martin Posted November 25, 2007 Share Posted November 25, 2007 $idrecord = 3 $idrecord > $idrecord -1 then $idrecord -= 1 but it returns not to 2 why is that help!!!!!!!! REGARDS simIf you put the IF in front of the second line then it works as expected, though it's pointless. $idrecord = 3 If $idrecord > $idrecord -1 then $idrecord -= 1 consolewrite($idrecord);<--shows 2 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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