Leaderboard
Popular Content
Showing content with the highest reputation on 01/22/2015 in all areas
-
From your example, it's going to fail for us, you only provided 1 entry. The return is the number of characters, then you ask it to search from that return on. Anyway.... The first regex works for me when I double your xml example. The ConsoleWrite(StringRegExp()) ... You know that it returns an array right? Offset doesn't apply to that for/loop because you're accessing the data directly from the array. So this should work if you're validating only: ConsoleWrite(StringRegExp($aArray[$i], '(?i)<published>(.*?)</published>', 0) & @CRLF)1 point
-
The last StringRegExp should return an array, not a string. You should use ConsoleWrite(StringRegExp($aArray[$i], '(?i)<published>(.*?)</published>', 1, $nOffset)[0]) instead, but in your case, $nOffset is out of range. I don't really understand why you want to use $nOffset for, but maybe this code would match with your need : Local $XML = FileRead(@ScriptDir & '\default.xml') Local $aArray = StringRegExp($XML, '(?s)<entry[^>]*>.*?</entry>', 3) If NOT @error Then For $i = 0 To UBound($aArray) - 1 $aPublisher = StringRegExp($aArray[$i], '(?i)<published>(.*?)</published>', 1) ConsoleWrite ( $aPublisher[0] ) Next EndIf1 point
-
Compiled Gui Restarts on exit on win8.1
MikahS reacted to JLogan3o13 for a topic
reb, glad you resolved it - though I don't know as I would ever mark two OS reinstalls as "the best answer" to any problem1 point -
qwert, Use ChrW: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel(ChrW(0x25BA), 10, 10, 50, 50) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetFont(-1, 32) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M231 point
-
You'll have to wait till a more experienced user in word comes along. As all I can recommend is word functions, but I'm not sure that is what you need.1 point
-
Jewtus, Look in the Help file for "Ternary operator". M231 point
-
Imbuter2000, You are quite right. AutoIt directives (of which #include is one) are actioned before the script is "compiled". There is no such thing as a "conditional directive" or "conditional include" - if you add an #include line in your script it will be expanded every time, regardless of the surrounding code, but only executed if called at runtime. Remember that you can use the Au3Stripper utility to remove all unused functions and constants from your script before compilation, so you only keep those ones which might be called/used rather then the entire file, which lets you can get halfway to a conditional state. As to the error you get, you have already been told that there is a difference when you use " " or < > to enclose the include file name. If enclosed in < >, AutoIt first looks for the file in the standard include folder - and as you have called your personal include by the same name as a standard include, it is that standard include which is found. And as that standard include does not define the $foobar variable, you get an "undeclared variable" error. If you enclose the include name in " " then AutoIt first looks in the script directory and finds your personal include file which does declare the variable. Top Tip: Do not reuse standard include filenames - think up something new. When I run the corrected code I get no error, although Au3Check will warn about the double include: Func test() #include "constants.au3" EndFunc #include "constants.au3" msgbox(0,"",$foobar) However, if you run the code and actually call the function (thus causing the variable to be declared twice) Func test() #include "constants.au3" EndFunc #include "constants.au3" test() msgbox(0,"",$foobar) you get a "Cannot redeclare a constant" error. Nothing surprising there. All in all - it is your bad coding practices which cause the problem and it is nothing to do with AutoIt. M231 point
-
Simplified...post the output: Local $oBtns = _IELinkGetCollection($oIE) For $oBtn In $oBtns $classname = String($oBtn.classname()) ConsoleWrite($classname & @CRLF) If $classname = "btn btn-small btn-espriAzzurro lucido gradient dropdown-toggle" Then ConsoleWrite("Found it" & @CRLF) _IEAction($oBtn,"Focus") $b = _IEAction($oBtn,"Click") ConsoleWrite("ie click return=[" & $b & "]." & @CRLF) ExitLoop EndIf Next1 point
-
Simplified with the Winapi UDF: #include <WinAPI.au3> $hPriorActiveWindow = _WinAPI_GetWindow(WinGetHandle("[ACTIVE]"),$GW_HWNDNEXT) WinActivate($hPriorActiveWindow)1 point
-
Version of MS word? Also, have you ever used the Au3 Info tool? This could prove helpful.1 point
-
on line 10 use WinGetTitle("[ACTIVE]") instead of WinActive. I think it was a problem trying to use the handle instead of a title. EDIT: Try that and post results.1 point
-
C++ doesn't have developers. It's got a committee that agrees on the standard, and then lots of developers for different organisations write the compilers. As a slight correction, you can declare variables without defining them, and you can use them. Some compilers won't even warn you (by default) when doing so (I need to to turn on -Wuninitialised with g++ to get this) C++ has the concept of default constructors, which means the (apparent) declaration sans-definition "myclass someVariable;" calls the myclass() constructor, and so the class variables are defined and it is correct to use someVariable. The reasoning comes from old C, where it was not valid to declare a new variable anywhere other than the start of scope. As a result, variables holding the result of some calculation would have to be declared (without a value) to be assigned to later on. That was a long time ago though. It's also useful for statements like "int someArray[1000000];" where it could take a while to zero the entire thing when you are going to assign them all values anyway.1 point
-
Hello folks, You can remotely execute a function in another script, spending almost all kinds of variables including arrays (1D only) and receive the results of function calls. Current functions: ; #CURRENT# ===================================================================================================================== ; _IPC_Startup ; _IPC_Shutdown ; _IPC_IsStarted ; _IPC_CallRemote ; ===============================================================================================================================Example: Compile and run this first... #AutoIt3Wrapper_Compression=0 ;Compression parameter 0-4 0=Low 2=normal 4=High. Default=2 #AutoIt3Wrapper_UseUpx=n ;(Y/N) Compress output program. Default=Y #Include <Array.au3> #Include "InterProcess.au3" _IPC_Startup() While 1 Sleep(100) WEndThen run it and see the result... #AutoIt3Wrapper_Compression=0 ;Compression parameter 0-4 0=Low 2=normal 4=High. Default=2 #AutoIt3Wrapper_UseUpx=n ;(Y/N) Compress output program. Default=Y #Include <Array.au3> #Include "InterProcess.au3" Global $aNewArray Dim $aArray[10] = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5] _ArrayDisplay($aArray, "$aArray") If _IPC_IsStarted("script2.exe") Then $aNewArray = _IPC_CallRemote("script2.exe", 5000, "_ArrayUnique", $aArray, 1, 0, 1, "-") _ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray")Make tests and post comments... Updated code! Here's a link to the source code: InterProcess.zip - This UDF uses MailSlot by @trancexx. Again, my thanks to @trancexx for the excellent work with Mailslots...1 point