-
Posts
101 -
Joined
-
Last visited
Everything posted by Graeme
-
"JSON UDF in pure AutoIt" and array count
Graeme replied to Sascha's topic in AutoIt General Help and Support
I may have found the issue. I decided to run the file with a different executable, one that I have recently compiled and this worked. So the problem seems to be in AutoIT3.exe handling Maps..... MsgBox(0,"",Run('U:\Settings\QuickAccess\OpenWebLink64.exe "U:\Documents\z Graeme and Helen\QA Files\QuickAccess3.0\TestJSON.a3x"')) I don't know if this means that something in AutoIT3.exe needs to be updated but I can't use that because the AutoIT3.exe is already deployed over how ever many of the company are using the program - I'll have to move away from using AutoIt3.exe to run a3x files as I see it. -
"JSON UDF in pure AutoIt" and array count
Graeme replied to Sascha's topic in AutoIt General Help and Support
OK. I got a bit involved with other things. Here is the parred down script with all the stuff that was commented out before, gone. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_type=a3x #AutoIt3Wrapper_Outfile=U:\Documents\z Graeme and Helen\QA files\QuickAccess3.0\TestJSON.a3x #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #comments-start Title : Test Author : Graeme Desc : Test JSON Udf #comments-end #include <json.au3> $ScriptDrive = "U:\" If FileExists($ScriptDrive & "Settings\Edge\Default\Preferences") Then Dim $Fields[6] = ["local_browser_data_share.enabled","download.default_directory","savefile.default_directory", _ "third_party_search.consented","user_experience_metrics.personalization_data_consent_enabled","ntp.enable_prerender"] ;$Fields are the values that we want to verify $Changed = False $Data = FileRead($ScriptDrive & "Settings\Edge\Default\Preferences") $oObject = _JSON_Parse($Data) For $R = 0 To UBound($Fields) - 1 $Setting = _JSON_Get($oObject, "." & $Fields[$R]) If $R > 0 and $R < 3 Then If MsgBox(1,$Fields[$R],$Setting) = 2 Then Exit EndIf If StringInStr($Fields[$R],"Default_directory") = 0 Then If $Setting <> "False" Then _JSON_addChangeDelete($oObject,$Fields[$R],"False") $Changed = True EndIf Else If StringLeft($Setting,3) <> $ScriptDrive Then _JSON_addChangeDelete($oObject,$Fields[$R],$ScriptDrive & "Downloads") $Changed = True EndIf EndIf Next If $Changed Then; Update the Preferences File MsgBox(0,"","Changed " & _JSON_Get($oObject,"." & $Fields[1])) $success = 1 $hFile = FileOpen($ScriptDrive & "Settings\Edge\Default\Preferences",2) $result = FileWriteLine($hFile,_JSON_GenerateCompact($oObject)) If $result <> $success Then MsgBox(0,"ERROR","The file write didn't happen!" & @CRLF & FileGetAttrib($ScriptDrive & "Settings\Edge\Default\Preferences")) FileClose($hFile) MsgBox(0,"",$result) EndIf EndIf As I said I compiled this as an a3x file and ran it with this line.. MsgBox(0,"",Run('C:\Program Files\Qa\Autoit3.exe "U:\Documents\z Graeme and Helen\QA Files\QuickAccess3.0\TestJSON.a3x"')) It ran and I got this error. I inserted msgbox lines before and after the line that had always given issues like this in the UDF if MsgBox(1,"","Before line" & @CRLF & $s_String) = 2 Then Exit Local $o_Current[] If MsgBox(1,"","After line") = 2 Then Exit I got the first msgbox with the contents of the preferences file as expected then this. Here is the console output to show versions of AutoIT3 etc >"C:\Program Files (x86)\AutoIT3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIT3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "U:\Documents\z Graeme and Helen\QA files\QuickAccess3.0\Test.au3" /UserParams +>09:52:58 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000809 OS:WIN_11/2009 CPU:X64 OS:X64 Environment(Language:0809) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper >Running AU3Check (3.3.16.1) from:C:\Program Files (x86)\AutoIt3 input:U:\Documents\z Graeme and Helen\QA files\QuickAccess3.0\Test.au3 +>09:52:58 AU3Check ended.rc:0 >Running:(3.3.16.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "U:\Documents\z Graeme and Helen\QA files\QuickAccess3.0\Test.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. -
"JSON UDF in pure AutoIt" and array count
Graeme replied to Sascha's topic in AutoIt General Help and Support
That line is in the UDF... That's why I'm asking how this could be fixed... It looks like there's a problem with the UDF. That the script runs into. -
"JSON UDF in pure AutoIt" and array count
Graeme replied to Sascha's topic in AutoIt General Help and Support
OK so I compiled the above script as a3x x64 and ran it with the AutoIT3.exe as normal and it crashed with the same error message. I inserted a couple of msgboxes into the UDF to confirm that the line when this happens is Local $o_Current[] I tried compiling as x86 and got the same error message -
"JSON UDF in pure AutoIt" and array count
Graeme replied to Sascha's topic in AutoIt General Help and Support
It's true that it may be running in x86 but compiled in x64. How would that make it crash and if so how could I get around it. It's true that the test script I mentioned was in x86 and the script that crashed was in x64..... The JSON file was the preferences file for Edge. The test script: $ScriptDrive = "U:\" If FileExists($ScriptDrive & "Settings\Edge\Default\Preferences") Then Dim $Fields[6] = ["local_browser_data_share.enabled","download.default_directory","savefile.default_directory", _ "third_party_search.consented","user_experience_metrics.personalization_data_consent_enabled","ntp.enable_prerender"] ;$Fields are the values that we want to verify $Changed = False $Data = FileRead($ScriptDrive & "Settings\Edge\Default\Preferences") $oObject = _JSON_Parse($Data) For $R = 0 To UBound($Fields) - 1 $Setting = _JSON_Get($oObject, "." & $Fields[$R]) If $R > 0 and $R < 3 Then If MsgBox(1,$Fields[$R],$Setting) = 2 Then Exit EndIf If StringInStr($Fields[$R],"Default_directory") = 0 Then If $Setting <> "False" Then _JSON_addChangeDelete($oObject,$Fields[$R],"False") $Changed = True EndIf Else If StringLeft($Setting,3) <> $ScriptDrive Then _JSON_addChangeDelete($oObject,$Fields[$R],$ScriptDrive & "Downloads") $Changed = True EndIf EndIf Next If $Changed Then; Update the Preferences File MsgBox(0,"","Changed " & _JSON_Get($oObject,"." & $Fields[1])) $success = 1 $hFile = FileOpen($ScriptDrive & "Settings\Edge\Default\Preferences",2) $result = FileWriteLine($hFile,_JSON_GenerateCompact($oObject)) If $result <> $success Then MsgBox(0,"ERROR","The file write didn't happen!" & @CRLF & FileGetAttrib($ScriptDrive & "Settings\Edge\Default\Preferences")) FileClose($hFile) MsgBox(0,"",$result) EndIf EndIf -
"JSON UDF in pure AutoIt" and array count
Graeme replied to Sascha's topic in AutoIt General Help and Support
Sorry to be dumb, but I thought I was on the latest version (3.3.16.1). Also that wouldn't explain why it crashed when compiled and not when run precompile. In addition, I've compiled a short script that just does the _JSON_Parse and it doesn't crash. I just can't make sense of it at all. I don't know why that line would crash. -
"JSON UDF in pure AutoIt" and array count
Graeme replied to Sascha's topic in AutoIt General Help and Support
I want to analyse Thunderbird json files and I just started using this UDF. However when I finally ran the program I had a weird error. When I run my program uncompiled everything works but as soon as I compile the program and run it, it crashes on this line: Local $o_Current[] It says array badly formatted. Does this mean that the JSON file is not correctly formatted? But why does it work uncompiled. I don't understand the code enough to figure out what is happening. Any help gratefully received. -
iniread with accents (non English strings) - (Moved)
Graeme replied to Graeme's topic in AutoIt General Help and Support
I tried running a program compiled before I updated to 3.3.16.0 and that read the inifile correctly with the accents. However I went back to 3.3.14.2 which is the version I was using and restarted my computer and it still shows as above. -
I have a script that uses GUIs and iniread to create labels in given languages, French, German and Korean for example. I have just realised that after the update to 3.3.16.0 the script no longer reads non English strings correctly. This GUI used to show as as Mettre à jour and Masquer la fênetre. Is there a way of correcting this with an option or something?
-
I have created a GUICtrlInput and it works well. My problem is that I wanted to allow for the user to input an addition which would take more characters than the length of the input but would resolve to less characters when the GUI is exited. Like 190000 + 200000+ 30000 I don't want to increase the size of the ctrl input. Is there a way of getting the input to accept more characters? I tried making it multiline and I tried a CtrlEdit but both gave the same problem. It seems that it may be possible to do it if I take off the SS_RIGHT or the ES_ MULTILINE. Is it possible to still have option to go beyond the limit of the input and have SS_RIGHT and ES_ Multiline?
-
When I installed version 3.3.16 I asked that scripts that I click on open. But ever since then I have been unable to open them from File explorer. They run. I have tried opening them with SciTE as well but that didn't work. I have a work around, I have a script that I already use to open a specific group of scripts and so I open that and manage file open to open the other script. My second problem is more difficult. When I run a script in SciTE if I right click on the notification button it gives me the option of Exit but although the icon disappears from the notification area the script keeps running and the only way to stop it is with Task Manager and that not only stops the script but it closes SciTE as well. Any help would be appreciated.:) Blessings
-
$guiTestWindow = GUICreate("Test Window", $MainWindowSize, 280 + $DepthBanner) GUISetFont($MainFont) $Banner = GUICtrlCreateButton($a[0],10,185 * $MagnificationHeight,$MainWindowSize - 15,$DepthBanner * $Magnification,$BS_MULTILINE, $WS_EX_DLGMODALFRAME) GUICtrlSetBkColor(-1,0xff9900) ;GUICtrlSetStyle(-1,$BS_VCENTER + $BS_MULTILINE) GUISetState(@SW_SHOW,$guiTestWindow) While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(50) WEnd If I run the above script with the fifth line commented out as it is I get the button with the right bkcolor but the text is at the top of the button. If I include the fifth line I get the text centered but I lose the color. Is it possible to get both?
-
I noticed that there is a reference to maps in the AutoIT help file and tried to implement it. It failed at the first hurdle. In the help file it says to set up a map you put something like local $mdata[] I did this in my script and got the error message "U:\Documents\.....\Test.au3" (262) : ==> Variable subscript badly formatted.: Local $LanguageText[] Local $LanguageText[^ ERROR Blessings
-
I have a program that looks at the detail of several webpages to find the latest version of programs downloadable from those pages. I use _inetGetSource($Url) For the last few days it has been getting nothing from one particular website. I tried inetread and both these function produce the error 1. I tried inetget and this was able to get the source but it had to save it somewhere. Does anyone know why this website is producing these errors and what can be done to avoid this?
-
_INETGetSource gives blank result
Graeme replied to Graeme's topic in AutoIt General Help and Support
Thanks for this. Funny thing is that the site seems to be returning normal values now.:) -
I run MsgBox(0,"",_INetGetSource("https://curl.haxx.se/download.html",True)) And the result is blank. I replace the url with other urls and I get info. I open the given url with FIrefox and I get a webpage and I look at the source and I see stuff, lots of it. Why does _INETGetSource give me a blank return?
-
I decided to compile and run the script. I got a message that the script couldn't be found but it was in a green border. This made me look at my AV and sure enough somehow, it had gotten auto-containment turned on and that was causing the problem. Everything is working as normal now. I'd still like to know how we find the meanings of the AutoIT.exe error codes....
-
It also looks to me as though the rc 259 is the exit code of Autoit3.exe but that autoitwrapper is the process that is still running and I can't change that, can I? I've just noticed that when I use Cntrl Break to stop the process that is stuck I get >Exit code: 259 Time: 34.14 So it appears that AutoIT3 is passing the error message to AutoWrapper but AutoWrapper is sending the message to console that it is finished but it doesn't stop... Blessings Graeme
-
I thought exit codes, if not 0, were error codes? Also the line with rc 259 is in RED and preceded by an exclamation mark... Sounds like at least a warning. I put a msgbox in the first line and it didn't run... any ideas about what kind of debugging line might help? Blessings Graeme
-
Note that in the second case there is no exit code and in fact I have to manually stop execution to get any further... to be able to run or compile anything else.:( Thanks for any help that you can give me. Blessings Graeme
-
No, I want to know what the error message means. If I run my script as it was... I get the following on my console. >"C:\Program Files (x86)\AutoIT3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIT3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "U:\Documents\ xxxxxxxx\QACPrep3.1.au3" /UserParams +>17:25:15 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0 Keyboard:00000809 OS:WIN_81/ CPU:X64 OS:X64 Environment(Language:0809) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper ! Your script requires Admin rights while SciTE is running at normal level. ! This means no Console output from the script will be displayed and SciTE will show the script as ended right away. >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:U:\Documents\xxxxxx\QACPrep3.1.au3 +>17:25:15 AU3Check ended.rc:0 >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "U:\Documents\xxxxx\QACPrep3.1.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop +>17:25:18 AutoIt3.exe ended.rc:0 +>17:25:18 AutoIt3Wrapper Finished. >Exit code: 0 Time: 4.392 If I save it with another name I get a different console result .. >"C:\Program Files (x86)\AutoIT3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIT3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "U:\Documents\xxxxx\QuickAccess2.5.1\QACPrep3.3.au3" /UserParams +>17:29:19 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0 Keyboard:00000809 OS:WIN_81/ CPU:X64 OS:X64 Environment(Language:0809) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper ! Your script requires Admin rights while SciTE is running at normal level. ! This means no Console output from the script will be displayed and SciTE will show the script as ended right away. >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:U:\Documents\xxxxx\QACPrep3.3.au3 +>17:29:19 AU3Check ended.rc:0 >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "U:\Documents\xxxxxx\QACPrep3.3.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop !>17:29:19 AutoIt3.exe ended.rc:259 +>17:29:19 AutoIt3Wrapper Finished. What does the result 259 mean - how can I begin figuring out why it won't run... Can you give me any ideas?
-
I'm trying to run an au3 file and it won't. AutoIT3.exe stops with rc:259 To do anything I have to go into Tools and stop executing. I can compile the file... What does RC:259 mean? I can't post the entire file and autoit3 gives no idea what the error is... I looked for the RC:259 and found one entry from many years ago. Graeme
-
How to knowl if a script was run as administrator
Graeme replied to Darien's topic in AutoIt General Help and Support
Thanks Earthshine but the problem is that there are two users. When you call #requireadmin the system closes the process and opens a new one in the user admin which has admin rights... I want to know about the first user, not the second..:( -
How to knowl if a script was run as administrator
Graeme replied to Darien's topic in AutoIt General Help and Support
What I actually want to test is whether the user has admin rights... From what I've seen before, as soon as I run a script with #requireadmin, the user for that instance is admin and so has admin rights.. What I want to know is whether the user who started the script had admin rights... -
How to knowl if a script was run as administrator
Graeme replied to Darien's topic in AutoIt General Help and Support
Sounds good.... However the program is testing all kinds of things in a computer to make sure it's ready for company business. So I put all the results from the tests in a splash text... I want to say, Yes or No that the account that started the script has admin rights... can the script tell if the UAC was invoked??? The user can tell and in a way I'm happy with that but it would be nice if the script could as well..