Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/30/2016 in all areas

  1. ozmike

    SAPWizard.UDF

    here is a SAP hit tool ( like the SAP wizard) for anyone doing SAP automation windows 7. This lets you click on a control on any SAP GUI and highlights it just like the wizard did and tells you the control path. The SAP wizard has problems on windows 7 due to it use of Office Assistants Agents (remember Clippy?) which are no longer supported in windows 7. Note, GUI Scripting needs to be turned on see your system admin (or see transaction rz11 to turn on) Enjoy For general SAP automation see griffin the great's SAP.UDF tags SAP GUI scripting wizard not working SAPWizard.zip
    1 point
  2. I played around a little with http://www.chilkatsoft.com/ ActiveX components. Here is an example based on examples from this page. #include <FileConstants.au3> #include <MsgBoxConstants.au3> ;~ http://www.chilkatsoft.com/downloads_ActiveX.asp ;~ http://www.chilkatsoft.com/support.asp ;~ http://www.chilkatsoft.com/refdoc/activex.asp ;~ http://www.chilkatsoft.com/refdoc/xChilkatCertStoreRef.html ;~ http://www.chilkatsoft.com/refdoc/xChilkatCertChainRef.html ;~ Email ActiveX Reference Documentation ;~ http://www.chilkatsoft.com/refdoc/xChilkatEmailRef.html ;~ http://www.example-code.com/vbscript/emailObj.asp ;~ http://www.example-code.com/vbscript/pop3.asp Global $_sPOP3_Server = 'xxxxxx' Global $_sPOP3_UserName = 'xxxxxx' Global $_sPOP3_Password = 'xxxxxx' _Example_1_Version() _Example_2_Get_number_of_mesages() _Example_3_Retrieve_UIDLs_from_POP3_Server() _Example_4_Save_Email_Attachments_to_Filesystem() Func _Example_1_Version() Local $oCrypt = ObjCreate("Chilkat_9_5_0.Crypt2") MsgBox(0, '', $oCrypt.Version) EndFunc ;==>_Example_1_Version Func _Example_2_Get_number_of_mesages() ; http://www.example-code.com/vbscript/pop3_mailboxCount.asp ; The mailman object is used for receiving (POP3) ; and sending (SMTP) email. ; This ObjCreate statement uses the new single-DLL ActiveX for v9.5.0 Local $oMailman = ObjCreate("Chilkat_9_5_0.MailMan") ; Any string argument automatically begins the 30-day trial. $success = $oMailman.UnlockComponent("30-day trial") If ($success <> 1) Then MsgBox(0, 'UnlockComponent', $oMailman.LastErrorText) Return EndIf ; Set the POP3 server's hostname $oMailman.MailHost = $_sPOP3_Server ; Set the POP3 login/password. $oMailman.PopUsername = $_sPOP3_UserName $oMailman.PopPassword = $_sPOP3_Password ; Get the number of messages in the mailbox. Local $iNumMessages = $oMailman.GetMailboxCount() MsgBox(0, '', $iNumMessages) EndFunc ;==>_Example_2_Get_number_of_mesages Func _Example_3_Retrieve_UIDLs_from_POP3_Server() ; Retrieve UIDL's from POP3 Server ; http://www.example-code.com/vbscript/pop3_getUidls.asp ; The mailman object is used for receiving (POP3) ; and sending (SMTP) email. ; This ObjCreate statement uses the new single-DLL ActiveX for v9.5.0 Local $oMailman = ObjCreate("Chilkat_9_5_0.MailMan") ; Any string argument automatically begins the 30-day trial. $success = $oMailman.UnlockComponent("30-day trial") If ($success <> 1) Then MsgBox(0, 'UnlockComponent', $oMailman.LastErrorText) Return EndIf ; Set the POP3 server's hostname $oMailman.MailHost = $_sPOP3_Server ; Set the POP3 login/password. $oMailman.PopUsername = $_sPOP3_UserName $oMailman.PopPassword = $_sPOP3_Password ; sa is a Chilkat_9_5_0.StringArray Local $oSA = $oMailman.GetUidls() Local $iCount = $oSA.Count For $i = 0 To $iCount - 1 ConsoleWrite($oSA.GetString($i) & @CRLF) Next EndFunc ;==>_Example_3_Retrieve_UIDLs_from_POP3_Server Func _Example_4_Save_Email_Attachments_to_Filesystem() ; Save Email Attachments to Filesystem ; http://www.example-code.com/vbscript/emailObject_saveAttachments.asp Local $oEmail = ObjCreate("Chilkat_9_5_0.Email") ; Load an email object containing attachments. ; This .eml can be downloaded from: ; http://www.example-code.com/testData/HtmlEmail.eml Local $sEML_FileFullPath = FileOpenDialog('Choose EML File', @ScriptDir, 'EML file (*.eml)', $FD_FILEMUSTEXIST) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") Return 0 EndIf Local $iSuccess = $oEmail.LoadEml($sEML_FileFullPath) If ($iSuccess <> 1) Then ConsoleWrite($oEmail.LastErrorText & @CRLF) Return 0 EndIf ; If OverwriteExisting is turned on, files with the same ; name are overwritten. If turned off, new/unique filenames ; are automatically generated. The filenames actually saved ; are accessible via the GetAttachmentFilename method. $oEmail.OverwriteExisting = 1 ; Save all attachments to the "myAttachments" subdirectory ; found under the calling process;s current working directory. ; This directory is automatically created if it does not already ; exist. $iSuccess = $oEmail.SaveAllAttachments("myAttachments") If ($iSuccess <> 1) Then ConsoleWrite($oEmail.LastErrorText & @CRLF) Return 0 EndIf ; List the attachment filenames: For $i = 0 To $oEmail.NumAttachments - 1 ConsoleWrite($oEmail.GetAttachmentFilename($i) & @CRLF) Next EndFunc ;==>_Example_4_Save_Email_Attachments_to_Filesystem Best regards mLipok
    1 point
  3. UEZ

    GDI+ text stroke effects

    Try something like this here: ;coded by UEZ build 2016-12-31 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> _GDIPlus_Startup() Global $hBitmap_StrokeText = _GDIPlus_BitmapeCreateStrokeText("AutoIt", "Arial Black", 300, 0xF0035D8B, 0xFF41ABE1, 0xFFFFFFFF) Global $aDim = _GDIPlus_ImageGetDimension($hBitmap_StrokeText) Global $hGUI = GUICreate("GDI+ Stroke Text Example", $aDim[0], $aDim[1]) GUISetBkColor(0xFAFAFA) GUISetState() Global $hGfx = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_StrokeText, 0, 0, $aDim[0], $aDim[1]) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap_StrokeText) _GDIPlus_Shutdown() GUIDelete() Exit EndSwitch Until False Func _GDIPlus_BitmapeCreateStrokeText($sText, $sFont = "Arial Black", $fSize = 300.0, $iC1 = 0xFFFF0000, $iC2 = 0xFF00FF00, $iC3 = 0xFF0000FF, $fBlur = 20.0) Local Const $hPath = _GDIPlus_PathCreate() Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local Const $hFormat = _GDIPlus_StringFormatCreate() Local $tLayout = _GDIPlus_RectFCreate() _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $fSize, $hFormat) Local Const $aBounds = _GDIPlus_PathGetWorldBounds($hPath) Local $iW = $aBounds[2] * 3, $iH = $aBounds[3] * 3 Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $hCanvas = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, 4) _GDIPlus_GraphicsSetTextRenderingHint($hCanvas, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, 2) ;~ Local Const $hBrush = _GDIPlus_BrushCreateSolid($iC3) Local Const $hBrush = _GDIPlus_LineBrushCreate(0, 0, $aBounds[2] / 9, $aBounds[3] / 2, $iC3, 0xC8D8D8FF, 0) _GDIPlus_LineBrushSetSigmaBlend($hBrush, 0.1, 0.5) _GDIPlus_LineBrushSetGammaCorrection($hBrush, 1) Local Const $hPen = _GDIPlus_PenCreate() _GDIPlus_PenSetLineJoin($hPen, 2) _GDIPlus_PenSetColor($hPen, $iC1) Local Const $fBorder = $fSize / 5.5 _GDIPlus_PenSetWidth($hPen, $fBorder) _GDIPlus_PenSetAlignment($hPen, 0) _GDIPlus_GraphicsDrawPath($hCanvas, $hPath, $hPen) Local Const $hEffect = _GDIPlus_EffectCreateBlur($fBlur) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_PenSetColor($hPen, $iC2) _GDIPlus_PenSetWidth($hPen, $fSize / 10) _GDIPlus_PenSetAlignment($hPen, 0) _GDIPlus_GraphicsDrawPath($hCanvas, $hPath, $hPen) _GDIPlus_GraphicsFillPath($hCanvas, $hPath, $hBrush) Local Const $aPoints = _GDIPlus_PathGetLastPoint($hPath) Local Const $aBitmap_Cropped = _GDIPlus_BitmapCloneArea($hBitmap, 0, 0, $aPoints[0] + 2 * $aBounds[0] + $fBorder, $aPoints[1] + 2 * $aBounds[1] + $fBorder, $GDIP_PXF32ARGB) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_EffectDispose($hEffect) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_PathDispose($hPath) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) Return $aBitmap_Cropped EndFunc ;==>_GDIPlus_BitmapeCreateStrokeText If you change the font then _GDIPlus_BitmapCloneArea (line 57) needs to be adjusted appropriately.
    1 point
  4. Either one can be used, the two functions are identical. The only difference is in the descriptions for them, in the BitmapDispose function the help file refers to the parameter as the handle to the bitmap, and in ImageDispose it calls it the handle to the image. Other than the wording, they're identical.
    1 point
  5. for getting the list of programs shown in open with.., you could try something like this #include <array.au3> Global $read = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" Global $path1 = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\' Global $path2 = 'HKEY_CLASSES_ROOT\Applications\' Local $types = '.rar,.pdf,.txt,.html,.mp3' Local $type = StringSplit($types, ',') For $i = 1 To $type[0] MsgBox($MB_SYSTEMMODAL, 'OpenWithList for *' & $type[$i] & ' files', GetOpenWith($type[$i])) Next Exit Func GetOpenWith($type) Local $var, $var1, $var2, $var3 For $i = 1 To 100 $var = RegEnumVal($read & $type & "\OpenWithList", $i) If @error Then ExitLoop If $var = "MRUList" Then ContinueLoop $var1 = RegRead($read & $type & "\OpenWithList", $var) $var2 = RegRead($path1 & $var1, '') If Not @error Then $var3 &= $var2 & @CRLF Else $var2 = RegRead($path2 & $var1 & "\shell\open\command", '') If Not @error Then $var3 &= StringTrimLeft(StringLeft($var2, StringInStr($var2, '" "', 1, -1) - 1), 1) & @CRLF Else $var3 &= $var1 & @CRLF EndIf EndIf Next Return $var3 EndFunc ;==>GetOpenWith
    1 point
  6. And microsoft seems to wrap the windows controls (win32 and univerals app controls) also in a webdriver concept (I assume using UI Automation framework) https://github.com/Microsoft/WinAppDriver This can be overkill but on the other hand could be nice to remotely control a computer by running te winappdriver in a citrix or any centralized server way (offcourse http reachable then).
    1 point
  7. Problem "solved" by adding this under Case $DBT_DEVICECOMPLETEREMOVAL: If GUICtrlGetState($recover) = -1 Then ShellExecute(@ScriptFullPath) _AllExit() EndIf
    1 point
  8. Subz

    Help me with loop script

    You mean something like this? #include <Misc.au3> Global $bSTOP = False HotKeySet('{Esc}', '_FNC_EXIT') HotKeySet('{Enter}', '_FNC_STOP') While 1 If _IsPressed('02') Then _FNC_TIME() Sleep(50) WEnd Func _FNC_STOP() If $bSTOP = False Then $bSTOP = True Else $bSTOP = False EndIf EndFunc Func _FNC_TIME() $bSTOP = False Local $hTIME = TimerInit(), $hDIFF = 0 Send('{NUMPAD2}') While 1 $hDIFF = TimerDiff($hTIME) If $hDIFF >= 5000 Then Send('{NUMPAD2}') $hTIME = TimerInit() EndIf If $bSTOP = True Then ExitLoop Sleep(50) WEnd EndFunc Func _FNC_EXIT() Exit EndFunc
    1 point
  9. JustSomeone, How about this: #include <GUIConstantsEx.au3> #include <Array.au3> Global $aListControllers[5][2] = [["01", "Door1"], ["02", "Door2"], ["03", "Door3"], ["04", "akhsd"], ["05", "asshd"]] Global $aListUser[0][2] $Form1 = GUICreate("test", 551, 273, 274, 218) $controllerlist = GUICtrlCreateList("", 233, 10, 113, 190);, BitOR($GUI_SS_DEFAULT_LIST, $LBS_EXTENDEDSEL), $WS_EX_CLIENTEDGE) $userlist = GUICtrlCreateList("", 418, 10, 113, 190);, BitOR($GUI_SS_DEFAULT_LIST, $LBS_EXTENDEDSEL), $WS_EX_CLIENTEDGE) $buttonadd = GUICtrlCreateButton(">>", 374, 69, 27, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $buttonremove = GUICtrlCreateButton("<<", 374, 101, 27, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $savebutton = GUICtrlCreateButton("Save", 320, 224, 75, 25) $cancelbutton = GUICtrlCreateButton("Cancel", 408, 224, 75, 25) GUISetState(@SW_SHOW) _LoadLists() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $cancelbutton, $savebutton Exit Case $buttonadd _ButtonAdd() Case $buttonremove _ButtonRemove() EndSwitch WEnd ;striped func just for the example Func _ButtonAdd() Local $aSelectedValue = GUICtrlRead($controllerlist);, $GUI_READ_EXTENDED) If StringInStr($aSelectedValue, "-", 2) Then ; > 0 Then $aSplitedValue = StringSplit($aSelectedValue, "-") $b = _ArraySearch($aListControllers, $aSplitedValue[2]) _ArrayDelete($aListControllers, $b) _ArrayAdd($aListUser, $aSplitedValue[1] & "|" & $aSplitedValue[2]) _LoadLists() EndIf EndFunc ;==>_ButtonAdd Func _ButtonRemove() Local $aSelectedValue = GUICtrlRead($userlist);, $GUI_READ_EXTENDED) If StringInStr($aSelectedValue, "-", 2) Then ; > 0 Then $aSplitedValue = StringSplit($aSelectedValue, "-") $b = _ArraySearch($aListUser, $aSplitedValue[2]) _ArrayDelete($aListUser, $b) _ArrayAdd($aListControllers, $aSplitedValue[1] & "|" & $aSplitedValue[2]) _LoadLists() EndIf EndFunc ;==>_ButtonAdd Func _LoadLists() Local $a = "|" ; This forces a replace of the existing data when you set it later For $x = 0 To UBound($aListControllers, 1) - 1 Step 1 $a &= $aListControllers[$x][0] & "-" & $aListControllers[$x][1] & "|" Next GUICtrlSetData($controllerlist, $a) $a = "|" For $x = 0 To UBound($aListUser, 1) - 1 Step 1 $a &= $aListUser[$x][0] & "-" & $aListUser[$x][1] & "|" Next GUICtrlSetData($userlist, $a) EndFunc M23 Edit: And they are lists, not combos.
    1 point
  10. Subz

    Help me with loop script

    Maybe something like this, haven't really tested, but might give you something to work from. #include <Misc.au3> Global $bSTOP = False HotKeySet('{Esc}', '_FNC_EXIT') HotKeySet('{Enter}', '_FNC_STOP') While 1 If _IsPressed('02') Then _FNC_TIME() Sleep(50) WEnd Func _FNC_STOP() If $bSTOP = False Then $bSTOP = True Else $bSTOP = False EndIf EndFunc Func _FNC_TIME() $bSTOP = False Send('{ALT}') Local $hTIME = TimerInit(), $hDIFF = 0 While 1 Send('{NUMPAD2}') $hDIFF = TimerDiff($hTIME) If $hDIFF >= 5000 Then $bSTOP = True If $bSTOP = True Then ExitLoop Sleep(50) WEnd EndFunc Func _FNC_EXIT() Exit EndFunc
    1 point
  11. Here is an Chilkat.au3 UDF - modest begining. I will soon post an update as separate thread. Chilkat_example.au3 Chilkat.au3
    1 point
  12. Didn't realize adwcleaner was a program that ran as admin. If you're interacting with any window that has admin privileges your script has to run as admin as well. #RequireAdmin AutoItSetOption("WinTitleMatchMode", -2) WinMove("adwcleaner", "", 0, 0)
    1 point
  13. Thank you. That pointed me in the right direction. This works: $outfile = outfile.rtf $txthandle = FileOpen($outfile) $convtext = FileRead($txthandle) FileClose($txthandle) FileDelete($outfile) $clipFmt = _ClipBoard_RegisterFormat("Rich Text Format") $ret = _ClipBoard_SetData($convtext, $clipFmt) The tricky part was setting the $clipFmt variable and then using it. This detail was missing from at least one other solution posted on the forum a few years ago. Thank you again!
    1 point
  14. Correct. Instead of the message box use _arrayDisplay($sResult) to see the contents you have read.
    1 point
  15. Hey all! It's been a while since I've posted but here is a simple little function I thought I'd share that allows you to keep a script process active for a minimum amount of time. I use this to ensure the process is active to ensure any TrayTips remain visible. But I'm sure there is far more interesting uses for this. How it Works The coder calls the KeepAlive function with the number of seconds he/she wants to ensure the process will remain active for the next n seconds. Let's say you just called the TrayTip function with 15 seconds display time. You might call KeepAlive with 18 seconds to ensure the process stays active for the next 18 seconds. If the process is closed after that, then the process will close normally. #Region - KeepAlive Functions ;## Function used to ensure the process stays active for the next n seconds. This is useful to ensure ToolTips ect remain visible. #cs - Example TrayTip(@ScriptName, "This Tip will be called just prior to exit of process.", 5) KeepAlive(8) Exit #ce - Example Func KeepAlive($Seconds = 5) Global $KeeyAlive_IsActive = False Global $KeeyAlive_Init = 0 Global $KeeyAlive_Timeout = 0 ;## Check if there is a previously set timer and only set the new value if it is more than the previously set value. If $KeeyAlive_Timeout - TimerDiff($KeeyAlive_Init) < $Seconds * 1000 Then $KeeyAlive_Init = TimerInit() $KeeyAlive_Timeout = $Seconds * 1000 EndIf ;## If the callback is not yet regerister to execute on exit, register it now. If Not $KeeyAlive_IsActive Then $KeeyAlive_IsActive = True OnAutoItExitRegister("__KeepAlive_OnExit") EndIf EndFunc ;## Private On Exit Function used to ensure program remains active for a previously defined number of seconds. Func __KeepAlive_OnExit() ;## If closeing due to Loffoff or shutdown. Allow it without Delay. If @exitMethod > 2 Then Return ;## Check for reasons that process should be clsoed immediatly without delay. If @exitMethod > 2 Or Not IsDeclared("KeeyAlive_IsActive") Or Not IsDeclared("KeeyAlive_Init") Or Not IsDeclared("KeeyAlive_Timeout") Or TimerDiff($KeeyAlive_Init) > $KeeyAlive_Timeout Then Return ;## Pause Process for the time remaining. ConsoleWrite("Keeping Alive for " & Int($KeeyAlive_Timeout - TimerDiff($KeeyAlive_Init)) & "ms" & @CRLF) Sleep($KeeyAlive_Timeout - TimerDiff($KeeyAlive_Init)) EndFunc #EndRegion Enjoy!
    1 point
  16. crazycrash

    SAP UDF

    Answering my own question, part 2: To move the carret to a position in the table: $sap_session.findById("wnd[" & $sap_window_num & "]/" & "usr/tblSAPLCUKDTC_RCUKD/txtRCUKD-KNKTX[2,3]").setFocus
    1 point
  17. crazycrash

    SAP UDF

    Answering my own question: MsgBox(0, "Extracted Field", _SAPObjValueGet("usr/tblSAPLCUKDTC_RCUKD/txtRCUKD-KNKTX[2,3]")) So one can read the table like an array, however, only the visible fields.
    1 point
×
×
  • Create New...