
ssubirias3
Active Members-
Posts
350 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
ssubirias3's Achievements

Universalist (7/7)
1
Reputation
-
SkysLastChance reacted to a post in a topic: If window is not active then exit
-
Equality of Numbers and Strings
ssubirias3 replied to ssubirias3's topic in AutoIt General Help and Support
@M23 - thanks for the response and cool pic! The idea that au3 "guess[es] what type [of] ... expression" became obvious clear during my troubleshooting and examining the pattern of test results. Otherwise I might not have landed on the workaround of using Number() to force the type as you've suggested. . Sorry for "overcomplicating" the issue, I was merely trying to understand why it appeared the operators (+, >=, =, etc) were not treating strings consistently. After all, a string is a string is a string, right?? So the string "4" + another string "04" should = 0 not 8; as in the example "red" + "yellow" = 0 ... but there I go again overcomplicating things. LOL. Your point of not comparing numbers to strings is sound and logical advice! In fact the Help file reads "Macro Reference - Date And Time ... Notice that most return values are two-digits long." Why aren't there any remarks suggesting the use of the Number() function when using date/time macros in mathematical/logical statements? The au3 dev team is too smart and sharp to ever want to encourage/enable a naughty practice like comparing strings to numbers. I guess the real question here is, "How or why does au3 internally guess the strings "04" and "4" to be numbers when used in a mathematical or logical statement?" If au3 "internally" finds that strings in mathematical/logical statements are only numbers (0-9) and internally forces these strings into numbers, that would be totally groovy! But that in itself introduces another possible inconsistency. If @MON = "04" (a string) and $m = "4" (another string), then shouldn't au3 handle the statement [iF @MON = $m Then] as a number comparison not a string comparison? After all the statement [iF @MON + $m = 8 Then] is a true statement. Shouldn't this only be true for numbers not strings? I'll be the first to admit I probably don't know what I'm talking about. But there just seems to be some inconsistency, dare I even hint at a b-u-g. Only in the name of education am I pressing on to understand why A=B, B=C, but A<>C. ConsoleWrite('@MON = ' & @MON & ' --- @MON is a String: ' & IsString(@MON) & @CR & @CR) ConsoleWrite('What is @MON (string) + "4" (string) = ' & @MON + "4" & @CR) If @MON + "4" = 8 Then ConsoleWrite('Hmmm... @MON + "4" = 8 ... Really?? string + string = number' & @CR & @CR) If @MON + 4 = 8 Then ConsoleWrite('Hmmm... @MON (string) + 4 (number) = 8 (number) ... Naughty mix 1: string + number' & @CR) If @MON >= 3 Then ConsoleWrite('Hmmm... @MON (string) is > OR = 3 (number) ... Naughty mix 2: string >= number' & @CR) If @MON >= "3" Then ConsoleWrite('Hmmm... @MON (string) is > OR = "3" (string) ... Naughty mix 3' & @CR) If @MON = 04 Then ConsoleWrite('Hmmm... @MON (string) = 04 (number) ... Naughty mix 3a: string = number' & @CR) If @MON = 4 Then ConsoleWrite('Hmmm... @MON (string) = 4 (number) ... Naughty mix 3b: string = number' & @CR & @CR) If @MON = 4 And @MON = 04 Then ConsoleWrite('(A = B) @MON (string) = 4 (number) AND @MON (string) = 04 (number)' & @CR) If 4 = "4" Then ConsoleWrite('(B = C) 4 (number) = "4" (string) --- BUT ...' & @CR) If @MON <> "4" Then ConsoleWrite('(A <> C) @MON (string) <> to "4" (string) ... WOW!!' & @CR) ;.......... OUTPUT .............................. ;@MON = 04 --- @MON is a String: 1 ; ;What is @MON (string) + "4" (string) = 8 ;Hmmm... @MON + "4" = 8 ... Really?? string + string = number ; ;Hmmm... @MON (string) + 4 (number) = 8 (number) ... Naughty mix 1: string + number ;Hmmm... @MON (string) is > OR = 3 (number) ... Naughty mix 2: string >= number ;Hmmm... @MON (string) = 04 (number) ... Naughty mix 3a: string = number ;Hmmm... @MON (string) = 4 (number) ... Naughty mix 3b: string = number ; ;(A = B) @MON (string) = 4 (number) AND @MON (string) = 04 (number) ;(B = C) 4 (number) = "4" (string) --- BUT ... ;(A <> C) @MON (string) <> to "4" (string) ... WOW!! QUESTION: "How or why does au3 internally guess the strings "04" and "4" to be numbers when used in a mathematical or logical statement?" Thanks in advance! -
Please hang tight while I give some background on my question and possibly flawed logic. Most of us remember the Transitive Property of Equality, right? Where A=B and B=C then A=C. And yes, this logic cannot be used in all situations like sporting events (Team1 beats Team2, Team2 beats Team3, so Team1 will undoubtedly beat Team3). But this property works pretty much in math and science (1g = 1ml, 1ml = 1cm3, 1g = 1cm3). While working on a section of code to compare entered dates (m/d(d) or mm/dd format) against floating date ranges, I ran into a snag. The script wouldn't produce the expected/desired results. Using the Date/Time macros in the past hasn't presented any problem when performing calculations... that is until this script, hence this post. After troubleshooting the script's mathematical/logical operations I learned the following: Despite the Help file stating the au3 Date/Time macros (@MON, @YEAR, @MDAY, etc) returned "digits" the return values are actually "string" characters. (Digit: In mathematics and computer science, a digit is a symbol ... used ... to represent ... integers or real numbers ...) ConsoleWrite("@MON = " & @MON & " ... @MON is a Number: " & IsNumber(@MON) & @CR) ConsoleWrite("@MON = " & @MON & " ... @MON is a String: " & IsString(@MON) & @CR) ConsoleWrite("@MDAY = " & @MDAY & " ... @MDAY is a Number: " & IsNumber(@MDAY) & @CR) ConsoleWrite("@MDAY = " & @MDAY & " ... @MDAY is a String: " & IsString(@MDAY) & @CR) ConsoleWrite("@YEAR = " & @YEAR & " ... @YEAR is a Number: " & IsNumber(@YEAR) & @CR) ConsoleWrite("@YEAR = " & @YEAR & " ... @YEAR is a String: " & IsString(@YEAR) & @CR) ;.......... OUTPUT .............................. ;@MON = 04 ... @MON is a Number: 0 ;@MON = 04 ... @MON is a String: 1 ;@MDAY = 24 ... @MDAY is a Number: 0 ;@MDAY = 24 ... @MDAY is a String: 1 ;@YEAR = 2010 ... @YEAR is a Number: 0 ;@YEAR = 2010 ... @YEAR is a String: 1Digging further into this I discovered that au3 (v3.3.6.0) treats strings like numbers in that you can use mathematical operators on them. ConsoleWrite("What is 4 (number) + 4 (number) = " & 4 + 4 & @CR) ConsoleWrite('What is "4" (string) + "04" (string) = ' & "4" + "04" & @CR) ConsoleWrite('What is 4 (number) + "04" (string) = ' & 4 + "04" & @CR) ;.......... OUTPUT .............................. ;What is 4 (number) + 4 (number) = 8 ;What is "4" (string) + "04" (string) = 8 ;What is 4 (number) + "04" (string) = 8All looks as expected, no big deal. And again the Transitive Property of Equality is holding long and strong!! But this next section of code is where I need some help from you guys to help school me like a kindergartener. ConsoleWrite("@MON = " & @MON & " ... @MON is a Number: " & IsNumber(@MON) & @CR) ConsoleWrite("@MON = " & @MON & " ... @MON is a String: " & IsString(@MON) & @CR) If 4 = "4" Then ConsoleWrite("a. TRUE" & @CR) If "4" = "04" Then ConsoleWrite("b. TRUE" & @CR) If 4 = "04" Then ConsoleWrite("c. TRUE" & @CR & @CR) If "04" = @MON Then ConsoleWrite("i. TRUE" & @CR) If 04 = @MON Then ConsoleWrite("ii. TRUE" & @CR) If "4" = @MON Then ConsoleWrite("iii. TRUE" & @CR) If 4 = @MON Then ConsoleWrite("iv. TRUE" & @CR) ;.......... OUTPUT .............................. ;@MON = 04 ... @MON is a Number: 0 ;@MON = 04 ... @MON is a String: 1 ;a. TRUE ;c. TRUE ; ;i. TRUE ;ii. TRUE ;iv. TRUEGranted to obvious answer is string "4" is not equal to string "04", just as the string "red" is not equal to the string "car". Yeah I get that, thanks. What I don't completely understand is if 4 (A - number) equals "4" (B - string), and 4 (A - number) equals "04" (C - string), why doesn't "4" (B - string) equal "04" (C - string)? Remember (1g = 1ml = 1cm3) and (1g = 1cm3) and (1ml = 1cm3). Based on the Help file, I'm not using the "==" operator and asking au3 to "test if two strings are equal", rather I am using the "=" to "test if two values are equal". And yes, its because two "strings" are being tested that au3 is doing a case insensitive test of the two strings. Ok, I get that too. But why does au3 sum (add) two strings as though they were numbers ("4" (string) + "04" (string) = 8 (number)). Its not like "red" + "yellow" = 13382194 (decimal value for orange based on hex:cc3232) ConsoleWrite(";---------------------" & @CR) ConsoleWrite('What is "red" (string) + "yellow" (string) = ' & "red" + "yellow" & @CR) ConsoleWrite(";---------------------" & @CR) ;.......... OUTPUT .............................. ;--------------------- ;What is "red" (string) + "yellow" (string) = 0 ;--------------------- Wow... guess I should cut back on the coffee. To think all this because a simple date comparison against @MON failed to work as expected. My workaround was to use the Number() function in order to get the desired outcome. Crazy since all other date calculations using the Date/Time macros didn't require that. $result = InputBox("test", "enter date (m/d or mm/dd): ") $aDate = StringRegExp($result, "(\d+)", 3) $test = _DateCalc($aDate[0], $aDate[1]) MsgBox(0, "Test", $test) Func _DateCalc($m, $d) Local $aMonths[12][2] = [["January", "31"],["February", "28"],["March", "31"],["April", "30"],["May", "31"], _ ["June", "30"],["July", "31"],["August", "31"],["September", "30"],["October", "31"],["November", "30"],["December", "31"]] If (((Number($m) = @MON) And ($d >= @MDAY) AND ($d < $aMonths[$m - 1][1] + 1)) Or _ ((Number($m) > @MON) And ($d >= 1) And ($d < $aMonths[$m - 1][1]))) Then Return "Within Range " & $aMonths[$m - 1][0] Else Return "Outside Range" EndIf EndFunc ;==>_DateCalc Thanks for reading, any insight/correction is appreciated.
-
Hi, not sure what website you're attempting to work with. Recently I needed to automate a ColdFusion (.cfm) website. The logon form would accept the credentials using _IEFormElementSetValue(). And as you've described, I too wasn't able to get either _IEFormSubmit() or _IEAction() to submit the form correctly. So my workaround involved using the Send() function to emulate the manual entry of an enduser pressing ENTER. Granted Dale or some of the other au3 greats here would have the correct method of logging into this .cfm form, but it works for me and that's what matters. If anyone knows how to properly submit a ColdFusion I'd would appreciate the insight. And obviously the script sees the form correctly otherwise the credentials wouldn't be set in the UserID/Password fields. _IEFormElementSetValue($oUser, "EndUserID") _IEFormElementSetValue($oPass, "Som3_Str0ngP@ssworD!") Sleep(500) WinWait($WinTitle,"Done") Opt("SendKeyDelay", 100) Send("{TAB 3}") Send("{ENTER}") Opt("SendKeyDelay", 5) Cheers!!
-
How to PostMessageA "Ctrl"+"Tab" to a window?
ssubirias3 replied to qingtianyu9's topic in AutoIt General Help and Support
Hi, I'm not familiar with the PostMessageA() function you're describing. Another way to control/send commands to an unactivaed window is by using the following: AutoIt Help File AutoIt Window Information applet 16 different AutoIt interal Control*() functions; i.e., ControlSend(), ControlClick(), ControlFocus()Cheers! EDIT: A quick search on the forum shows plenty of information on using PostMessageA correctly. In case you haven't searched before posting your question, you might check this thread out. -
Ahhh, good ole ScriptWriter!! It seems like yesterday when I didn't know what the world I was doing and thought ScriptWriter was the greatest thing EVER!!! Its was a great learning tool ... for the first week. But reading/searching the Help file and playing around with the example scripts is really the next step. Badal, look up these commands and compare them to what ScriptWriter did for you. The 4 lines quoted above work perfectly I'm sure. But isn't this a cleaner and easier way to do the same thing? MouseClick("left", 318,294) Send("{TAB 13}{ENTER}") Oh and to your question of Run() verses ControlClick(), they can both be used to "run/launch" something but they aren't really for the same purpose. In your studies, look at the other functions/commands that start with "Control" and you'll come to love that. One huge advantage of the Control*() functions is that what you're scripting can be hidden or in the background!! Cheers!!
-
Hi, a few months back a wrote a script for a buddy who wanted to use Microsoft MapPoint with his TomTom GPS. That was a fun project and taught me a bit about working with these strings that aren't always in the "correct" format we need. Here's some feedback that hopefully will help you moving forward. 1) You won't be able to read any file without opening it, at least in the background. 2) You realize the file is writing long/lat and your script with have to reorder those numbers in ADDITION to inserting the "." 3) Searching the Help file a little more could have given you the answer BrettF gave you about the FileReadLine() & ShellExecute(). Good job putting some effort in describing your goal and provided more info than the usual newbie. Play around with this script and see what you can learn by looking up the commands you don't recognize. This should get you started. Cheers!!! Global $gmap = "http://maps.google.com/maps?q=+", $lat, $lon Global $sfile = "c:\messages.txt" $file = FileOpen($sfile, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $eof = FileReadLine($sfile, -1) FileClose($file) ; parses last line ($eof) into an array $aString = StringRegExp($eof, "\w+[^\|]", 3) $lat = $aString[10] $lon = $aString[9] ; splits $lat string into two parts to allow insert of "." then rejoins $lat1 = StringLeft($lat, 2) $lat2 = StringRight($lat, 6) $lat = $lat1 & "." & $lat2 ; splits $lon string into two parts to allow insert of "." then rejoins $lon1 = StringLeft($lon, 3) $lon2 = StringRight($lon, 6) $lon = $lon1 & "." & $lon2 ; put it all together in a URL that any browser and Google with like $myURL = $gmap & $lat & ",-" & $lon ShellExecute($myURL)
-
Auto it get document.getElementsByName
ssubirias3 replied to Noah's topic in AutoIt General Help and Support
Not exactly clear on what your goal is. Do you want au3 to return the "guest" that's next to the (name="securitytoken" value="guest") or are you just trying to log into the website with with au3? Using the IE.au3 UDF and the examples in the Help file you should be able to do almost anything you want. Some of the frustration I've had automating websites was eliminated once I understood the webpage structure. If the page has multiple nameless frames you'll have to specify which frame using _IEFrameGetCollection(). Pages containing multiple nameless forms could use _IEFormGetCollection() and _IEFormElementGetCollection(). Also check out the example code in _IETagNameAllGetCollection(). That helped me get a better handle on the _IE*() functions. In the example try using .name or .innerHTML in place of the .tagname This should hold you over until someone who knows what they're talking about can respond. But they too will want a better understanding of your goal. Cheers!! -
Thank you dear Sir!! At first I wasn't sure what you were talking about, but now I'm crystal clear and better for it!! Thinking back to why/where I picked up the habit, I don't recall exactly. Think someone here explained the difference between "=" and "==" as being something like equal vs equal to. Meaning use "=" when setting a variable and use "==" when checking if the variable was "equal to" a value. But the au3 Help file is quite clear that for proper au3 syntax the "==" should only be used for string comparisons that need to be case sensitive. Thanks for the nudge in the right direction. And to think had you not been kind enough to mention this, I would have continued this poor habit. Long live the Admiral!!
-
Seems like Windows 7 isn't supported under the current production build of au3 (3.3.6.0). Your Do..Until loop is fine, otherwise it wouldn't work in WinXP either Cheers!!
-
Differences between Spy++ And AutoIt Window Info
ssubirias3 replied to cappy2112's topic in AutoIt General Help and Support
Spy++ is a great tool that's for sure!! If you program with Visual Studio then you probably know about COMs. Look in the au3 Help file for COM Objects. See if that helps you. this is an excerpt from the Help file: Cheers! -
Problem With Autoit Window Info
ssubirias3 replied to thawee's topic in AutoIt General Help and Support
Well... yes and maybe. Yes if zero/absolutely no info is visible. However in cases where limited info is available, as in Java/Flash windows, that aren't "seen" by au3/WinInfo ... its more of a maybe than an outright no/impossible. In my limited experience these "problem" windows do have a top-level control visible/controlable by au3. So I'm merely suggesting using those functions to blindly click/send commands (like ALT+F4) to the single parent/topmost control. For example, if you goto the web and lauch a flash audio player, au3 WinInfo may display the Advance Mode value on the Control tab as "[CLASS:MacromediaFlashPlayerActiveX; INSTANCE:1]" or something similiar. Beyond that though, au3 can't control the play, pause, track, replay, next track contols/buttons. Hope this helps others! -
JonhOne is dead on the money. Putting forth some effort and showing what code you have, what isn't working, and where you need help is a much better method of asking for help. Here are some suggestions for you to study in the Help File. It (Help file) is usually easier to navigate than the forum that's filled with similiar questions asked thousands of times. Lookup FileReadToArray(), FileRead(), FileReadLine(), IniRead(), etc ... and cycle through the array until then using a For..Next loop Cheers!
-
Problem With Autoit Window Info
ssubirias3 replied to thawee's topic in AutoIt General Help and Support
Ahh, much better job describing your issue. THANK YOU!! This is part of the limitiations I was describing and common to java & flash windows. I'm sure there are other types of windows au3 can't read (like winamp in classic view), but there are other tools like Spy++ *might* give you more detailed info that au3 WinInfo doesn't. But understand you'll need a deeper knowledge of programming to leverage this info. When I need to control/automate windows that au3 doesn't "see", I've resorted to the MouseMove(), MouseClick(), Send(), ControlClick(), ControlSend(), etc commands. Granted this is less than desired, but with my limited knowledge I does what I gotz to do. I'm sure some of the real deal scripters/programmers here can help you better than I can. If you were going to settle for less and look into some of the commands I mentioned, make sure to use WinSetState() or WinMove() to ensure the target window and corrdinates are always the same. Likewise if different computers with different screen resolutions will run your script, you'll need to account for that too. Look into the @DesktopWidth, @DesktopHeight, and @DesktopDepth to sorta "standardize" window/corrdinate positions. Hope this helps! Cheers! -
Have you looked into Run() or RunWait() in the Help file? Would something like this work? Run("C:\Program Files\My App\app.exe c:\some_path\file.ext")
-
Problem With Autoit Window Info
ssubirias3 replied to thawee's topic in AutoIt General Help and Support
A little more detail would be helpful rather than asking the forum to play guessing games giving the wrong impressions of the forum & person asking for help. Taking a wild guess at what you might be describing, here are a thought. 1. Start with setting the au3 Window Info to "Frozen" mode (CTRL+Alt+F) 2. Using the Finder Tool (cross hairs) manually drag to area you want information --- NOTE: The tool has 7 tabs and assuming you have the Mouse tab selected... 3. While slowly dragging tool (with left mouse button held down) to different areas notice listed Property Values change. 4. You should see the Position Values and Color Values change as you move the cross hairs around the desktop 5. To see other information you'll need to select the appropriate tab Some people describe the information disappearing or not being visible. This is usually due to the video drivers on your system. Clicking in the white info area will usually return visibility. Launch the au3 Window Info a second time to get Window / Control information to automate the window. au3 (AutoIt3) is a great tool but not perfect. Some of the limitations I've have experienced is controling Flash windows. You should be able to automate the au3 Window Info tool would be my guess. Then again I can't read minds and have no idea what you mean or aim to do. Cheers!