Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/21/2017 in all areas

  1. jguinch

    Last folder in a Path

    Also with _StringInsert : #Include <String.au3> $path = "C:\route\luglio\40.714224,-73.961452" $test = "test---" MsgBox(0, "", _StringInsert($path, $test, StringInStr($path, "\", 0, -1) )) ; MsgBox(0, "", StringRegExpReplace($path, ".+\\\K", $test) )
    2 points
  2. iamtheky, #include <Array.au3> Local $avArray[6][2] = [ _ ["String0", "SubString0"], _ ["String1", "SubString1"], _ ["String2", "SubString2"], _ ["String3", "SubString3"], _ ["String4", "SubString4"], _ ["String5", "SubString5"]] $search = "SubString3" StringRegExpReplace(_ArrayToString($avArray , ",," , 0 , 0 , ",,"), ',+(?=.*?,' & $search & '(?=,,|$))', "") Local $r[3] = [@extended, Floor($r[0]/UBound($avArray, 2)), $r[0]-$r[1]*UBound($avArray, 2)] Msgbox(0,"", "[" & $r[1] & "][" & $r[2] & "]")
    2 points
  3. So I'm trying to register a object to the running object table (ROT). I am doing something wrong, i just can't see what. any help would be appreciated AutoItObject_Internal.au3 IRunningObjectTable::Register method #include "AutoItObject_Internal.au3" $IID_IRunningObjectTable = "{00000010-0000-0000-C000-000000000046}" $IID_IMoniker = "{0000000f-0000-0000-C000-000000000046}" $AutoItError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler Func ErrFunc($oError) ConsoleWrite("!>COM Error !"&@CRLF&"!>"&@TAB&"Number: "&Hex($oError.Number,8)&@CRLF&"!>"&@TAB&"Windescription: "&StringRegExpReplace($oError.windescription,"\R$","")&@CRLF&"!>"&@TAB&"Source: "&$oError.source&@CRLF&"!>"&@TAB&"Description: "&$oError.description&@CRLF&"!>"&@TAB&"Helpfile: "&$oError.helpfile&@CRLF&"!>"&@TAB&"Helpcontext: "&$oError.helpcontext&@CRLF&"!>"&@TAB&"Lastdllerror: "&$oError.lastdllerror&@CRLF&"!>"&@TAB&"Scriptline: "&$oError.scriptline&@CRLF) EndFunc ;==>ErrFunc $IDispatch = IDispatch() $IDispatch.name = "my name is Danny" $IRunningObjectTable = DllCall("Ole32.dll","LONG","GetRunningObjectTable","DWORD",0,"PTR*",0) If @error<>0 Then Exit MsgBox(0, @ScriptLineNumber, @error) $IRunningObjectTable = ObjCreateInterface($IRunningObjectTable[2],$IID_IRunningObjectTable,"Register HRESULT(DWORD,PTR*,PTR*,DWORD*);Revoke HRESULT(DWORD);IsRunning HRESULT(PTR*);GetObject HRESULT(PTR*,PTR**);NoteChangeTime HRESULT(DWORD,PTR*);GetTimeOfLastChange HRESULT(PTR*,PTR*);EnumRunning HRESULT(PTR*);",True) If @error<>0 Then Exit MsgBox(0, @ScriptLineNumber, @error) $sCLSID="AutoIt.COMDemo" $IMoniker=DllCall("Ole32.dll", "LONG", "CreateFileMoniker", "WSTR", $sCLSID, "PTR*", 0) If @error<>0 Then Exit MsgBox(0, @ScriptLineNumber, @error) $dwRegister=0 $IRunningObjectTable.Register( 0, Ptr($IDispatch), $IMoniker[2], $dwRegister ) If @error<>0 Then Exit 1 If $dwRegister=0 Then Exit 2 $IRunningObjectTable.Revoke($dwRegister) Opt("GuiOnEventMode", 1) $hWnd=GUICreate("Title",700,320) GUISetState(@SW_SHOW,$hWnd) GUISetOnEvent(-3, "_MyExit", $hWnd) While 1 Sleep(10) WEnd Func _MyExit() $IDispatch=0 Exit EndFunc Thanks in advance
    1 point
  4. You debug a script, you don't compile it until the debugging produces a working script.
    1 point
  5. 0 or 2 should work for you. Then it doesn't matter where on the screen the window is located. The client area is the inside area of a window excluding the title bar, toolbars, status bar, scroll bars. Not every control can be automated using Control* functions. According to the help file: "Note: AutoIt only works with standard Microsoft controls. Some applications write their own custom controls which may look like a standard MS control but may resist automation." IIRC Windows.Forms is one of them. I have never used such controls, so I might be wrong. Best to either search the forum for Windows Forms or try it yourself. A solution is "professional" when it fits your needs. Means: It works, is fast and you understand your code even when a few months have passed
    1 point
  6. You could use AutoItSetOption("MouseCoordMode", n) ; n: 0 = relative coords to the active window, 2 = relative coords to the client area of the active window
    1 point
  7. Have you tried setting the workdir to the shelled programdir? Jos
    1 point
  8. Skysnake

    Last folder in a Path

    ; detemine the actual local folder ;ConsoleWrite("@ScriptDir " & @ScriptDir & @CRLF) Local $path = StringSplit(@ScriptDir, "\") ;_ArrayDisplay($path) Local $lastfoldercount = UBound($path, 1) - 1 ;ConsoleWrite("$lastfoldercount " & $lastfoldercount & @CRLF) Local $lastfolder = $path[$lastfoldercount] ;ConsoleWrite("$lastfolder " & $lastfolder & @CRLF)
    1 point
  9. iamtheky

    Last folder in a Path

    I Rube-Goldberged your solution $path = "C:\route\luglio\40.714224,-73.961452" $test = "test---" Msgbox(0,"", stringreverse(StringRegExpReplace(stringreverse($path), '\\' , stringreverse($test) & '\\' ,1)))
    1 point
  10. mikell

    Last folder in a Path

    Did you mean something like this ? $path = "C:\route\luglio\40.714224,-73.961452" $test = "test---" Msgbox(0,"", StringRegExpReplace($path, '.+\\\K(?=[^\\]+$)', $test) )
    1 point
  11. If there is only one row in one of the arrays and 100,000 rows in the other array, I doubt that a linear search is faster on average. Even with the same number of rows in the two arrays, it's easy to make examples where a binary search is faster. It depends on the data.
    1 point
  12. Some general feedback -- Have you considered using _IELoadWait instead of WinWaitActive? That the standard way of interacting with the browser. Using Send should be a last resort. Use _IEFormElementSetValue instead. The HTML you previously posted doesn't contain the form "crmUIHostDialogContainerForm", so either you're using the wrong form name or you haven't shown us the correct HTML.
    1 point
  13. iamtheky

    create text file

    In WIN10 I do this now #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection (FALSE) run('bash -c "touch TEMP"') edit: argh the activity stream got me again, at least this one is only 2.5 years since last used, but still 7 years old is a good pull. Damn you IPB.
    1 point
×
×
  • Create New...