Leaderboard
Popular Content
Showing content with the highest reputation on 10/24/2019 in all areas
-
Thanks @Danyfirex, and @seadoggie01, it seems that to make ObjEvent work IE should be downgraded to some previous version. Unfortunately (I don't know why) on my system (I think this happens also on other systems?) The use of <meta http-equiv = "X-UA-Compatible" content="IE=8"> does not have the desired effect . I also think that downgrading IE to a previous version precludes the use of more recent HTML features. For this reason I have devised the function _WebBrowser_JS_ElementGetRef () which, as explained in the notes of the function header, allows the use of a DOM object in the AutoIt ObjEvent function (without worrying about downgrading IE). I don't know if this approach could have any contraindications, but in the use I made of it, I have not encountered any so far. P.S. fine example Danyfirex (....though here the goal is to use ObjEvent )1 point
-
Help with simple script
SkysLastChance reacted to water for a topic
#include <File.au3> #include <ScreenCapture.au3> Global $sFilePath = (@DesktopDir & "/") ; Ask user to provide a value Global $iMaxValue = InputBox("Title", "Plerase enter value: ", "", "", 320, 150) If @error Then Exit ; Cancelled by user or other error $iMaxValue = Number($iMaxValue) ; Ask user to provide a filename Global $sFilename = InputBox("Title", "Please enter file name: ", "", "", 320, 150) If @error Then Exit ; Cancelled by user or other error HotKeySet("{PRINTSCREEN}", "PrintScreen") Func PrintScreen() $aFileList = _FileListToArray($sFilePath, $sFileName & '*.jpg', 1) If Not IsArray($aFileList) Then $sFilename &= '1.jpg' Else $sFilename &= $aFileList[0] + 1 & '.jpg' EndIf _ScreenCapture_Capture($sFilePath & "\" & $sFilename, 354, 196, 673, 436) EndFunc ;==>printscreen Opt("WinTitleMatchMode", 2) For $i = 1 To $iMaxValue WinActivate("Relatorio") Sleep(300) Send("{ENTER}") Sleep(1000) Send("{PRINTSCREEN}") Sleep(400) Opt("WinTitleMatchMode", 2) WinActivate("Relatorio") Send("{DOWN}") Next Can you please describe what you try to achieve with your script? I'm not sure this is the best solution 🤔1 point -
1 point
-
Make edit control accept @LF 's
Earthshine reacted to Deye for a topic
In the end it was just a tricky matter of figuring out where @LF 's go and @CRLF 's I guess I didn't have much luck with first attempts so i got bewildered looking for other ways which eventually can get harder to accomplish as we know .. And suddenly voila: This will convert lines from the clipboard and back to a $var @ also displaying correctly the lines to the edit control and allowing copying from the edit control and pasting the lines as they look to another editor #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Example", 785, 400) $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) $idInput = GUICtrlCreateEdit("", 10, 10, 760, 310, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idOK GUICtrlSetData($idInput, "") _GetTextToVar() EndSwitch WEnd Func _GetTextToVar($sfile= ClipGet()) If Not ($sfile) Then Return Local $str = @CRLF & StringReplace($sfile, "'", "''") $str = StringStripCR($str) $str = StringRegExpReplace($str, '(.{1,100})', "& '$1' _" & @LF) $str = StringRegExpReplace($str, "\_\n{2}\& ", "_" & @CRLF & "& @LF & $1") $str = StringStripWS($str, 3) $Var = "$Var" $str = "Local " & $Var & " = '' _" & @CRLF & StringTrimRight($str, 2) $str = StringRegExpReplace($str, "\_\n{3,1000}", " & @LF & @CRLF" & @CRLF & $Var & ' = ') $str = StringReplace($str, $Var & " = &", $Var & " &=") GUICtrlSetData($idInput, $str) ClipPut($str) EndFunc ;==>_gefTextVar Thanks guys1 point -
Here is a sample without Objevent. #include <GUIConstantsEx.au3> #include <IE.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> #include <WinAPIDlg.au3> $SD = GUICreate("Solar data", 600, 180) $futurebutton1 = GUICtrlCreateLabel("Visit N0NBH's site for more Banners..", 460, 50, 120, 100) GUICtrlSetFont(-1, 14, 200, 0, "Arial") GUISetState(@SW_SHOW) Global $oIE = _IECreateEmbedded() Global $bUpdateTip, $bTurnOff $IdIE = GUICtrlCreateObj($oIE, 10, 10, 435, 160) _IENavigate($oIE, 'about:blank', 1) _IEDocWriteHTML($oIE, _GetHTML2()) _IEAction($oIE, "refresh") _IELoadWait($oIE) $oDocument = $oIE.document $oDocument.body.scroll = "no" Local $isMsg = "" While True $isMsg = GUIGetMsg() Switch $isMsg Case $GUI_Event_Close ExitLoop Case $GUI_EVENT_MOUSEMOVE _ShowToolTip() Case $GUI_EVENT_PRIMARYDOWN If _IsIEWindows() Then ShellExecute("http://www.hamqsl.com/solar.html") EndIf EndSwitch WEnd Func _ShowToolTip() If _IsIEWindows() Then ToolTip("Click Image to add Solar-Terrestrial Data to your website!") Else ToolTip("") EndIf EndFunc ;==>_ShowToolTip Func _IsIEWindows() Local $tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked. DllStructSetData($tStruct, "x", MouseGetPos(0)) DllStructSetData($tStruct, "y", MouseGetPos(1)) Local $hWnd = _WinAPI_WindowFromPoint($tStruct) ; Retrieve the window handle. ConsoleWrite($hWnd & @CRLF) Return _WinAPI_GetClassName($hWnd) = "Internet Explorer_Server" EndFunc ;==>_IsIEWindows Func _GetHTML2() Local $sHTML = _ "<!DOCTYPE HTML>" & @CRLF & _ "<html>" & @CRLF & _ "<head>" & @CRLF & _ '<meta http-equiv="X-UA-Compatible" content="IE=edge" />' & @CRLF & _ "<title>solar101pic.php (410×125)</title>" & @CRLF & _ '</head>' & @CRLF & _ '<body>' & @CRLF & _ '' & @CRLF & _ ; '<body style="margin: 12px; background: #0e0e0e;">' & @CRLF & _ '' & @CRLF & _ ; '<img id="IMG1" style="-webkit-user-select: none;margin: auto;" src="http://www.hamqsl.com/solar101pic.php">' & @CRLF & _ '<img id="IMG1" src="http://www.hamqsl.com/solar101pic.php", style="position: absolute; left:0; top:0; width: 435px; height: 160px">' & @CRLF & _ "</body>" & @CRLF & _ "</html>" Return $sHTML EndFunc ;==>_GetHTML2 Saludos1 point
-
1 point
-
$x = InputBox("Title", "Please enter a number") If @error Then Exit ; Cancelled by user or other error $x = Number($x) For $i = 1 to $x ; ... Your code Next1 point
-
Remember to use HKLM and HKLM64 when compiling as 32-bit otherwise you're only returning 32-bit hive, this should display all items that show up in Programs and Features: #include <Array.au3> Global $g_aSoftware[1][6] = [["Registry Hive", "DisplayName", "DisplayVersion", "Publisher", "UninstallString"]] ;~ Current User Hive _ProgramsAndFeaturesList("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") ;~ 32-Bit HKEY_LOCAL_MACHINE Hive _ProgramsAndFeaturesList("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") ;~ 64-Bit HKEY_LOCAL_MACHINE Hive _ProgramsAndFeaturesList("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") _ArrayDisplay($g_aSoftware) Func _ProgramsAndFeaturesList($_sRegHive) Local $sRegEnumKey, $i = 1 While 1 $sRegEnumKey = RegEnumKey($_sRegHive, $i) If @error Then ExitLoop If Not RegRead($_sRegHive & "\" & $sRegEnumKey, "DisplayName") = "" Then $x = UBound($g_aSoftware) + 1 ReDim $g_aSoftware[$x][5] $x = UBound($g_aSoftware) - 1 $g_aSoftware[$x][0] = $_sRegHive & "\" & $sRegEnumKey $g_aSoftware[$x][1] = RegRead($g_aSoftware[$x][0], "DisplayName") $g_aSoftware[$x][2] = RegRead($g_aSoftware[$x][0], "DisplayVersion") $g_aSoftware[$x][3] = RegRead($g_aSoftware[$x][0], "Publisher") $g_aSoftware[$x][4] = RegRead($g_aSoftware[$x][0], "UninstallString") EndIf $i += 1 WEnd EndFunc1 point
-
Delete all empty rows in Excel - one line of code
PoojaKrishna reacted to Jfish for a topic
Sure, #include<Excel.au3> Local $oAppl = _Excel_Open() Local $sWorkbook = @ScriptDir & "\test.xlsx" ; a workbook with some data and blank rows Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook, Default, Default, True) $oWorkbook.ActiveSheet.Columns("A:A").SpecialCells($xlCellTypeBlanks).EntireRow.Delete The above is untested but should open a workbook and delete all blank rows.1 point -
how to insert text in a line !
McMuffinTop reacted to Melba23 for a topic
scila1996, You want to write a specific line to a file - I wonder if there is a function in the Help file that looks as if it might help you? Aha, there is "_FileWriteToLine", which strangely enough does exactly what you require. M231 point -
#forceref [Answered]
pixelsearch reacted to Melba23 for a topic
Hatcheda, You are quite right - and here is an example of when #forceref might be useful. If you use GUIRegisterMsg, you must use 4 parameters - normally $hWnd, $iMsg, $iwParam and $ilParam. If you run Au3Check with the preset (in SciTE) parameters, you will often find that there will be warnings produced saying that some of the parameteres are "declared but not used" - or something similar. This is because, depending on the function, you normally need only some of the parameters to determine the result - the others are only present because of the way GUIRegisterMsg source code has been constructed behind the scenes (not a complaint by the way!). Here is an example from the Helpfile page for _GUICtrlDTP_Create (which is where I noticed it for the first time): Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2 $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code")As you can see, the only parameter that is used by the code is $ilParam - so normally you would get warnings for the other 3. Using #forceref with a list of the unused parameters prevents these warnings. There is no difference to the functioning of the code, but it means that the script runs/compiles without the warnings. If there are a lot of them, they might obscure more vital warnings/errors - and anyway I prefer to have a warning/error free script. :-) I hope this is clear enough - my own understanding goes no further! M231 point