
MaritimeGirl
Members-
Posts
17 -
Joined
-
Last visited
MaritimeGirl's Achievements

Seeker (1/7)
0
Reputation
-
Variable Population From Text File?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
Artisan, correct. I'm not the person writing all of the code, so I'm not in control of what gets declared in each of the 40 or so scripts we have to write. -
Variable Population From Text File?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
czardas, what errors? I never said I had any errors happening. Yes, indeed, it does become a multiline monster which is what I don't want to have to do. Don't blame me for the confusion for delimited string vs array, as here is the function definition from the documentation for iniWriteSection: IniWriteSection ( "filename", "section", "data" [, index] ) data The data to write. The data can either be a string or an array. If the data is a string, then each key=value pair must be delimited by @LF. If the data is an array, the array must be 2-dimensional and the second dimension must be 2 elements. Artisan, I'm not sure how Execute could help since that would still require a messy manually maintained list of the Global variables, just moved into an include file. See above for string vs array argument - I want an array. Going back to my last post's last line... "I can't find a function that would extract the list of key/value pairs of Global variables from the in progress script." -
Variable Population From Text File?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
Individual or array, no difference, it's getting the list of keys that's the problem. I want to make this a dynamic function to save all currently declared Global variables. IsDeclared helps a bit but it seems I have to do a bunch of statements in the function - it's not pretty and I'd rather not have to trust other coders to make sure they add a list of all of their Global variables in my sample code below: Local $pairs = "" if isDeclared("varA") Then $pairs = $pairs & "varA=" & $varA & @LF .... hundreds more if lines here... IniWriteSection($fileName, $sectionName, $pairs) I'd love to use an array for $pairs but I've looked and can't find a function that would extract the list of key/value pairs of Global variables from the in progress script. -
Variable Population From Text File?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
Thank you! Assign() was the missing piece! I did convert my dump file to be an ini file and the sections will lend themselves perfectly to the 40 or so scripts I will have instead of 40 different dump files. So, now is there is any way to iterate through the global variables to grab the variable name strings so that I can create the key/value pairs in the ini file? -
If I have three global variables, let's say... $varA $varB $varC and I have a really long script (hour execution time) that I want to be able to fail gracefully to allow for immediate restarting after fixing the origin of the problem without having to hardcode a bunch of debugging/temporary code at the start. I have error handling where if a catastrophic error occurs, I want the script to "dump" the global variable contents to a text file from that moment in time. Then, when I restart, I want the script to read in those values from the dump file and repopulate my global variables to what they were. Essentially, I suppose I'm attempting to create rudimentary "sessions" with AutoIt using some sort of Reflection like in Java. Yes, I know I'm asking a lot of AutoIt So, if my dump file contains... varA:15 varB=ABC varC=green My script should look for a dump file and if found, populate the variables. I have the code written to do all of the above except I'm using a case statement (which isn't dynamic since it's all hardcoded) to populate each of the variables if found. Any ideas/suggestions?
-
This is a bizarre thing. I have around 6000 lines of AutoIt code that was working wonderfully and I was using version 3.2 of IE.au3. A coworker had his AutoIt upgraded to a newer version which has version 3.3.7.20++ and now he can't run the existing code without errors occurring immediately. I've taken a copy of his IE.au3 and copied into a shared server's common folder from which I am running my .au3 scripts and called it IEnew.au3 and I have my older copy of IE.au3. I've created a simple snippet of code to demonstrate what I am seeing when I F5 them: #include "IEnew.au3" $url = "http://localhost:8082/myapp" Local $oIE = _IECreate($url) Local $oForm = _IEFormGetCollection ($oIE, 0) Local $oQuery = _IEFormElementGetObjByName($oForm, "username") _IEFormElementSetValue($oQuery, "hello") When I run that, I get the error: --> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType Same code, if I change the include to be "IE.au3" and run it again, my textbox is populated successfully. Is this because I have IE.au3 in C:\Program Files\AutoIt3\Include as well? (I don't have permission to the C:\ files to experiment, would have to contact our systems people so I'd like to know if that's the issue before I do that.)
-
Anonymous Javascript Alert OK Button Press?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
According to documention, AdlibRegister constantly calls the function until AdlibUnregister is called at the given interval. I've added the time parameter as 750. It still doesn't dismiss the popup. Based on your post, I can't determine what you're telling me to loop. I tried looping a call to Popup() and my alert trigger instide the adlib commands but it still doesn't work. And the title is as I mentioned in my first post - the default of "Windows Internet Explorer" which I've also tried specifying in the Popup() function. If you can get that snippet of example code to work, please show me the exact syntax. I've spent days trying to get this to work and no matter what I've tried, I've been forced to manually press the OK button. -
Anonymous Javascript Alert OK Button Press?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
So I've stumped everyone with this? -
Anonymous Javascript Alert OK Button Press?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
I can't post the website nor the 2500 lines of code as it is a confidential intranet application. I have made a brand new test html and au3 to illustrate the problem. Here is the alert.html... <html> <body> <form> <textarea id="mytextarea" name="mytextarea" onfocus="javascript:alert('too much text')"" onchange="javascript:alert('too much text')" onkeypress="javascript:alert('too much text')"></textarea> </form> </body> </html> Here is the alert.au3... #include "IE.au3" Dim $oIE _IEAttach ($oIE) If Not IsObj($oIE) Then $oIE = _IECreate () _IENavigate ($oIE, "http://localhost/alert.html") EndIf $HWND = _IEPropertyGet($oIE, "HWND") WinSetState($HWND, "", @SW_MAXIMIZE) $o_form = _IEFormGetCollection ($oIE, 0) $o_name = _IEFormElementGetObjByName($o_form, "mytextarea") _IELoadWait($oIE, 5000) AdlibRegister("Popup") _IEFormElementSetValue($o_name, "x") AdlibUnRegister() msgbox(0,"","After popup manually pressed") Func Popup() If WinActive("", "too much text") Then WinClose("", "too much text") EndIf EndFunc -
Anonymous Javascript Alert OK Button Press?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
Tried without the msg as well - doesn't kill the popup either. -
Anonymous Javascript Alert OK Button Press?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
I was hopeful but no such luck. I tried AdlibRegister and the function does not get called until after I manually press the OK button on the alert. Here's the bare bones relevant code that I tried: ... $o_form = _IEFormGetCollection ($oIE, 0) $o_name = _IEFormElementGetObjByName($o_form, "myTextArea") AdlibRegister("Popup") _IEFormElementSetValue($o_name, "way more than 500 characters...") AdlibUnRegister() ... Func Popup() msgbox(0,"was called","was called to kill popup") If WinActive("", "Cannot exceed 500 characters.") Then WinClose("", "Cannot exceed 500 characters.") EndIf EndFunc ... When I run that, I get my popup, I manually press OK and THEN I'm greeted by the msg from the Popup function. -
Anonymous Javascript Alert OK Button Press?
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
Yes, I have the text of the alert. It looks good but the problem remains that how do I get it to be running so that the alert can be dismissed? As soon as the alert happens (which I trigger (by populating an IE textarea with too much text on purpose as a test), the script stops completely so that code would not be executed. I saw an example using AdlibEnable that looked promising but that function was discontinued in a previous version of AutoIt. I know I would need to have a timed loop of your 3 lines of code already running before the alert happens. How? -
I have gone through so many pages of suggestions but none seem to work for me. I have a page which triggers an alert but has no name for the alert. It's just the default "Windows Internet Explorer" window title and my statement of "Cannot exceed 500 characters." and an OK button. No, I cannot change the application code to give it a title. Of course my script grinds to a screeching halt when it gets to that alert since I can't get access to it to click the OK button. ControlClick needs a window title so I don't think I can get that to work or maybe I haven't tried the right configuration. MouseClick does not run until after I manually press the OK button and my script will then resume. I'd rather not hardcode coordinates for the mouseclick if I can programmatically access that pesky little OK button to click it. Does anyone have a way to fix this?
-
AutoIt & IE - Can't trigger ondlbclick
MaritimeGirl replied to MaritimeGirl's topic in AutoIt General Help and Support
Hmm... turns out after some digging into the IE.au3 source file, dblclick isn't supported yet so I'll try to add it myself. (While neither pretty nor efficient, I can trigger the double click by determining the x,y coordinates of the element I need to have doubleclicked, then perform MouseClick("left", x, y) twice. At least I'm not hardcoding the coordinates.)