Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/21/2014 in all areas

  1. Jos

    help in making a bot

    We've been pretty clear so do not post any game related question again. Jos
    2 points
  2. Please read the forum rules, game automation is forbidden here.
    2 points
  3. This is a question which gets asked quite a bit >> How to add my program to the SendTo Folder? If this is you and you want to use a simple Function e.g. _SendTo_Install() then this UDF is for you. The UDF uses a Function from called _WinAPI_ShellGetSpecialFolderPath() which is able to retrieve many special folders within Windows, one of which is the SendTo folder. Have a look on MSDN for additional CSIDL identifiers that can be used with this Function. Any suggestions or comments, then please post below. Thanks. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _SendTo ; AutoIt Version : v3.2.12.1 or higher ; Language ......: English ; Description ...: Create a shortcut in the SendTo folder. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: Special thanks to Yashied for _WinAPI_ShellGetSpecialFolderPath, which can be found from WinAPIEx.au3 - http://www.autoitscript.com/forum/topic/98712-winapiex-udf ; =============================================================================================================================== ; #INCLUDES# ========================================================================================================= ; None ; #GLOBAL VARIABLES# ================================================================================================= ; None ; #CURRENT# ===================================================================================================================== ; _SendToFolder_Install: Creates a Shortcut in the SendTo folder. ; _SendToFolder_Uninstall: Deletes the Shortcut in the SendTo folder. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __SendTo_ShellGetSpecialFolderPath ......; Retrieves the path of a special folder. ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendTo_Install ; Description ...: Creates a Shortcut in the SendTo folder. ; Syntax ........: _SendTo_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCmdLine = '']]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sCmdLine - [optional] Additional file arguments. Default is ''. ; Return values .: Success - FileCreateShortcut() Return code. ; Failure - Returns 0 & sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _SendTo_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCmdLine = '') Local Const $bCSIDL_SENDTO = 0x0009 If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '.[^./]*$', '') If StringStripWS($sName, 8) = '' Or FileExists($sFilePath) = 0 Then Return SetError(1, 0, 0) EndIf _SendTo_Uninstall($sName, $sFilePath) ; Deletes The Shortcut In The SendTo folder. Local $sSendTo = __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) Return FileCreateShortcut($sFilePath, $sSendTo & '' & $sName & '.lnk', $sSendTo, $sCmdLine) EndFunc ;==>_SendTo_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendTo_Uninstall ; Description ...: Deletes the Shortcut in the SendTo folder. ; Syntax ........: _SendTo_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; Return values .: Success - FileClose() Return code ; Failure - Returns 0 & sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _SendTo_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath) Local Const $bCSIDL_SENDTO = 0x0009 Local $aFileGetShortcut = 0, $sFileName = '' If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '.[^./]*$', '') If StringStripWS($sName, 8) = '' Or FileExists($sFilePath) = 0 Then Return SetError(1, 0, 0) EndIf Local $iStringLen = StringLen($sName), $sSendTo = __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) Local $hSearch = FileFindFirstFile($sSendTo & '' & '*.lnk') If $hSearch = -1 Then Return SetError(1, 0, 0) EndIf While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop EndIf If StringLeft($sFileName, $iStringLen) = $sName Then $aFileGetShortcut = FileGetShortcut($sSendTo & '' & $sFileName) If @error Then ContinueLoop EndIf If $aFileGetShortcut[0] = $sFilePath Then FileDelete($sSendTo & '' & $sFileName) EndIf EndIf WEnd Return FileClose($hSearch) EndFunc ;==>_SendTo_Uninstall ; #INTERNAL_USE_ONLY#============================================================================================================ ; #FUNCTION# ==================================================================================================================== ; Name...........: __SendTo_ShellGetSpecialFolderPath renamed from _WinAPI_ShellGetSpecialFolderPath ; Description....: Retrieves the path of a special folder. ; Syntax.........: __SendTo_ShellGetSpecialFolderPath($CSIDL [, $fCreate = 0]) ; Parameters.....: $CSIDL - The CSIDL ($CSIDL_*) that identifies the folder of interest. ; $fCreate - Specifies whether the folder should be created if it does not already exist, valid values: ; |TRUE - The folder is created. ; |FALSE - The folder is not created. (Default) ; Return values..: Success - The full path of a special folder. ; Failure - Empty string and sets the @error flag to non-zero. ; Author.........: Yashied ; Modified.......: ; Remarks........: WinAPIEx.au3 - http://www.autoitscript.com/forum/topic/98712-winapiex-udf ; Related........: ; Link...........: @@MsdnLink@@ SHGetSpecialFolderPath ; Example........: Yes ; =============================================================================================================================== Func __SendTo_ShellGetSpecialFolderPath($CSIDL, $fCreate = 0) Local $tPath = DllStructCreate('wchar[1024]') Local $aReturn = DllCall('shell32.dll', 'int', 'SHGetSpecialFolderPathW', 'hwnd', 0, 'ptr', DllStructGetPtr($tPath), 'int', $CSIDL, 'int', $fCreate) If (@error) Or (Not $aReturn[0]) Then Return SetError(1, 0, '') EndIf Return DllStructGetData($tPath, 1) EndFunc ;==>__SendTo_ShellGetSpecialFolderPathExample 1: #include '_SendTo.au3' Example() Func Example() _SendTo_Install() ; Add the running EXE to the SendTo Folder. ShellExecute(_GetSendToFolder()) Sleep(5000) _SendTo_Uninstall() ; Remove the running EXE from the SendTo folder. EndFunc ;==>Example ; Retrieve the SendTo folder location. Func _GetSendToFolder() Local Const $bCSIDL_SENDTO = 0x0009 Return __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) EndFunc ;==>_GetSendToFolderAll of the above has been included in a ZIP file. SendTo.zip
    1 point
  4. Gianni

    just music

    just for fun a simple interface to http://mp3skull.com #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiEdit.au3> #include <GuiTab.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) ; some global variables Global $TabBrowser = False ; browser in a TabItem If $TabBrowser Then Global $oIE = _IECreateEmbedded() Else Global $oIE = _IECreate("http://mp3skull.com", 0, 0, 0, 0) ; run browser hidden EndIf Global $aLV_Click_Info Global $oForm Global $oInputFile Global $oQuery Global $oLinks = "" Local $Form1 = GUICreate("(web) Juke Box - (experimental)", 665, 545) GUISetOnEvent($GUI_EVENT_CLOSE, "Bye") Local $Label1 = GUICtrlCreateLabel("Type song title or artist to search and hit Enter", 8, 5, 650, 17) Global $Input1 = GUICtrlCreateInput("", 8, 24, 650, 21) GUICtrlSetTip(-1, "Insert a title here and hit 'Enter'") Global $StopButton = GUICtrlCreateButton("Stop playing music", 8, 522, 650, 21) GUICtrlSetOnEvent($StopButton, "StopButton") GUICtrlSetTip(-1, "Stop playing music") Global $compilation = GUICtrlCreateListView("Songs found", 8, 54, 650, 260) GUICtrlSetTip(-1, "DoubleClick on a link to play") _GUICtrlListView_SetColumnWidth($compilation, 0, 645) _GUICtrlListView_SetExtendedListViewStyle($compilation, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) ; show grid; select whole row ; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Local $PageControl1 = GUICtrlCreateTab(8, 320, 650, 200);Creates a "Tab control" for the GUI. ; Global $TabSheet1 = GUICtrlCreateTabItem("Info") ; First tab Local $Info = "hello" & @CRLF & "Type song title or artist name" & @CRLF & "in the InputBox at top and hit 'Enter'" & _ @CRLF & "then DoubleClick on list to play music" & @CRLF & @CRLF & "have fun." Local $InfoBox = GUICtrlCreateEdit($Info, 13, 345, 638, 168, $ES_READONLY) GUICtrlSetFont(-1, 18, 0, 0, "Lucida Console") GUICtrlSetBkColor(-1, 0xEEEEEE) ; Color of background GUICtrlSetColor(-1, 0xFF0000) ; color of font ; Global $TabSheet3 = GUICtrlCreateTabItem("Activity log") ; second tab Global $crtLog1 = GUICtrlCreateEdit("awaiting commands" & @CRLF, 13, 345, 638, 168);,$ES_READONLY) ;Sets the font for a control. GUICtrlSetFont(-1, 9, 0, 0, "Lucida Console") GUICtrlSetBkColor(-1, 0x000000) ; Color of background (black) GUICtrlSetColor(-1, 0x00FF00) ; color of font (green) ; If $TabBrowser Then Global $TabSheet2 = GUICtrlCreateTabItem("Browser") ; third tab GUICtrlCreateObj($oIE, 13, 345, 638, 168) _IENavigate($oIE, "http://mp3skull.com/") _IE_ref_refresh() EndIf ; GUICtrlCreateTabItem("") ; end of tabitem definitions GUISetState(@SW_SHOW) ; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ; ; Setup the "Enter" key management Global $getEnter = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "gotEnter") ; to call the function gotEnter() when Dummy control receives an "Enter" --+ Global $a_AccelKeys[1][2] = [["{ENTER}", $getEnter]] ; send the "Enter" keypresses to the Dummy control | GUISetAccelerators($a_AccelKeys) ; | ; | Func gotEnter() ; Here we manage the enter key <--------------------------------+ LogPrint("-> enter pressed somewhere" & @CRLF) If _GuiCtrlGetFocus($Form1) = $Input1 Then ; was cursor in control $Input1? _MyEnterFunc() ; if yes then call my enter function Else ; prosecute ahead the "Enter" key to the proper control GUISetAccelerators("") ControlSend($Form1, "", _GuiCtrlGetFocus($Form1), "{ENTER}") GUISetAccelerators($a_AccelKeys) EndIf EndFunc ;==>gotEnter Func _GuiCtrlGetFocus($hGui = "") ; Retrieves the internal handle of the control with the focus Local $InputID = ControlGetHandle($hGui, "", ControlGetFocus($hGui)) Return _ControlGetGuiID($InputID) ; --------------------------+ EndFunc ;==>_GuiCtrlGetFocus ; | Func _ControlGetGuiID($hCtrl) ; Transforms from Handle to ID <----+ Local $Result = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hCtrl) If @error = 0 Then Return $Result[0] Return SetError(1, 0, '') EndFunc ;==>_ControlGetGuiID ; GUIRegisterMsg($WM_NOTIFY, "_Check_Click") ; Register a user defined function for a known Windows Message ID (WM_MSG). ---------+ ; | ; WM_NOTIFY event handler for click example: http://www.autoitscript.com/forum/topic/143900-listview-onclick/#entry1013670 <---+ Func _Check_Click($hWnd, $iMsg, $iwParam, $ilParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) Local $hList = GUICtrlGetHandle($compilation) ; $fDblClk = False If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $hList And DllStructGetData($tNMHDR, "Code") = $NM_CLICK Then ; event is from $hList and it is a $NM_CLICK ; is a Click $aLV_Click_Info = _GUICtrlListView_SubItemHitTest($hList) If $aLV_Click_Info[0] <> -1 Then LogPrint("Click on " & _GUICtrlListView_GetItemText($hList, $aLV_Click_Info[0]) & @CRLF) Else LogPrint("Click on empty" & @CRLF) EndIf EndIf ; what follows will check if it is a doubleClick and if is comming from the listview If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $hList And DllStructGetData($tNMHDR, "Code") = $NM_DBLCLK Then ; event is from $hList and it is a $NM_DBLCLK ; is a DoubleClick $aLV_Click_Info = _GUICtrlListView_SubItemHitTest($hList) If $aLV_Click_Info[0] <> -1 Then LogPrint("DoubleClick on " & _GUICtrlListView_GetItemText($hList, $aLV_Click_Info[0]) & @CRLF) Else LogPrint("DoubleClick on empty" & @CRLF) EndIf SoundPlay("") SoundPlay(_GUICtrlListView_GetItemText($hList, $aLV_Click_Info[0])) ControlFocus("", "", $Input1) ; set focus on Input1 EndIf Return ; $GUI_RUNDEFMSG EndFunc ;==>_Check_Click ControlFocus("", "", $Input1) ; set focus on Input1 ; ---- MAIN LOOP ---- While 1 Sleep(1000) WEnd ; ---- END MAIN LOOP ---- Func _MyEnterFunc() ; This function is called everytime the "Enter" key is pressed in the $Input1 control Local $qry = _GUICtrlEdit_GetText($Input1) LogPrint('received "' & $qry & '" passing request to browser.....' & @CRLF) _IE_ref_refresh() _IEFormElementSetValue($oInputFile, $qry) _IEAction($oQuery, "click") Do Until Not _IEPropertyGet($oIE, "busy") LogPrint("Query sent using http://mp3skull.com" & @CRLF) _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($compilation)) $oLinks = "" LogPrint("wait response for 3 seconds" & @CRLF) Sleep(3000) $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended LogPrint("Links loaded " & @CRLF) _IEAction($oIE, "stop") Local $row = 0 If $iNumLinks Then For $oLink In $oLinks If StringRight($oLink.href, 4) = ".mp3" Then _GUICtrlListView_AddItem($compilation, $oLink.href, $row) $row += 1 EndIf Next EndIf LogPrint("ListView populated with " & $row & " songs" & @CRLF) ControlFocus("", "", $Input1) ; set focus on Input1 EndFunc ;==>_MyEnterFunc Func StopButton() SoundPlay("") ; Stop playing music EndFunc ;==>StopButton Func LogPrint($line) ; _GUICtrlTab_ActivateTab($PageControl1,1) _GUICtrlTab_SetCurFocus($PageControl1, 1) If StringLen(GUICtrlRead($crtLog1)) > 25000 Then ; Max Len of a CtrlBox is 30000 char _GUICtrlEdit_SetText($crtLog1, StringRight(GUICtrlRead($crtLog1), 20000)) ; short the content of CtrlBox to 20000 char EndIf _GUICtrlEdit_AppendText($crtLog1, @HOUR & ":" & @MIN & ":" & @SEC & " " & $line) EndFunc ;==>LogPrint Func _IE_ref_refresh() ; http://mp3skull.com ; <form id="f1" method="GET" action="/search.php" $oForm = _IEFormGetObjByName($oIE, "f1") ; <input id="sfrm" type="text" style="font-size:18px; vertical-align:middle; width:470px;" value="" autocomplete="off" name="q"></input> $oInputFile = _IEFormElementGetObjByName($oForm, "sfrm") ; <input id="search_button" type="submit" style="font-size:18px; vertical-align:middle;" value="Search"></input> $oQuery = _IEFormElementGetObjByName($oForm, "search_button") EndFunc ;==>_IE_ref_refresh Func Bye() _IEQuit($oIE) Exit EndFunc ;==>Bye EDIT: bug removed from listing (thanks to >UEZ)
    1 point
  5. mikell

    help in making a bot

    You got it
    1 point
  6. I should have removed it when it was deprecated, but I was being too nice for those who needed time to upgrade their scripts (don't I regret that decision now). You're welcome to use outdated code in your own scripts, just don't let you bad habits leak onto the Forums in the future please. To all, I provided an alternative StringEncrypt() in _Crypt_EncryptData(), though it's not backwards compatible with _StringEncrypt().
    1 point
  7. Updated both examples by replacing 4096 with the constant variable $MB_SYSTEMMODAL and chaged the return value datatype of the PID from a double to a Int32 number.
    1 point
×
×
  • Create New...