
Angel
Active Members-
Posts
351 -
Joined
-
Last visited
Everything posted by Angel
-
I have a GUI with a slider in it. If I use the slider callback the callback function is only called when the user unclicks the mouse button. Instead, I'd like to call a function while the user drags the slider, updating my GUI "on the fly" everytime that he mouves the mouse, without him needing to unclick the mouse button. To do so I want to use the GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") trick (which I learnt in this forum). However I do not know which are the "notification codes" for the slider events. I looked in winuser.h, but I only found the combo, editbox, etc, but not the slider ones. Does someone know where I can get those notification codes? Thanks! Angel
-
Is there a value for uninitialized variables?
Angel replied to Angel's topic in AutoIt General Help and Support
Thanks. I actually knew that, as I had verified it before posting my question. But what I'd like to know is whether this is the expected behavior or if this is just an unspecified behavior. The help file does not mention this, so I'd like to make sure that this is how it should be. This seems to be a rather fundamental question about variable declaration in AutoIt... -
Hi, I'd like to know if I can safely assume that the value of an uninitialized (but declared) variable will be "". Also, if that is the case, can I assume that to be the expected behaviour (i.e. part of the specification of the AutoIt language) and not likelly to change? Basically, I am using some Global variables as "persistant" or "static" variables within a function: Func myCallbackFunc() ; Declare the "pseudo-static" variable that keeps track of a editBox value Global $myCallbackFunc_previousValue ; Read the new contents of the editBox Local $myCallbackFunc_previousValue= GUICtrlRead($myEditBox) ; Check if the contents of the editBox changed If $myCallbackFunc_previousValue = $newValue Then Return EndIf ; If we get this far, the value in the editBox changed $previousValue = $newValue ; DO SOME WORK HERE EndFunc Basically I'd like to know if I need to declare and initialize to "" the Global variable $myCallbackFunc_previousValue outside of the function or not. I'd rather not, because then the codes looks more like if AutoIt really had support for static (persistant) variables. My worry is that in some future version of AutoIt this code may not be valid anymore or if I enable "MustDeclareVars" it would at some point stop working. Thanks for your opinions! Angel
-
Thank you so much! I feel so foolish! I had checked on the Style and Extended Style tabs. It never occurred to me that it would be right there, the second property of labels! Thanks a lot. That had been bugging me for a while! Angel
-
Hi, there is one pretty annoying thing when using Koda. Imagine that I create a GUI and in it there is a form with a single a label. I put some text into the label and then I manually change the size of the label (to make it way bigger than the text that it holds). Then I save the form (as a .kxf file). When I open the .kxf file again, Koda does not "remember" the size of the label. It just fits the size of the label to the size of the text that it contains. Maybe it is just a configuration issue? Is this a bug? Or is there any way to change this behaviour? Thanks! Angel
-
There does not seem to be any way, but is there possible to force a message box to be on top of the current application only? That is, if you select a different application, the message box would not be on top, but as soon as you bring the autoit application to focus, the message box would come to the forefront. Is that possible? Otherwise, what is the difference between "System Modal" and "Task Modal"?
-
SmOke_N, I wish I could have posted a recreation script. Everytime this has happened the problem was on a script too complicated to post here. By too complicated I mean that it would not run on a PC without the right software installed, as I am automating some custom software that we use at work. The only extra information that I can add is that there is one particular message box that seems to have this problem: MsgBox(64,"Check-Out result",$sResult) So the only flag I use is the "information icon" flag. Also, _sometimes_ the message box _is_ shown on the windows task-bar. It just is not brought to the forefront (which is almost equally annoying). I will try using some of the "modal" flags. However I still do not understand why a message box would not be brought to the front upon creation. That is basically the only thing that I would expect from it! Angel
-
Hi, I've been having a problem with message boxes for a while and I hope that you guys have a work around or at least know the reason for the problem. What happens is that I use MsgBox to open a message box (usually from some callback function on a GUI made using event mode). From time to time (not always, but fairly often) the message box does not appear so the GUI seems to be "hung". But in reality it is just waiting for the user to click the message box. The message box is actually there, but it is not shown on the windows task bar and it is not brought to the forefront when it is created. You can use Alt+TAB to "go to it", at which point it is brought to the forefront AND it appears on the taskbar. I have not been able to reproduce this problem on a reliable manner, but it happens from time to time. It is rare enough that I often forget about it so when it happens I do not remember to check if there is a message box. But it is common enough to be pretty annoying as it makes programs seem to be "stuck". So, is there any reason why this could be happening? Is there some way to avoid it? Does anyone else see this problem? BTW, I've seen this is different machines, and I am fairly sure that some of them were Windows2K boxes (and it also happens on my development box, which has Windows XP). One extra detail is that my GUI code normally has the following sleep loop in then: While 1 Sleep(100) WEnd I think that it does not matter, but maybe the sleep period is too short? Any ideas? This is terribly annoying! Thanks, Angel
-
ComboBox OnChange Event not triggered after typing
Angel replied to Angel's topic in AutoIt GUI Help and Support
Thanks again gafrost, actually I just found that MSDN message on my own and fond about the KILLFOCUS message. This is an extremely powerful technique! It is very flexible and basically it gives you access to the full power of the Windows GUI API in AutoIt. Thanks _a lot_ for sharing this with me :-)))) Actually, I think that this merits some sort of section on the AutoIt manual. It is really really useful. And all the windows GUI constants should be also included with AutoIt, in my opinion. Thanks again! Angel -
ComboBox OnChange Event not triggered after typing
Angel replied to Angel's topic in AutoIt GUI Help and Support
Awesome! Thanks a lot gafrost... Is there any way to only trigger the function (or at least recognize) when the combo loses its focus or when the user types ENTER? Also, what is the difference between $CBN_EDITUPDATE and $CBN_EDITCHANGE? I tried enabling or disabling each of those but it did not make any difference... Angel -
ComboBox OnChange Event not triggered after typing
Angel replied to Angel's topic in AutoIt GUI Help and Support
gafrost, thanks a lot for the reply. I have a question though: In the example you do not use the event mode. Is that a requirement for this to work? The combo box with which I am having problems is part of a pretty big GUI that I already made and which uses the Event mode. It would be quite difficult to change it all to a message loop type of GUI. So would this work in the on event mode too? Perhaps you could explain a bit more how this works? Thanks! Angel -
Hi, I tried to find an answer to this problem on the forums but I did not find it. Hopefully this is not a duplicate of a previous post. I have an editable combo box in a GUI (i.e. you can both type on the combobox or select one item on the list). I used GUISetOnEvent to trigger a function whenever the combo changes. However, the function only seems to be triggered when I select an element from the list. When I simply type something on the combo editbox the event handler function does not execute. Is there a way to get around this problem? Thanks, Angel
-
Controlling Visual Studio 2005 with AutoIt via COM
Angel replied to Angel's topic in AutoIt General Help and Support
I actually did both. I think that I have a good idea of the automation model of Visual Studio, which is pretty well documented. However I am not even able to start Visual Studio itself. Does someone have some experience with this? Angel -
Hi, I am trying to automate the installation of some macros into Visual Studio 2005. Currently I am just using AutoIt to send keystrokes, wait for windows etc. However this has certain limitations and is a bit error prone. So I would like to try to automate Visual Studio through COM. I'd like to create a Visual Studio 2005 object in my AutoIt script and use COM to install some settings, load some macros, etc. I found some microsoft pages that explain that to create a new instance of Visual Studio 2005 you can use (in Visual Basic) the following code: CreateObject("VisualStudio.Solution.8.0", "") or CreateObject("VisualStudio.DTE.8.0", "") So I tried using ObjCreate("VisualStudio.DTE.8.0"): Dim $oVS = ObjCreate("VisualStudio.DTE.8.0") $oVS.ExecuteCommand("Tools.MacrosIDE") I was expecting this to start Visual Studio and opening the Macros IDE, but this does not seem to be the case. So do you guys know if this is possible and if so what I am doing wrong? Thanks! Angel
-
Just wanted to let you know, if you didn't see it on the other thread, that the latest symantec virus definition file (from today, september 21st 2006) fix the issue. Cheers, Angel
-
Symantec AntiVirus Quarantines AutoIT Files
Angel replied to zeevid's topic in AutoIt General Help and Support
Good news! The latest symantec virus definition file (from today, september 21st 2006) fix the issue. Cheers, Angel -
Symantec AntiVirus Quarantines AutoIT Files
Angel replied to zeevid's topic in AutoIt General Help and Support
I just had the same problem! I will contact our IT department but these things go very slowly in a big company like mine. I am also afraid that they may ban our use of AutoIt! I hope Jon can contact Symantec and get this sorted out. This would be as if they banned the Python interpreter because you can write malicious python scripts! :-( Angel -
How to access a global array of unknown size
Angel replied to Angel's topic in AutoIt General Help and Support
Wow! That is a silly mistake! I was getting an error saying that the globals where being used before being declared and instead of looking at the obvious thing, I thought that I had to declare the globals inside the function as well, and then I did not understand what syntax should I use for that (which should have made me think back and realize my original mistake)... Thanks a lot for your help! :-) Angel -
How to access a global array of unknown size
Angel replied to Angel's topic in AutoIt General Help and Support
Nice catch. Actually I didn't see that because there is a problem even before that. When FindInFibonacciArray is called, when the Global arrays are declared, their sizes are 0! So how can I make reference to a global array without knowing its size? Angel -
How to access a global array of unknown size
Angel posted a topic in AutoIt General Help and Support
Hi, I am making a small AutoIt example program which calculates the Fibonnacci numbers. To make it faster I am using 2 global arrays to keep track of the numbers that have already been calculated. My problem comes when I use Global to declare these arrats within the fibonacci function. When I do so, if I check the size (Ubound) of the array, I get a size of 0, even if the arrays have been initialized to a size of 2: MsgBox(0,"Debug", Fibonacci(10)) Global $vFiboValues[2] = [1, 1] Global $vFiboIndexes[2] = [0, 1] ; Function to calculate the $n-th Fibonacci number ; First check if the number has been calculated before. Otherwise use a recursion to calculate it, ; then add it to the global list of fibonacci numbers which is used to avoid recalculation. This "list" ; is made out of 2 global arrays, one holding the numbers that have been calculated, the other ; holding the indexes of those numbers Func Fibonacci($n) Local $newFibo = FindInFibonacciArray($n) If $newFibo = False Then ; The fibonacci number is unknown, calculate it! $newFibo = Fibonacci($n-2) + Fibonacci($n-1) ; Add the $newFibo to the fibonacci memory ReDim $vFiboValues[UBound($vFiboValues)+1] ReDim $vFiboIndexes[UBound($vFiboIndexes)+1] $vFiboValues[UBound($vFiboValues)] = $newFibo $vFiboIndexes[UBound($vFiboIndexes)] = $n EndIf Return $newFibo EndFunc ; This function checks if the $index-th fibonacci number has been previously calculated ; If it has, it simply returns its value. If not, it returns False Func FindInFibonacciArray($index) Global $vFiboIndexes, $vFiboValues For $n = 0 To UBound($vFiboIndexes)-1 MsgBox(0,"Debug",$n & " " & $vFiboIndexes[$n]) If $index = $vFiboIndexes[$n] Then Return $vFiboValues[$n] EndIf Next ; If we get this far, return False to indicate that the $index was not found ; Note how we can return a bool or an integer, as the basic AutoIt variable is a VARIANT Return False EndFunc I know that I can calculate the fibonacci numbers with a For loop. That is not the point. I just want to show that autoIt can use recursion and just show some other features of the language (such as working with arrays, If/Else constructs, function declarations, etc). So, is there a way to declare a function as global to access it from within a function? I had never tried to do this before (which may say something about how useful my example will be! ;-)) Thanks, Angel -
Thanks a lot. That thread was extremelly clear. I'd vote for adding that particular explanation in the help file! Cheers, Angel
-
ahah! I think this one could be added to the list of "Valik quotes" My colleague did write the code, but in his defense it was the very first function that he ever wrote in AutoIt, so I should have pointed out to him a better way to do it. But we have so much to do that I just did not find the time to go back to this until I tried to figure out the reason for the problem with the editbox size. I still do not understand the reason why the editbox was behaving as it was. Do you know why? Was it due to the attributes that he was using ($WS_MAXIMIZEBOX+$WS_SIZEBOX)? You are correct in guessing that this is the child of another window, so we'll use WS_CHILD. Thanks again for the help. Angel
-
Thanks for the answer Valik. Before posting any code I just wanted to know if there was some obvious reason for this problem. This is my current code. It is in a separate autoit file that I include from my main gui file. This is actually not my code, originally. One colleague wrote it and I am updating it: #include-once Opt("MustDeclareVars",1) #Include <GuiEdit.au3> Global $LogLibDebugShowLineNumbers = False global $logVar global $logWindowId global $logCtrlId global $logFileName = @scriptdir & "\log_results.log" global $logFileHandle = -1 ; This default value means that the log has not been open yet global $EM_SETLIMITTEXT = 0x00C5 global $EditBufSize = 20000000 global $baseLowWindowTitle ;- State variables Global $vLastLogWindowSize Global $bIslogWindowMaximized = False ;****************************************** ; Function to print new line to output log ;****************************************** func CreateLogWindow($title, $width="", $height="", $left="", $top="", $style="", $exStyle="", $parent="") ;dim $logWindowId ; Create GUI window Switch @NUMPARAMS Case 1 $width = 501 $height = 401 $logWindowId = GUICreate($title, $width, $height) Case 2 $height = 401 $logWindowId = GUICreate($title, $width, $height) Case 3 $logWindowId = GUICreate($title, $width, $height) Case 4 $logWindowId = GUICreate($title, $width, $height, $left) Case 5 $logWindowId = GUICreate($title, $width, $height, $left, $top) Case 6 $logWindowId = GUICreate($title, $width, $height, $left, $top, $style) Case 7 $logWindowId = GUICreate($title, $width, $height, $left, $top, $style, $exStyle) Case Else $logWindowId = GUICreate($title, $width, $height, $left, $top, $style, $exStyle, $parent) EndSwitch ; Assign the function that will handle the "Maximize" event GUISetOnEvent($GUI_EVENT_MAXIMIZE,"LogWindowMaximize",$logWindowId) ; The close event is already setup on the main hsdpa_perf autoit file ; Create edit control $logVar = "" $logCtrlId = GUICtrlCreateEdit("", 0, 0, $width-2, $height-21, BitOR( _ $ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL,$ES_MULTILINE)) ; Increase size of data that edit control can hold GuiCtrlSetLimit($logCtrlId, $EditBufSize) ; Set the max number of lines to $EditBufSize ; Delete old log file FileDelete($logFileName) ; Save the selected window title as the "base window title" that will be always be set at the beginning of the window title $baseLowWindowTitle = $title return($logWindowId) endfunc oÝ÷ Ø2¢ëx¦ºÈ§Múè ݵ¶b+mëÞ®Øj["Íê¶v+[£êðÇë®emªâ²«¨¶²'^¡ûa{§v*ºH|ÞvìÞ¶¬7¨~Ø^Â)Ý£¥¢Ò,yëazÇ+¢Y[j»-j»m¡ªiyªâÈzØ^Â)Ý£"f¤zØ^Â)ݣ⫶¬rº%¶«u릮Ç(^µéeÈíézk¢ ÚØ^Â)Ý£¬r·µçZ±ú%,jëh×6 dim $hLog = CreateLogWindow("Log data", 701, 401, 494, 100, $WS_MAXIMIZEBOX+$WS_SIZEBOX, -1, $HSDPA_main) I am pretty sure that I (or the original coder) am doing something wrong but I don't know what... Thanks, Angel
-
Hi, I made a window that inside has an mutli-line editbox which I want to completelly fill the window. I want the editbox to have both vertical and horizontal scrollbars. I want the window (and the editbox inside it) to be resizable. My problem is that it seems that the size of the editbox does not include the scrollbars. So when I resize the window the scrollbars end up "outside" of the window. I've tried to compensate for this by making the editbox smaller than the window, but it seems that the actual size of the scrollbars depends on the operating system (windows2000 or xp) and probably also on the selected theme. Is there a simple way to set the editbox size including the scrollbars or at least a way to get the size (in pixels) of the scrollbars? And, for bonus points, is there some way to make the horizontal scrollbar only appear when the text actually is bigger than the size of the editbox? (I know that scrollbars get automatically is disabled/enabled but I'd rather have them disappear when not needed). Thanks! Angel
-
Opening a file with spaces on the filename
Angel replied to Angel's topic in AutoIt General Help and Support
In my tests it made no different whatsoever. I think those options are only meant for cases in which you execute a builtin windows command, in which case why would you need to use start? Do you guys see any potential use for that option? Cheers, Angel