Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Just found that i was using an old version of _WinAPI_GetKeyboardState, the new version uses structs. Is there any way to save a $tStruct to a file? I had no luck with _WinAPI_StructToArray, as it would usually give an error and when it didnt it would have random characters in it anyway.
  3. Today
  4. After many tries, I realized that converting it to binary and back to string, it would show a hidden character. So I solved it by trimming 1 character out of the string: Global $RawWidth = $SizeComponent[1] Global $Width = StringTrimLeft ($sWidth, 1) Thanks for the help to those who took their time and read.
  5. So the "@logonDomain" is what i was looking for there. but now i'm still having a issue with the "RunAs" TestRun() Global $sDomain = @LogonDomain Global $sUserName = "ITtest" Global $sPassword = "Password" Global $sAdminRun = RunAs($sUserName, $sDomain, $sPassword, $RUN_LOGON_NETWORK, $ProgramName) Func TestRun() local $ProgramName = "Z:\Installer Files\TreeSize\TreeSizeProfessional\TreeSize-x64-Full.exe" Run($sAdminRun) EndFunc I'm trying to run a program as a different domain user than the one that is currently logged on. I was trying to use the $ProgramName as a variable for each function but i'm getting a "Not Declared"? Again i'm pretty new to the whole Autoit Scene but im learning fast.
  6. Good morning, all. I have been working on this little proyect that scales images (for another OCR proyect) and I have bumped into an error: The $Width variable (global) that has a numerical value is apparently not recognized as a number, since when I try to multiply it by the Scale factor (2) it results in 0. $Width is originated from string splitting the Resolution property of the chosen image. Code Below: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #include <ExtProp.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <AutoItConstants.au3> Global $InputImage = @ScriptDir & "\Input.png" Global $OutputImage = @ScriptDir & "\ScaledIMG.png" GetImageSize () ScaleImage () ;Obtiene dimensiones ANCHOxALTO de la imagen a procesar. Func GetImageSize () ;Obtiene propiedad nro. 31 (Windows 7) que contiene en un solo string ANCHOxALTO Global $ImageSize = _GetExtProperty($InputImage, 31) ;En caso de no obtener la resolución, será imposible luego determinar cuanto escalar la imagen. If $ImageSize = "0" Then Global $Scaleable = 0 MsgBox ($MB_ICONERROR, "MDA-OCR", "Error al obtener dimensiones de imagen, no podrá escalarse la misma. La factura se procesará, pero su análisis no será preciso.") Else ;Separa los componentes de la dimensión en Ancho y Alto. Local $SizeComponent = StringSplit ($ImageSize, " x ", 1) Global $Scaleable = 1 Global $Width = $SizeComponent[1] Global $Height = $SizeComponent[2] EndIf EndFunc Func ScaleImage () Local $InfranViewExe = "IrfanViewPortable\IrfanViewPortable.exe" ;~ Local $InfranViewExe = "C:\Program Files\IrfanView\i_view64.exe" If $Scaleable = 1 Then Global $ScaleFactor = "2" Global $RezWidth = $Width * $ScaleFactor Global $RezHeight = $Height * $ScaleFactor RunWait ($InfranViewExe & " """ & $InputImage & """ /resize=(" & $RezWidth & "," & $RezHeight & ") /convert=""" & $OutputImage & """ /resample") ;This is the debug line, which outputs Resolution, then Width and Height (obtained from splitting resolution string) and the scaled W/H. MsgBox ($MB_SYSTEMMODAL, "Dimensiones", $ImageSize & "," & $Width & "," & $RezWidth & "," & $Height & "," & $RezHeight) Else FileMove ($InputImage, $OutputImage, $FC_OVERWRITE) EndIf EndFunc ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The debug Message Brings me everything but the $RezWidth, which instead of being the double of $Width is "0". Credits to the creator of ExtProp UDF.
  7. I just got a new mouse that has macro functionality, and i wanted to make something simmilar for my keyboard. Thing is, _WinAPI_SetKeyboardState gives me an error i cannot seem to fix. Please ask me if you have any questions, also here is the code: #include <WinAPISys.au3> #include <Array.au3> #include <File.au3> #include <GUIConstantsEx.au3> HotKeySet('{ESC}', 'Close') Global $bRecording = False Global $bStop = False Func Close() $bStop = True EndFunc ;==>Close $hGUI = GUICreate('Input recorder', 500, 200) $idStartRecording = GUICtrlCreateButton('Start recording', 80, 100) $idStopRecording = GUICtrlCreateButton('Run macro', 320, 100) GUISetState() Global $aArray[11][2] $hTimer = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idStartRecording $bStop = False GUICtrlSetData($idStartRecording, 'Running...') $hFile = FileOpen(@ScriptDir & '\Macro' & @YEAR & '.' & @MON & '.' & @MDAY & '-' & @HOUR & '.' & @MIN & '.' & @SEC & '.macro', 1) While $bStop = False ;$hTimer = TimerInit() For $i = 0 To 10 If $i <> 0 Then Do Sleep(10) $a = _WinAPI_GetKeyboardStateMod() Until _ArrayToString($a, '') <> $aArray[$i - 1][0] or $bStop = True ;ConsoleWrite(_ArrayToString($a, '') & ' ' & $aArray[$i - 1][0]) Else $a = _WinAPI_GetKeyboardStateMod() EndIf $aArray[$i][0] = _ArrayToString($a, '') $aArray[$i][1] = Round(TimerDiff($hTimer), 1) $hTimer = TimerInit() Next _FileWriteFromArray($hFile, $aArray, Default, Default, @CRLF) for $iO = 0 to 10 $aArray[$iO][0] = '' $aArray[$iO][1] = '' Next ;ConsoleWrite(@error) WEnd _FileWriteFromArray($hFile, $aArray, Default, Default, @CRLF) GUICtrlSetData($idStartRecording, 'Start recording') Case $idStopRecording $bStop = False $hFile = FileOpen(FileOpenDialog('Select macro file', @ScriptDir, 'Macro files (*.macro)', 1 + 2)) GUICtrlSetData($idStopRecording, 'Running...') $sFileContent = FileRead($hFile) ;ConsoleWrite($sFileContent&@CRLF&@CRLF&@CRLF) $aWholeFile = StringSplit($sFileContent, @LF) ;_ArrayDisplay($aWholeFile) For $i = 1 To $aWholeFile[0] - 1 ;ConsoleWrite(Mod($i,2)) if $bStop = True Then ExitLoop If $aWholeFile[$i] <> @CR Then If Mod($i,2) = 1 Then ConsoleWrite('Array ' & $aWholeFile[$i]) $aCharPresses = StringSplit($aWholeFile[$i], '') _WinAPI_SetKeyboardState($aCharPresses) Else ConsoleWrite('Sleep ' & $aWholeFile[$i]) Sleep(Int($aWholeFile[$i])) EndIf EndIf Next GUICtrlSetData($idStopRecording, 'Run macro') EndSwitch WEnd Func _WinAPI_GetKeyboardStateMod() Local $aDllRet, $lpKeyState = DllStructCreate("byte[256]") $aDllRet = DllCall("User32.dll", "int", "GetKeyboardState", "ptr", DllStructGetPtr($lpKeyState)) Local $aReturn[256] For $i = 1 To 256 $aReturn[$i - 1] = DllStructGetData($lpKeyState, 1, $i) Next Return $aReturn EndFunc ;==>_WinAPI_GetKeyboardStateMod
  8. Your last $iRet, as you noted, returns the number of bytes read. After that, you need to get the received data from the buffer. Add another line such as: $iRet = DllStructGetData($tBinData, 1) I hope that works; I'm kinda sketchy on structs, myself. Alan
  9. Hi all, I am trying to automate some tasks in a powerpoint addin named office timeline. It's free to install and use in basic mode if you want to try (https://www.officetimeline.com/). I managed to open it from autoit with keyboard shortcuts but once opened I dont know which objects I can use to interact with it as the Window info gives me no control: >>>> Window <<<< Title: Office Timeline Class: HwndWrapper[Otl.Addin.vsto|vstolocal;VSTA_Main;94563982-e478-4c06-b35a-f2be728f72cc] Position: 29, 64 Size: 1220, 640 Style: 0x16080000 ExStyle: 0x00080000 Handle: 0x0002066E >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 1037, 651 Cursor ID: 0 Color: 0xF1F1F1 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< >>>> Hidden Text <<<< Example addin window here: I suspect the objects exist anyway (new, import, recent file 1, 2...) , how do I find them? I could use mouseclicks for some features but I'd rather have more robust code. Thanks
  10. As an example run MsgBox(0, "", @LogonDomain) to get the name of the domain you are currently logged in.
  11. Have you tried all three? Are you getting errors? Have you then looked at the running process in Task Manager to see what user account it is running under? Which works for you?
  12. Hi i have been running into a few issue with a simple "RunAs" prefix. In the help it lists: RunAs ( "username", "domain", "password", logon_flag, "program" [, "workingdir" [, show_flag [, opt_flag]]] ) if i make those into variables like: Global $Domain = "Domain.net" OR "Domain" OR "Domain\" Global $UserName = "ITtest" Global $Password = "Password" Do i include the ".net" at the end for my domain? Or do i use a "domain\" Ect. I'm new to the forms and not sure the best way to go about posting this.
  13. @geoffrey6767 We do not permit payware promotions - one would think you could figure this out with all the other promotions that have been immediately removed from this thread.
  14. Alternatively use AdlibRegister for example: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiConstants.au3> #include <MsgBoxConstants.au3> Global $bPing = False, $iCounter = 0, $Title = "Back Online? v1 by Dan" HotKeySet("{ESC}", "_Terminate") GUICreate($Title,300,200) $sCenter = WinGetClientSize($Title) GUICtrlCreateLabel("Back Online?",0,10, $sCenter[0],50,$SS_CENTER) GUICtrlSetFont (-1,20) GUICtrlCreateLabel("Enter The IP Address To Monitor", 0, 60, $sCenter[0],-1,$SS_CENTER) GUICtrlSetFont (-1,12) Global $sIPAddr = GUICtrlCreateInput("",70, 90, $sCenter[0]/2,30,$ES_CENTER) $sStartPing = GUICtrlCreateButton("Monitor",70,125,$sCenter[0] / 2,25,$SS_CENTER) GUICtrlCreateLabel("Waiting IP...", 120, 175,60) GUISetState(@SW_SHOW) AdlibRegister("_Ping") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sStartPing If GUICtrlRead($sIPAddr) == "" Then MsgBox(64,$Title,"Yeet says hi!") GUICtrlSetData($sStartPing, "Monitor") $bPing = False Else GUICtrlSetData($sStartPing, "Monitoring...") $bPing = True EndIf EndSwitch WEnd Func _Ping() If $bPing = False Then Return If Ping(GUICtrlRead($sIPAddr), 50) Then _Success();$ipaddr) Else $iCounter +=1 if $iCounter > 10 Then MsgBox(64,$Title,"I dont think its coming back?"&@CRLF&"Ill Close") ; use ie_create http://localhost/backon.php?status=Offline&ip=$ipaddr Exit EndIf GUICtrlSetData(-1,"Attempt "&$iCounter) EndIf EndFunc Func _Terminate() Exit EndFunc Func _Success() MsgBox(64,$Title,"Its back up,"&@CRLF&"Ive sent you a notification") ; use ie_create http://localhost/backon.php?status=Backup&ip=$ipaddr Exit EndFunc
  15. I like what you are doing even if I haven't need it. But surely is a god-sent when is needed. So thank you for working on it
  16. You're all heroes, truly! Thanks a lot! I got this to work, so I'll build from that example to implement what I need in my code. Thanks, @Danyfirex! And of course, a lot of gratitude as well for @Earthshine and @water and @TheXman for getting this discussion going! 😍
  17. Melba23, I like your UDF a lot - it is very useful to me 😁 I encounter a small issue, maybe you can help me out... If I use a column with auto-drop-down, like to type any other text which is _not_ in the drop down list and press enter the input will be discarded (= blank list view item). If I repeat it works... Here is a reproducer (- please use "Col-3" to test): #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GUIListViewEx.au3" Local $hGUI = GUICreate("TEST", 500, 500) Local $cLV = GUICtrlCreateListView("Col-0|Col-1|Col-2|Col-3", 10, 10, 420, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_FULLROWSELECT) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth($cLV, $i, 100) Next Global $aLVArray[6][4] For $i = 0 To 5 $sData = $i & "-0" $aLVArray[$i][0] = $sData For $j = 1 To 3 $sData &= "|" & $j $aLVArray[$i][$j] = "" & $j Next GUICtrlCreateListViewItem($sData, $cLV) Next $iLVIndex = _GUIListViewEx_Init($cLV, $aLVArray) _GUIListViewEx_SetEditStatus($iLVIndex, 3, 2, "||1|2|3|4|5|6", 2) _GUIListViewEx_MsgRegister() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIListViewEx_EventMonitor() WEnd I guess it has something to do with the auto-complete behavior... Any change to work around to store the input at the fist time?
  18. Nope, still shows as \\dfsroot\site\RetailApps for the ProviderName.
  19. You might like to use Opt("GUIOnEventMode", 1) GUICtrlSetOnEvent ..... to trap your GUI events and run functions when they are clicked. This frees you from constantly checking for them in a while / case loop. There are some good examples on the GUICtrlSetOnEvent help page. I'm sure there are appropriate use cases for both methods, but I find I always use this method to write GUIs in AutoIt.
  20. yeah, that should do it! i was thinking along those lines after looking at the VBA example
  21. Because the forum changes the content, I can do nothing. Delete the bracket at the end of the line and enter it again. Is it hard to do?
  22. Edited: Browser sent info twice 😤. Saludos
  23. Hello. my two cents... #include <MsgBoxConstants.au3> Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ;Register AutoIt Error handler Global $oObject = ObjCreate("JustRemotePhone.RemotePhoneService.ApplicationFactory") ;Create Main object ConsoleWrite("-oObject: " & IsObj($oObject) & @CRLF) Global $oApplication = $oObject.CreateApplication("AutoIt Client") ;Create Application If Not IsObj($oApplication) Then Exit MsgBox($MB_ICONERROR, "Error", "Unable to Create 'Remote Phone Call' Instance") EndIf Global $sNumber = InputBox("Add a number to be Called", "Phone Number", "") If Not $sNumber Then Exit MsgBox($MB_ICONINFORMATION, "Error", "Phone Number is Emtpy Script will Exit.") $oApplication.BeginConnect(True) ;Begin Connection ;You probably will need to grant accest to the application at this point. Global $oPhone = $oApplication.Phone ;Create Phone Object ConsoleWrite("-oPhone: " & IsObj($oPhone) & @CRLF) ;Call $oPhone.Call($sNumber) $oApplication.BeginDisconnect() ;End Connection ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc PD: Can't load syntaxhighlighter Cuz My Connection is too slow. So I'll update it later. Saludos
  24. so you can still run and install it. they are just informing you that they can't verify the publisher, and if you want to trust them.
  25. Also look at this Wiki page: https://www.autoitscript.com/wiki/Interrupting_a_running_function
  26. Problem Found BmpSearch.au3" (46) : ==> Variable must be of type "Object".: Local $iRowInc = ($tSizeSource.X - $tSizeFind.X) * 4 Local $iRowInc = ($tSizeSource.X - $tSizeFind^ ERROR BmpSearch downloaded from
  1. Load more activity
  • Create New...