Leaderboard
Popular Content
Showing content with the highest reputation on 09/05/2017 in all areas
-
Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^1 point
-
Help file doesn't seems to have an example for _WinAPI_WaitForSingleObject Below a simple adaptation from the _WinAPI_FindNextChangeNotification help example (also posted in the russian forum) i'm using something similar as a way of data transfer between computers having a shared folder #include <WinAPIEx.au3> Local Const $g_sPath = @ScriptDir Global $hDir = _WinAPI_FindFirstChangeNotification($g_sPath, $FILE_NOTIFY_CHANGE_LAST_WRITE) Local $iID, $bBoolean = False While 1 Sleep(1000) ;Adapted from Help File example for _WinAPI_FindFirstChangeNotification function ;My tests without the second parameter seems to have the issue 'can't exit normally' described here: ;https://www.autoitscript.com/forum/topic/180602-readdirectorychangesw-exit/ $iID = _WinAPI_WaitForSingleObject($hDir, 0) Switch $iID Case 0 ; WAIT_OBJECT_0 If $bBoolean = True Then $bBoolean = False Else $bBoolean = True ConsoleWrite('A file was changed in the directory.' & @CRLF) Beep(400,50) EndIf Case Else ContinueLoop EndSwitch If Not _WinAPI_FindNextChangeNotification($hDir) Then MsgBox(0, 'Error', 'Unexpected error.') Exit EndIf WEnd Func OnAutoItExit() _WinAPI_FindCloseChangeNotification($hDir) ConsoleWrite('Bye-bye!' & @CRLF) EndFunc For those interested in the data transfer application, this is what i'm using: Main.au3 #pragma compile(AutoItExecuteAllowed, True) #include <WinAPIEx.au3> ;test directory: Global Const $g_sPath = "C:\Documents and Settings\XP\Escritorio\InterPC\bridge" Global $hDir = _WinAPI_FindFirstChangeNotification($g_sPath, $FILE_NOTIFY_CHANGE_LAST_WRITE) Global $sFileRead Local $aArray Local $iID, $bBoolean = False While 1 Sleep(1000) $iID = _WinAPI_WaitForSingleObject($hDir, 0) Switch $iID Case 0 ; WAIT_OBJECT_0 If $bBoolean = True Then $bBoolean = False Else $bBoolean = True ;ConsoleWrite('A file was changed in the directory.' & @CRLF) ReadLine() ;_RunAU3(".\scripts\AU3_Example.au3", $sFileRead, "", @SW_SHOW, 8) ;in $sFileRead there is a string with this format: AU3_Example.au3|parameter1 'parameter 2' ""parameter 3"" $aArray = StringSplit($sFileRead, "|") _RunAU3(".\scripts\" & $aArray[1], $aArray[2], "", @SW_SHOW, 8) EndIf Case Else ContinueLoop EndSwitch If Not _WinAPI_FindNextChangeNotification($hDir) Then MsgBox(0, 'Error', 'Unexpected error.') Exit EndIf WEnd Func OnAutoItExit() _WinAPI_FindCloseChangeNotification($hDir) ;ConsoleWrite('Bye-bye!' & @CRLF) EndFunc Func ReadLine() Local Const $sFilePath = $g_sPath & "\line.txt" ;Open the file for reading and store the handle to a variable. Local $hFileOpen = FileOpen($sFilePath, $FO_READ) If $hFileOpen = -1 Then MsgBox(0, "", "An error occurred when reading the file.") Return False EndIf ;Read the fist line of the file using the handle returned by FileOpen. $sFileRead = FileReadLine($hFileOpen, 1) ;Close the handle returned by FileOpen. FileClose($hFileOpen) ;Display the first line of the file. ;MsgBox($MB_SYSTEMMODAL, "", $sFileRead) EndFunc ;https://www.autoitscript.com/forum/topic/135203-call-another-script/?do=findComment&comment=943199 ;guinness Func _RunAU3($sFilePath, $sParamet="", $sWorkingDir = "", $iShowFlag = @SW_SHOW, $iOptFlag = 0) Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '" "' & $sParamet & '"', $sWorkingDir, $iShowFlag, $iOptFlag) ;Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '"' & ' "Bos Días"', $sWorkingDir, $iShowFlag, $iOptFlag) EndFunc ;==>_RunAU3 UPDATE: I'm finally using a slightly different version of the 'Main' script. It seems more simple: without the boolean variable: #pragma compile(AutoItExecuteAllowed, True) ;#pragma compile(Icon, local_gray.ico) #include <WinAPIEx.au3> #include <Misc.au3> If _Singleton("test", 1) = 0 Then Msgbox(48,"Warning","already running." & @LF & "This instance will close.", 5) Exit EndIf OnAutoItExitRegister("OnAutoItExit") Global $g_sPath, $sFileRead, $aArray, $iID $g_sPath = "C:\Documents and Settings\XP\Escritorio\InterPC\bridge" Global $hDir = _WinAPI_FindFirstChangeNotification($g_sPath, $FILE_NOTIFY_CHANGE_LAST_WRITE) While 1 Sleep(500) CheckFile() WEnd Func CheckFile() $iID = _WinAPI_WaitForSingleObject($hDir, 0) If $iID = 0 Then ; WAIT_OBJECT_0 ;ConsoleWrite('A file was changed in the directory.' & @CRLF) Local $sFilePath = $g_sPath & "\line.txt" ;Open the file for reading and store the handle to a variable. Local $hFileOpen = FileOpen($sFilePath, $FO_READ) If $hFileOpen = -1 Then MsgBox(0, "", "An error occurred when reading the file.") Return False EndIf ;Read the fist line of the file using the handle returned by FileOpen. $sFileRead = FileReadLine($hFileOpen, 1) ;Close the handle returned by FileOpen. FileClose($hFileOpen) ;_RunAU3(".\scripts\AU3_Example.au3", $sFileRead, @ScriptDir, @SW_SHOW, 8) ;in $sFileRead there is a string with this format: AU3_Example.au3|parameter1 'parameter 2' ""parameter 3"" $aArray = StringSplit($sFileRead, "|") _RunAU3(".\scripts\" & $aArray[1], $aArray[2], @ScriptDir, @SW_SHOW, 8) ;SoundPlay(@WindowsDir & "\media\tada.wav", 0) ; Chimes.wav EndIf If Not _WinAPI_FindNextChangeNotification($hDir) Then MsgBox(48, 'Error', 'Bridge folder not found: revise settings.ini') Exit EndIf EndFunc ;https://www.autoitscript.com/forum/topic/135203-call-another-script/?do=findComment&comment=943199 ;guinness Func _RunAU3($sFilePath, $sParamet="", $sWorkingDir = "", $iShowFlag = @SW_SHOW, $iOptFlag = 0) Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '" "' & $sParamet & '"', $sWorkingDir, $iShowFlag, $iOptFlag) ;Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '"' & ' "Bos Días"', $sWorkingDir, $iShowFlag, $iOptFlag) EndFunc ;==>_RunAU3 Func OnAutoItExit() _WinAPI_FindCloseChangeNotification($hDir) EndFunc 'bridge' is the folder being monitored, and 'scripts' is another folder containing the scripts to execute when a change is detected Here an example in the scripts folder: AU3_Example.au3 MsgBox(0, "It Works", "Hello World, " & $CmdLine[1]) ConsoleWrite("Hello World from ConsoleWrite!, " & $CmdLine[1]) This is an example of an UPDATE statement with a MS ACCESS database in the server computer using the ADODB command method ;Help: COM Error Handling Global $errADODB = ObjEvent("AutoIt.Error","_ErrADODB") If $CmdLine[0] = 0 Then Exit ;there is no parameter passed to the executable Local $sFilename = "_____" Global Const $iCursorType = 0 ; adOpenForwardOnly Global Const $iLockType = 1 ;1 adLockReadOnly, 3 adLockOptimistic Global Const $iOptions = 1 ; Options, 1 Evaluates as a textual definition of a command or stored procedure call ; 2 adCmdTable Global $cn = ObjCreate("ADODB.Connection") ; Create a connection object ;Global $sADOConnectionString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $sFilename Global $sADOConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & $sFilename & ";Jet OLEDB:Database Password=___;" $cn.Open($sADOConnectionString) ; Open the connection Global $cmd = ObjCreate("ADODB.Command") $cmd.ActiveConnection = $cn Global $sSQL = $CmdLine[1] $cmd.CommandText = $sSQL $cmd.CommandType = 1 ;adCmdText ;https://www.w3schools.com/asp/ado_ref_command.asp ;https://www.autoitscript.com/forum/topic/80351-adodb-command-method/ $cmd.Execute(Default,Default, 0x80) $cmd = 0 $cn.Close ; Close the connection $cn = 0 ; Release the connection object Func _ErrADODB() Msgbox(0,"ADODB COM Error","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $errADODB.description & @CRLF & _ "err.windescription:" & @TAB & $errADODB.windescription & @CRLF & _ "err.number is: " & @TAB & hex($errADODB.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $errADODB.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $errADODB.scriptline & @CRLF & _ "err.source is: " & @TAB & $errADODB.source & @CRLF & _ "err.helpfile is: " & @TAB & $errADODB.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $errADODB.helpcontext _ ) Local $err = $errADODB.number If $err = 0 Then $err = -1 EndFunc An example of a SELECT query, saving the recordset as xml in a shared folder ;Help: COM Error Handling Global $errADODB = ObjEvent("AutoIt.Error","_ErrADODB") If $CmdLine[0] = 0 Then Exit ;there is no parameter passed to the executable Local $sFilename = "_somepath_\MyDataBase.mdb" Local $sFilename2 = "_somepath_\InterPC\out\example.xml" FileDelete($sFilename2) Global Const $iCursorType = 0 ; adOpenForwardOnly Global Const $iLockType = 1 ;1 adLockReadOnly, 3 adLockOptimistic Global Const $iOptions = 1 ; Options, 1 Evaluates as a textual definition of a command or stored procedure call ; 2 adCmdTable Global $cn = ObjCreate("ADODB.Connection") ; Create a connection object Global $rst = ObjCreate("ADODB.Recordset") ; Create a recordset object ;Global $sADOConnectionString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $sFilename Global $sADOConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & $sFilename & ";Jet OLEDB:Database Password=__;Mode=Read" $cn.Open($sADOConnectionString) ; Open the connection Local $sSQL = "SELECT ____" _ & " FROM __" _ & " WHERE " & $CmdLine[1] _ & " ORDER BY __;" $rst.Open($sSQL, $cn, $iCursorType, $iLockType, $iOptions) ; Issue the SQL query $rst.Save($sFilename2, 1) $rst.Close $rst = 0 ; Release the recordset object $cn.Close ; Close the connection $cn = 0 ; Release the connection object Func _ErrADODB() Msgbox(0,"ADODB COM Error","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $errADODB.description & @CRLF & _ "err.windescription:" & @TAB & $errADODB.windescription & @CRLF & _ "err.number is: " & @TAB & hex($errADODB.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $errADODB.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $errADODB.scriptline & @CRLF & _ "err.source is: " & @TAB & $errADODB.source & @CRLF & _ "err.helpfile is: " & @TAB & $errADODB.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $errADODB.helpcontext _ ) Local $err = $errADODB.number If $err = 0 Then $err = -1 EndFunc Finally an example of an INSERT query: ;Help: COM Error Handling Global $errADODB = ObjEvent("AutoIt.Error","_ErrADODB") If $CmdLine[0] = 0 Then Exit ;there is no parameter passed to the executable Local $aArray $aArray = StringSplit($CmdLine[1], Chr(1)) Local $sSQL, $IdCab, $sYear $sYear = @YEAR Global Const $iCursorType = 0 ; adOpenForwardOnly, 3 adOpenStatic Global Const $iLockType = 3 ;1 adLockReadOnly, 3 adLockOptimistic Global Const $iOptions = 1 ; Options, 1 Evaluates as a textual definition of a command or stored procedure call ; 2 adCmdTable Global $cn = ObjCreate("ADODB.Connection") ; Create a connection object Global $rst = ObjCreate("ADODB.Recordset") ; Create a recordset object ;Global $sADOConnectionString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $sFilename ;Global $sADOConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & $sFilename & ";Jet OLEDB:Database Password=__" $cn.CursorLocation = 3 ; adUseClient $cn.Open($aArray[1]) ; Open the connection ;this ok ;$sSQL = "CREATE TABLE AutoIncrementTest " _ ; & "(ID int identity, Description varchar(40), " _ ; & "CONSTRAINT AutoIncrementTest_PrimaryKey PRIMARY KEY (ID))" ;$cn.Execute($sSQL, Default, 1 + 0x80) ;adCmdText = 1 , adExecuteNoRecords = 0x80 ;this ok ;Global $cmd = ObjCreate("ADODB.Command") ;$cmd.ActiveConnection = $cn ;$cmd.CommandText = $sSQL ;$cmd.CommandType = 1 ;adCmdText ;https://www.w3schools.com/asp/ado_ref_command.asp ;https://www.autoitscript.com/forum/topic/80351-adodb-command-method/ ;$cmd.Execute(Default,Default, 1 + 0x80) $sSQL = "SELECT MAX(Val(SOMEFIELD)) FROM SOMETABLE" $rst.Open($sSQL, $cn, $iCursorType, $iLockType, $iOptions) ; Issue the SQL query Local $CodAlb = StringFormat("%06i", $rst(0).Value + 1) ;MsgBox(0,"","New code Nº: " & $CodAlb) $rst.Close ;$sSQL = "SELECT ID, Description FROM AutoIncrementTest" $sSQL = "SELECT ID, YEAR, FIELD2, FIELD3, ____________ FROM MYTABLE" $rst.Open($sSQL, $cn, $iCursorType, $iLockType, $iOptions) ; Issue the SQL query $cn.BeginTrans $rst.AddNew ;$rst("Description").Value = "AutoIncrement Test" ;$rst.Fields("Description") = "AutoIncrement Test" $rst("YEAR").Value = $sYear $rst("CODIGO").Value = $CodAlb $rst("FIELD2").Value = $aArray[2] $rst("FIELD3").Value = $aArray[5] ;... $rst.Update $IdCab = $rst(0).Value ;MsgBox(0,"","New Auto-increment value is: " & $IdCab) $rst.Close $sSQL = "UPDATE OTHERTABLE SET SOMEFIELD = " & $aArray[15] & " WHERE LINEASPEDIDO.ID = " & $aArray[14] $cn.Execute($sSQL, Default, 1 + 0x80) ;adCmdText = 1 , adExecuteNoRecords = 0x80 $cn.CommitTrans ;$cmd = 0 $rst = 0 ; Release the recordset object $cn.Close ; Close the connection $cn = 0 ; Release the connection object Func _ErrADODB() Msgbox(0,"ADODB COM Error","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $errADODB.description & @CRLF & _ "err.windescription:" & @TAB & $errADODB.windescription & @CRLF & _ "err.number is: " & @TAB & hex($errADODB.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $errADODB.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $errADODB.scriptline & @CRLF & _ "err.source is: " & @TAB & $errADODB.source & @CRLF & _ "err.helpfile is: " & @TAB & $errADODB.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $errADODB.helpcontext _ ) Local $err = $errADODB.number If $err = 0 Then $err = -1 EndFunc1 point
-
Hi @rootx. I'm not 100% sure i know what you mean by filter. here's the code with what i understood it as. #cs <?xml version="1.0" encoding="UTF-8"?> <GeocodeResponse> <status>OK</status> <result> <type>street_address</type> <formatted_address>Via Canavelle, 6, 17019 Varazze SV, Italien</formatted_address> <address_component> <long_name>6</long_name> <short_name>6</short_name> <type>street_number</type> </address_component> <address_component> <long_name>Via Canavelle</long_name> <short_name>Via Canavelle</short_name> <type>route</type> </address_component> <address_component> <long_name>Varazze</long_name> <short_name>Varazze</short_name> <type>locality</type> <type>political</type> </address_component> <address_component> <long_name>Varazze</long_name> <short_name>Varazze</short_name> <type>administrative_area_level_3</type> <type>political</type> </address_component> <address_component> <long_name>Provincia di Savona</long_name> <short_name>SV</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>Liguria</long_name> <short_name>Liguria</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Italien</long_name> <short_name>IT</short_name> <type>country</type> <type>political</type> </address_component> <address_component> <long_name>17019</long_name> <short_name>17019</short_name> <type>postal_code</type> </address_component> <geometry> <location> <lat>44.3816280</lat> <lng>8.5732980</lng> </location> <location_type>ROOFTOP</location_type> <viewport> <southwest> <lat>44.3802790</lat> <lng>8.5719490</lng> </southwest> <northeast> <lat>44.3829770</lat> <lng>8.5746470</lng> </northeast> </viewport> </geometry> <place_id>ChIJBbaJyAEi0xIRvw7CuvuWSAk</place_id> </result> <result> <type>locality</type> <type>political</type> <formatted_address>17019 Varazze, Savona, Italien</formatted_address> <address_component> <long_name>Varazze</long_name> <short_name>Varazze</short_name> <type>locality</type> <type>political</type> </address_component> <address_component> <long_name>Varazze</long_name> <short_name>Varazze</short_name> <type>administrative_area_level_3</type> <type>political</type> </address_component> <address_component> <long_name>Savona</long_name> <short_name>SV</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>Ligurien</long_name> <short_name>Ligurien</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Italien</long_name> <short_name>IT</short_name> <type>country</type> <type>political</type> </address_component> <address_component> <long_name>17019</long_name> <short_name>17019</short_name> <type>postal_code</type> </address_component> <geometry> <location> <lat>44.3594336</lat> <lng>8.5773126</lng> </location> <location_type>APPROXIMATE</location_type> <viewport> <southwest> <lat>44.3479178</lat> <lng>8.5537618</lng> </southwest> <northeast> <lat>44.3836989</lat> <lng>8.6216356</lng> </northeast> </viewport> <bounds> <southwest> <lat>44.3479178</lat> <lng>8.5537618</lng> </southwest> <northeast> <lat>44.3836989</lat> <lng>8.6216356</lng> </northeast> </bounds> </geometry> <place_id>ChIJ5U2aabEY0xIRF7RN5OI8mC0</place_id> </result> <result> <type>administrative_area_level_3</type> <type>political</type> <formatted_address>17019 Varazze, Savona, Italien</formatted_address> <address_component> <long_name>Varazze</long_name> <short_name>Varazze</short_name> <type>administrative_area_level_3</type> <type>political</type> </address_component> <address_component> <long_name>Savona</long_name> <short_name>SV</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>Ligurien</long_name> <short_name>Ligurien</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Italien</long_name> <short_name>IT</short_name> <type>country</type> <type>political</type> </address_component> <address_component> <long_name>17019</long_name> <short_name>17019</short_name> <type>postal_code</type> </address_component> <geometry> <location> <lat>44.3890436</lat> <lng>8.5611142</lng> </location> <location_type>APPROXIMATE</location_type> <viewport> <southwest> <lat>44.3479178</lat> <lng>8.5128981</lng> </southwest> <northeast> <lat>44.4343216</lat> <lng>8.6331957</lng> </northeast> </viewport> <bounds> <southwest> <lat>44.3479178</lat> <lng>8.5128981</lng> </southwest> <northeast> <lat>44.4343216</lat> <lng>8.6331957</lng> </northeast> </bounds> </geometry> <place_id>ChIJg2lMrUof0xIREoZS3Ai0BhI</place_id> </result> <result> <type>postal_code</type> <formatted_address>17019 Varazze, Savona, Italien</formatted_address> <address_component> <long_name>17019</long_name> <short_name>17019</short_name> <type>postal_code</type> </address_component> <address_component> <long_name>Varazze</long_name> <short_name>Varazze</short_name> <type>administrative_area_level_3</type> <type>political</type> </address_component> <address_component> <long_name>Savona</long_name> <short_name>SV</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>Ligurien</long_name> <short_name>Ligurien</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Italien</long_name> <short_name>IT</short_name> <type>country</type> <type>political</type> </address_component> <geometry> <location> <lat>44.3890436</lat> <lng>8.5611142</lng> </location> <location_type>APPROXIMATE</location_type> <viewport> <southwest> <lat>44.3479420</lat> <lng>8.5128780</lng> </southwest> <northeast> <lat>44.4343450</lat> <lng>8.6331740</lng> </northeast> </viewport> <bounds> <southwest> <lat>44.3479420</lat> <lng>8.5128780</lng> </southwest> <northeast> <lat>44.4343450</lat> <lng>8.6331740</lng> </northeast> </bounds> </geometry> <place_id>ChIJW5QImx0i0xIRMEu3k4DmBRw</place_id> </result> <result> <type>administrative_area_level_2</type> <type>political</type> <formatted_address>Savona, Italien</formatted_address> <address_component> <long_name>Savona</long_name> <short_name>SV</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>Ligurien</long_name> <short_name>Ligurien</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Italien</long_name> <short_name>IT</short_name> <type>country</type> <type>political</type> </address_component> <geometry> <location> <lat>44.2887995</lat> <lng>8.2650580</lng> </location> <location_type>APPROXIMATE</location_type> <viewport> <southwest> <lat>43.9389590</lat> <lng>7.9774583</lng> </southwest> <northeast> <lat>44.5287488</lat> <lng>8.6709170</lng> </northeast> </viewport> <bounds> <southwest> <lat>43.9389590</lat> <lng>7.9774583</lng> </southwest> <northeast> <lat>44.5287488</lat> <lng>8.6709170</lng> </northeast> </bounds> </geometry> <place_id>ChIJ2yz67bv60hIR8H08R33mBQM</place_id> </result> <result> <type>administrative_area_level_1</type> <type>political</type> <formatted_address>Ligurien, Italien</formatted_address> <address_component> <long_name>Ligurien</long_name> <short_name>Ligurien</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Italien</long_name> <short_name>IT</short_name> <type>country</type> <type>political</type> </address_component> <geometry> <location> <lat>44.3167917</lat> <lng>8.3964938</lng> </location> <location_type>APPROXIMATE</location_type> <viewport> <southwest> <lat>43.7596721</lat> <lng>7.4948099</lng> </southwest> <northeast> <lat>44.6764264</lat> <lng>10.0710317</lng> </northeast> </viewport> <bounds> <southwest> <lat>43.7596721</lat> <lng>7.4948099</lng> </southwest> <northeast> <lat>44.6764264</lat> <lng>10.0710317</lng> </northeast> </bounds> </geometry> <place_id>ChIJtU8s2GUS0xIRkHw8R33mBQE</place_id> </result> <result> <type>country</type> <type>political</type> <formatted_address>Italien</formatted_address> <address_component> <long_name>Italien</long_name> <short_name>IT</short_name> <type>country</type> <type>political</type> </address_component> <geometry> <location> <lat>41.8719400</lat> <lng>12.5673800</lng> </location> <location_type>APPROXIMATE</location_type> <viewport> <southwest> <lat>35.4897000</lat> <lng>6.6267201</lng> </southwest> <northeast> <lat>47.0920000</lat> <lng>18.7975999</lng> </northeast> </viewport> <bounds> <southwest> <lat>35.4897000</lat> <lng>6.6267201</lng> </southwest> <northeast> <lat>47.0920000</lat> <lng>18.7975999</lng> </northeast> </bounds> </geometry> <place_id>ChIJA9KNRIL-1BIRb15jJFz1LOI</place_id> </result> </GeocodeResponse> #ce #include <File.au3> $xml = StringRegExp(FileRead(@ScriptFullPath), "(?s)#cs(.*?)#ce", 1)[0] Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.loadXML($xml) $status = $oXML.SelectSingleNode("//GeocodeResponse/status") If $status.text = "OK" Then $oNodes = $oXML.SelectNodes("//result") For $oNode In $oNodes ;<--------------------------------------------result $oChilds = $oNode.childNodes For $oChild In $oChilds ;"<---------------------------------- result child If $oChild.tagName = "address_component" Then $oType = $oChild.SelectSingleNode("./type") $oLong_name = $oChild.SelectSingleNode("./long_name") If IsObj($oType) And IsObj($oLong_name) Then ConsoleWrite($oType.text & " = " & $oLong_name.text & @CRLF) EndIf EndIf Next Next Else MsgBox("","","Error") EndIf1 point
-
... change your final checking loops like this: Local $bFound For $a = UBound($yArray) - 1 To 0 Step -1 $bFound = False For $b = 0 To UBound($xArray) - 1 If $yArray[$a][2] = $xArray[$b][2] Then $bFound = True ExitLoop EndIf Next If Not $bFound Then _ArrayDelete($yArray, $a) Next _ArrayDisplay($yArray, 'Array 2', '', 0, Default, 'Source inf|Source Path|GUID|DriverVer')1 point
-
Anyway whatever the number of eol white spaces a regular expression does the job $string = " sc marks:1 " & @crlf & @crlf $n = StringRegExp($string, '(\d+)\s*$', 1) If not @error Then Msgbox(0,"", $n[0])1 point
-
Sleep() count per day to run FileDelete()
KickStarter15 reacted to Melba23 for a topic
11 KickStarter15, I would use _DateDiff rather than Sleep - something like this (untested): #include <File.au3> #include <Date.au3> ; Use a HotKey to exit if necessary HotKeySet("{ESC}", "_Exit") $sFldr2 = "D:\Programs\Test\Temp\" ; Set values for today's date $sDay = @MDAY $sFormattedDate = _NowCalcDate() ; Start an infinte loop While 1 ; Check when day changes If $sDay <> @MDAY Then ; Reset stored day so we only check once a day $sDay = @MDAY ; Check if 10 days passed since last delete If _DateDiff("D", $sFormattedDate, _NowCalcDate()) > 10 Then ; If so then run the code FileDelete($sFldr2 & "*.*") Local $File = FileOpen("D:\Programs\Test\Temp.log", $FO_APPEND) FileWriteLine($File, '"Deleted files in Temp folder" ' & "on " & _DateTimeFormat(_NowCalc(), 2) &" at "& _NowTime()) FileClose($File) ; Reset the date so we wait for another 10 days $sFormattedDate = _NowCalcDate() EndIf EndIf WEnd Func _Exit() Exit EndFunc M231 point -
Hello all, I searched all over the place for example code that can return the HTTP Response/Status codes and couldn't find one anywhere. So.... I decided to write one myself. I hope a few others will find this helpful. Dim $objhttp Dim $httpstatus Dim $CheckHTTPStatus Dim $codetype Dim $strURL = "http://www.autoitscript.com/" CheckHttpStatus($strURL) Func CheckHttpStatus($strActlURL) $objhttp = ObjCreate("MSXML2.XMLhttp.3.0") $objhttp.Open("GET", $strActlURL, false) $objhttp.Send $httpstatus = $objhttp.Status If $httpstatus = "" Then $CheckHTTPStatus = "Error" Else $codetype = stringleft($httpstatus,1) If $codetype = 2 or $codetype = 3 Then $CheckHttpStatus = "Success" Else $CheckHttpStatus = "Error" EndIf EndIf EndFunc msgbox(0,"test",$httpstatus) Cheers! SJones1 point