Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/01/2019 in all areas

  1. @rcn3t0 as you're seeing from the comments, you may want to rethink all of your "examples". Everyone gets being new and wanting to share, and we welcome that on the forum. But it is worth ensuring that what you are sharing is worthwhile. In this case, as has been pointed out to you, the value of AutoIt comes not from being able to run VBScript code but from being able to do the same tasks better. If you spend some time becoming familiar with the language you will doubtless be in a position to offer examples of greater value to the community.
    2 points
  2. KickStarter15, Finish the gui part nicely with an edit search box included etc .. and tell me when its ready or better yet post it, By then then i will combine something that will find your searches in an instant And Yes you will have to believe me on this. Deal ?
    2 points
  3. rcn3t0

    Converting VBS to Autoit

    Hello, Sharing a way to convert a VBS script to Autoit. Below is a script that creates a text file in both languages. 'VBS Code Function Main() Dim Stuff Stuff = "Rodrigo" Dim myFSO Dim WriteStuff myFSO = CreateObject("Scripting.FileSystemObject") WriteStuff = myFSO.OpenTextFile("C:\Support\yourtextfile.txt", 8, True) WriteStuff.WriteLine(Stuff) WriteStuff.Close() End Function ;Autoit Func Main() Dim $Stuff $Stuff = "Rodrigo" Dim $myFSO Dim $WriteStuff $myFSO = ObjCreate("Scripting.FileSystemObject") $WriteStuff = $myFSO.OpenTextFile("C:\Support\yourtextfile.txt", 8, True) $WriteStuff.WriteLine($Stuff) $WriteStuff.Close() EndFunc While in VBS to declare a variable you must put Dim or Set and the name of the variable, in Autoit just put the symbol $ VBS: Dim Stuff Autoit: Dim $ Stuff or just $ Stuff For objects VBS: CreateObject Autoit: ObjCreate
    1 point
  4. Or simply : If StringRegExp ($sTime, "^\d{2}:\d{2}:\d{2}$") Then $aTime = StringSplit ($sTime, ":", $STR_NOCOUNT) If $aTime[0] < 24 And $aTime[1] < 60 And $aTime[2] < 60 Then ... ; it is ok now EndIf
    1 point
  5. So you thought you join these forums and post your question multiple times in different threads, supplying totally no information and then expect help? Stop cross posting your question! Provide all information, which include a description of what you are doing and want to accomplish , the script and the Error you get . Jos I have removed and merge the created turts. I also see this is the second time you get this warning so consider it the last time without consequences.
    1 point
  6. Maybe this will help. As the page is in German, use any translator -> https://autoit.de/index.php?thread/86505-guiscaler-guis-automatisch-zur-dpi-skalieren-lassen-windows-7-und-windows-10-per/
    1 point
  7. Well, you can always ShellExecute. $ImageMagickExePath = "C:\Program Files\ImageMagick-6.9.3-Q16\convert.exe" $ImageToReadPath = @ScriptDir & "\message.jpg" $ImageToReadPathResult = @ScriptDir & "\message_result.jpg" ShellExecuteWait($ImageMagickExePath, '"' & $ImageToReadPath & '" -fuzz ' & $Percentage & '% -fill black +opaque "#' & $Coloer & '" -threshold 20% -negate "' & $ImageToReadPathResult & '"', "", "", @SW_HIDE)
    1 point
  8. Yes, ImageMagick would do the trick, though COM is broken in newer autoit's, you'll have to revert back to 3.3.12 or 3.3.10 to be sure all of it works. Like this works in 3.3.12 but not in later versions For $Loop = 0 To 8 $img.Convert("-size","1024x1024","xc:", "-seed",String(9669 + $Loop), "+noise","Random", "-write", "mpr:random","+delete", _ "mpr:random","-channel","r","-threshold",String(GUICtrlRead($VegDensityGUI[$Loop])/10) & "%","-separate","+channel","-negate","-fill",$VegColor[$Loop],"-opaque","white","-write","mpr:" & $VegName[$Loop],"+delete", _ "./Media/Textures/heightmap.png", "-write","mpr:heightmap", "-threshold","35%", "-write","mpr:low","+delete", _ "mpr:heightmap","-threshold","55%","mpr:low","-compose","Difference","-composite","-write","mpr:treemap","+delete", _ "mpr:" & $VegName[$Loop], "mpr:treemap", "-compose","Multiply", "-composite", "-flop", "-write","mpr:treemap", "+delete", _ "mpr:treemap", "-morphology" ,"hmt","5:0,0,0,0,0 0,0,0,0,0 0,0,1,0,0 0,0,0,0,0 0,0,0,0,0","./Media/Models/Trees/" & $VegName[$Loop] & "Map.png") Next
    1 point
  9. What is the Android application you are trying to emulate with Droid4x ? Can you do a manual screen capture ? Have you tried using _ScreenCature_* functions ? Edit : you do not have any error detection in your script, would be a good idea to add some...
    1 point
  10. kenc, Welcome to the AutoIt forums. Please do not bump your own threads within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. M23
    1 point
  11. BigDaddyO

    ListUserSessions

    I just wanted to get the current users SessionID so I pulled just a little out of what you posted. I also added the 29 to the function to verify that the session you specified is a Remote session or not. The Microsoft link to figure out the WTSInfoClass values was broken but I found them and figured i'd post here in case someone else wants it. ;Options for the $SessionID Global Static $WTS_CURRENT_SESSION = -1 ;Options for the $WTSInfoClass Global Static $WTSInitialProgram = 0 Global Static $WTSApplicationName = 1 Global Static $WTSWorkingDirectory = 2 Global Static $WTSOEMId = 3 Global Static $WTSSessionId = 4 Global Static $WTSUserName = 5 Global Static $WTSWinStationName = 6 Global Static $WTSDomainName = 7 Global Static $WTSConnectState = 8 Global Static $WTSClientBuildNumber = 9 Global Static $WTSClientName = 10 Global Static $WTSClientDirectory = 11 Global Static $WTSClientProductId = 12 Global Static $WTSClientHardwareId = 13 Global Static $WTSClientAddress = 14 Global Static $WTSClientDisplay = 15 Global Static $WTSClientProtocolType = 16 Global Static $WTSIdleTime = 17 Global Static $WTSLogonTime = 18 Global Static $WTSIncomingBytes = 19 Global Static $WTSOutgoingBytes = 20 Global Static $WTSIncomingFrames = 21 Global Static $WTSOutgoingFrames = 22 Global Static $WTSClientInfo = 23 Global Static $WTSSessionInfo = 24 Global Static $WTSSessionInfoEx = 25 Global Static $WTSConfigInfo = 26 Global Static $WTSValidationInfo = 27 Global Static $WTSSessionAddressV4 = 28 Global Static $WTSIsRemoteSession = 29 $id = _WTSQuerySessionInformation($WTS_CURRENT_SESSION, $WTSSessionId) ;Get the current users SessionId ConsoleWrite("My Session ID: " & $id & @CRLF) $Username = _WTSQuerySessionInformation($WTS_CURRENT_SESSION, $WTSUserName) ;Get the username for the specified session ConsoleWrite("My Username: " & $Username & @CRLF) $Username = _WTSQuerySessionInformation($WTS_CURRENT_SESSION, $WTSIsRemoteSession) ;Can verify that the session is Remote ConsoleWrite("IsRemote? " & $Username & @CRLF) Func _WTSQuerySessionInformation($SessionId = -1, $WTSInfoClass = 10, $iReturnAsIs = 0) ; mod. of https://www.autoitscript.com/forum/topic/134679-get-hostname-of-the-client-connected-to-the-terminalserver-session/ Local $aResult = DllCall("Wtsapi32.dll", "int", "WTSQuerySessionInformation", "Ptr", 0, "int", $SessionId, "int", $WTSInfoClass, "ptr*", 0, "dword*", 0) If @error Or $aResult[0] = 0 Then Return SetError(1, 0, "") Local $ip = DllStructGetData(DllStructCreate("byte[" & $aResult[5] & "]", $aResult[4]), 1) DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $aResult[4]) If $iReturnAsIs Then Return $ip Switch $WTSInfoClass Case 4 ; We want the WTSSessionId Return Int('0x' & StringTrimRight(StringReverse($ip), 3)) Case 29 ; 1 = this is a remote session, 0 means its a physical session $WTSIsRemoteSession Return Int('0x' & StringTrimRight(StringReverse($ip), 3)) Case 14 ; We want the WTSClientAddress If Not (Int(StringLeft($ip, 4)) = 2) Then ; IPv4 $ip = "" Else $ip = Dec(StringMid($ip, 15, 2)) & '.' & Dec(StringMid($ip, 17, 2)) & '.' & Dec(StringMid($ip, 19, 2)) & '.' & Dec(StringMid($ip, 21, 2)) EndIf EndSwitch Return StringReplace(BinaryToString($ip), Chr(0), "") EndFunc ;==>_GetWTSClientName
    1 point
  12. When it comes to image manipulation, I'm a fan of ImageMagick.
    1 point
  13. @pakangdula welcome to the forum. AutoIt has an Outlook UDF that is quite powerful and will make this job a whole lot easier for you.
    1 point
  14. Suggestion (untested) GUICtrlSetState($hCombo, $GUI_Disable) For $i = 2 To $aXLSX[0][0] $sXLSX &= $aXLSX[$i][0] & "|" ;ConsoleWrite("$sXLSX: " & $sXLSX & @CRLF) Next GUICtrlSetData($hCombo, "|" & $sXLSX, "") GUICtrlSetState($hCombo, $GUI_Enable) Edit If the above fails you might try _GUICtrlComboBox_BeginUpdate
    1 point
  15. There is no good way to change the background color in a disabled listview. But the usual workaround of placing the listview in a child window and then disable the child window instead of the listview works well in this situation: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Example() Func Example() Local $hGui = GUICreate("listview items", 220, 250, 100, 200, -1) GUISetBkColor(0x00151515) Local $hChild = GUICreate( "", 200, 150, 10, 10, $WS_POPUP, $WS_EX_MDICHILD, $hGui ) Local $idListview = GUICtrlCreateListView("col1 |col2|col3 ", 0, 0, 200, 150) Local $idItem1 = GUICtrlCreateListViewItem("item2|col22|col23", $idListview) Local $idItem2 = GUICtrlCreateListViewItem("item1|col12|col13", $idListview) Local $idItem3 = GUICtrlCreateListViewItem("item3|col32|col33", $idListview) GUICtrlSetColor($idListview, 0x0000FF00) GUICtrlSetBkColor($idListview, 0x00151515) GUISetState( @SW_SHOW, $hChild ) GUISwitch( $hGui ) Local $idButton = GUICtrlCreateButton("Disable /enable", 45, 170, 120, 20) Local $iState GUISetState(@SW_SHOW) GUICtrlSetData($idItem2, "ITEM1") GUICtrlSetData($idItem3, "||COL33") $iState = 0 GUISetState( @SW_DISABLE, $hChild ) ;GUICtrlSetState($idListview, 128) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton IF $iState = 0 Then ;GUICtrlSetState($idListview, 64) GUISetState( @SW_ENABLE, $hChild ) $iState = 1 Else ;GUICtrlSetState($idListview, 128) Local $aIndex = _GUICtrlListView_GetSelectedIndices( $idListview, True ) _GUICtrlListView_SetItemSelected( $idListview, $aIndex[0] ? $aIndex[1] : -1, False ) GUISetState( @SW_DISABLE, $hChild ) $iState = 0 EndIf EndSwitch WEnd EndFunc When the child window becomes disabled, the listview is also disabled. But the background color does not change.
    1 point
  16. Forum Rules You can read about forum rules here. Announcements and site news Additional information about forum you can read here. Forum etiquette Here you can read about a proper forum etiquette.
    1 point
  17. Better use _FileListToArrayRec which allows multiple filters
    1 point
  18. I want to receive when Enter is pressed within the Edit control for it i used a KeyHook But, If the edit control didn't had the $ES_WANTRETURN style then it eats up the Enter pressed whereas if it has $ES_WANTRETURN then always a @CR is inserted With the following code the Edit is not created with $ES_WANTRETURN therefore enter isnt detected, Just place a $ES_WANTRETURN and then the code works #include-once #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WINAPI.au3> Global $Edit_Handle Global $Func_Name Global $_KeyPressed=0 Local $_hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") Local $_hmod = _WinAPI_GetModuleHandle(0) Local $_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($_hStub_KeyProc), $_hmod) OnAutoItExitRegister("_OnAutoItExit") Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($_hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Or $wParam=$WM_KEYUP Then $vkKey = DllStructGetData($tKEYHOOKS, "vkCode") $_KeyPressed=$vkKey EndIf Return _WinAPI_CallNextHookEx($_hHook, $nCode, $wParam, $lParam) EndFunc Func _OnAutoItExit() _WinAPI_UnhookWindowsHookEx($_hHook) DllCallbackFree($_hStub_KeyProc) EndFunc Local $GUi=GUICreate('Predict Text - Phoenix XL') Local $Edit=GUICtrlCreateEdit('',10,10,400-20,300,BitOR($WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL)) ; If $ES_WANTRETURN is used then Enter is Detected But @CR is automatically inserted Local $_Words[3]=['Hello','Abhishek','Now & Then'] $Edit_Handle=GUICtrlGetHandle($Edit) GUIRegisterMsg($WM_COMMAND,'WM_COMMAND') GUISetState() Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $iCode, $hWndEdit , $IDFrom $iCode = BitShift($iwParam, 16) $IDFrom= BitAND($iwParam, 0xFFFF) Switch $ilParam Case $Edit_Handle Switch $iCode Case $EN_CHANGE ;Sent when the user has taken an action that may have altered text in an edit control Switch $_KeyPressed Case 13 ;Enter ConsoleWrite('Enter Pressed'&@CR) Case 8 ;BackSpace ConsoleWrite('BackSpace Pressed'&@CR) EndSwitch EndSwitch EndSwitch Return Call($Func_Name,$hWnd, $iMsg, $iwParam, $ilParam) EndFunc ;==>WM_COMMAND While GUIGetMsg()<>-3 Sleep(10) WEnd I just wanted to detect when the enter is pressed inside the Edit control without the Carriage Return Please help me thanks for your time and help
    1 point
  19. UPDATE: With the addition of the ObjCreateInterface function and enhanced COM functionality by trancexxx, these interfaces are now accessible directly in AutoIt. I've rewritten the plugin as a native UDF which will work when compiled as x64 as well. I've attached the new UDF as well as updated plugin and UDF versions of my OSD Volume script. UDF Example: #include <_AudioEndpointVolume.au3> ; ## Get current volume levels $vol = _GetMasterVolumeLevel() ConsoleWrite("Get Vol Error: " & @error & @CRLF) ConsoleWrite("Volume: " & $vol & " (decibels)" & @CRLF) $vol = _GetMasterVolumeLevelScalar() ConsoleWrite("Get Vol Error: " & @error & @CRLF) ConsoleWrite("Volume: " & $vol & " (scalar)" & @CRLF) ; ## Set new volume levels ConsoleWrite("Set vol to -20db..." & @CRLF) _SetMasterVolumeLevel(-20) ConsoleWrite("Set Vol Error: " & @error & @CRLF) $vol = _GetMasterVolumeLevel() ConsoleWrite("Get Vol Error: " & @error & @CRLF) ConsoleWrite("Volume: " & $vol & " (decibels)" & @CRLF) ConsoleWrite("Set vol to scalar 30..." & @CRLF) _SetMasterVolumeLevelScalar(30) ConsoleWrite("Set Vol Error: " & @error & @CRLF) $vol = _GetMasterVolumeLevelScalar() ConsoleWrite("Get Vol Error: " & @error & @CRLF) ConsoleWrite("Volume: " & $vol & " (scalar)" & @CRLF) ; ## Get volume range information ConsoleWrite("Get range info..." & @CRLF) $aInfo = _GetVolumeRange() ConsoleWrite("Get Range Error: " & @error & @CRLF) ConsoleWrite("MinDB: " & $aInfo[0] & @CRLF) ConsoleWrite("MaxDB: " & $aInfo[1] & @CRLF) ConsoleWrite("Increment: " & $aInfo[2] & @CRLF) ; ## Set mute states ConsoleWrite("Set mute on..." & @CRLF) _SetMute(1) ConsoleWrite("Set Mute Error: " & @error & @CRLF) $mute = _GetMute() ConsoleWrite("Get Mute Error: " & @error & @CRLF) ConsoleWrite("Muted: " & $mute & @CRLF) Sleep(2000) ConsoleWrite("Set mute off..." & @CRLF) _SetMute(0) ConsoleWrite("Set Mute Error: " & @error & @CRLF) $mute = _GetMute() ConsoleWrite("Get Mute Error: " & @error & @CRLF) ConsoleWrite("Muted: " & $mute & @CRLF) ; ## Get volume step info ; ## Steps range from 0 to nStepCount - 1 ConsoleWrite("Get step info..." & @CRLF) $aInfo = _GetVolumeStepInfo() ConsoleWrite("Get Step Error: " & @error & @CRLF) ConsoleWrite("Current step: " & $aInfo[0] & @CRLF) ConsoleWrite("Total steps: 0 to " & $aInfo[1] - 1 & @CRLF) ConsoleWrite("Increase 5 steps..." & @CRLF) For $i = 1 To 5 _VolumeStepUp() Next $aInfo = _GetVolumeStepInfo() ConsoleWrite("Get Step Error: " & @error & @CRLF) ConsoleWrite("Current step: " & $aInfo[0] & @CRLF) ConsoleWrite("Decrease 2 steps..." & @CRLF) For $i = 1 To 2 _VolumeStepDown() Next $aInfo = _GetVolumeStepInfo() ConsoleWrite("Get Step Error: " & @error & @CRLF) ConsoleWrite("Current step: " & $aInfo[0] & @CRLF) OLD PLUGIN VERSION vista_vol_plugin.zip _AudioEndpointVolume.au3 VolumeOSD.zip VolumeOSD_plugin.zip
    1 point
  20. w0uter

    _FileSearch

    decided to gave it its own post since it was faster then anything i have seen. Func _FileSearch($s_Mask = '', $i_Recurse = 1) Local $s_Command = ' /c dir /B "' If $i_Recurse = 1 Then $s_Command = ' /c dir /B /S "' Local $s_Buf = '', $i_Pid = Run(@ComSpec & $s_Command & $s_Mask & '"', @WorkingDir, @SW_HIDE, 2+4) ProcessSetPriority($i_Pid, 5) While Not @error $s_Buf &= StdoutRead($i_Pid) WEnd $s_Buf = StringSplit(StringTrimRight($s_Buf, 2), @CRLF, 1) ProcessClose($i_Pid) If UBound($s_Buf) = 2 AND $s_Buf[1] = '' Then SetError(1) Return $s_Buf EndFunc ;==>_FileSearch new: added optional sub search
    1 point
×
×
  • Create New...