Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/08/2013 in all areas

  1. AZJIO

    ButtonBar

    ButtonBar v0.7.6 (En, Ru) Drag the shortcut or file or folder on the toolbar. Button appears on the panel and saved in ButtonBar.ini. The left side of the panel is intended to drag the panel and has a context menu with "Exit", "always on top." It supports all file formats, folder (with support for icons). If the icon does not match, then remove the "-" symbol before the number of icons screenshot ButtonBar.7z (sources + EXE)
    2 points
  2. Here you go : #include <WindowsConstants.au3> #include <StaticConstants.au3> #region GUI Global $hGUI_Main = GUICreate("") Global $hGUI_Child = GUICreate("MyGUI", 400, 70, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, $hGUI_Main) GUISetBkColor(0x000000, $hGUI_Child) Local $iMyLabel = GUICtrlCreateLabel("Good news Dave, I can do that.", 0, 0, 400, 70, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetColor($iMyLabel, 0xFFFFFF) GUICtrlSetFont($iMyLabel, 17) _GuiRoundCorners($hGUI_Child, 0, 0, 7, 7) WinSetTrans($hGUI_Child, "", 0) GUISetState(@SW_SHOW, $hGUI_Child) #endregion For $i = 0 To 150 Step 8 WinSetTrans($hGUI_Child, "", $i) Sleep(10) Next AdlibRegister("_Exit", 5000) While 1 Sleep(1000) WEnd Func _GuiRoundCorners($hWnd, $iLeftRect, $iTopRect, $iWidthEllipse, $iHeightEllipse) Local $aPos = 0, $aRet = 0 $aPos = WinGetPos($hWnd) $aRet = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $iLeftRect, "long", $iTopRect, "long", $aPos[2], "long", $aPos[3], "long", $iWidthEllipse, "long", $iHeightEllipse) If Not @error And $aRet[0] Then $aRet = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aRet[0], "int", 1) If Not @error And $aRet[0] Then Return 1 EndIf Return 0 EndFunc ;==>_GuiRoundCorners Func _Exit() AdlibUnRegister("_Exit") For $i = 150 To 0 Step -4 WinSetTrans($hGUI_Child, "", $i) Sleep(10) Next GUIDelete($hGUI_Main) Exit EndFunc Edit: Added indents. Note: Don't forget to take a look at Melba's UDF, you should find some good inspirations Br, FireFox.
    2 points
  3. Hi All I know most of people want the recorder, as i search on the forum, all recorder is click by position and this one is click by window and control item, also it can detect IE and generate autoit script to fill ie form. Most of source code is copied from internet and it is not written by me. It help me a lot on my job and for Web development and QA task when it run, it will generate the au3 file and that is what you did. Please note that it cannot generate 100% autoit script for you but i think it help you wrote around 70% of automation coding, and the rest please do it on your own recorder.zip Some special key / function Esc - Stop Recording Pause / Break - Pause recording F2 - initial / insert Sleep function Scroll Lock - Control Click Mode / Position Mouse Click Mode
    1 point
  4. LarsJ

    The Favorites Menu

    (The title of this example was originally "The Shell/Custom Favorites/Programs Menus".) This is an implementation of the Shell Favorites and Programs menus with the IShellMenu interface. The purpose of this menu system is to create a popup menu from a directory structure consisting of subfolders and internet or program links. The menu will look like the Favorites menu in Internet or Windows Explorer (as it looked when XP SP2 was released in August 2004). The IShellMenu interface can generally be used to create a menu from a directory structure. The menu items will be supplied with the same icons as the link files and they will be supplied with tooltips too. When you click a menu item the command associated with the internet or program link will be executed. The Favorites and Programs menus will create popup menus from the directory structures given by $CSIDL_FAVORITES, $CSIDL_PROGRAMS, $CSIDL_STARTMENU, $CSIDL_COMMON_PROGRAMS, $CSIDL_COMMON_STARTMENU. The Custom Favorites and Custom Programs menus can be used to create custom popup menus from custom directory structures. Note that the context (right click) menu is working in the Favorites menu. Update #4 2014-05-03: AutoIt 3.3.10 This example was created under 3.3.8 and based on APIConstants.au3 and WinAPIEx.au3 by Yashied. The original example runs under 3.3.10 without any changes at all. But a lot of unused constants and functions are included. In 3.3.10 the two UDFs are divided into several smaller UDFs. This makes it much easier to just include, what is needed. This update only includes the necessary UDFs. You find the new and old zip in bottom of the post. Update #3 2012-11-06: Programs menus Added the Programs menus from the directory structures given by $CSIDL_PROGRAMS, $CSIDL_STARTMENU, $CSIDL_COMMON_PROGRAMS, $CSIDL_COMMON_STARTMENU. To create a menu like the "All Programs" menu copy the two "Start Menu" folders (your own + "All Users") to the "Custom Programs 1" folder and overwrite the existing "Start Menu" folder. Then select the menu item "Custom Programs | Custom Programs 1". Update #2 2012-11-03: Custom Favorites menus If you are creating an AutoIt program and want to add a custom Favorites menu with relevant internet links all you have to do is to create a directory structure, add the subfolders (optional) and links and call the ShowFavsProgsMenu() function with a path to the directory. And you will get a menu that looks like and works like the Favorites menu in Internet Explorer. You can see two custom Favorites menus in the examples. Added two small directory structures to the zip to be used for the custom Favorites menus. Fixed an error: OleInitialize() is used to initialize COM in stead of CoInitialize() (necessary to make the Copy command in the context menu work). Update #1 2012-11-01: Window procedure Because a popup menu like the Favorites menu is modal, it's necessary to use some kind of a window procedure to catch the menu messages. When it's a popup menu it should be enough to have the window procedure running while the popup menu is displayed. In the original scripts the window procedure was created with these commands: $hNewWinProc = DllCallbackRegister( "NewWindowProc", "int", "hwnd;uint;wparam;lparam" ) ; New window procedure $hOldWinProc = _WinAPI_SetWindowLong( $hGui, $GWL_WNDPROC, DllCallbackGetPtr( $hNewWinProc ) ) ; Old window procedureThe procedure was started in the main script in the example and was running as long as the script was running. In this update the menu messages is catched with a hook procedure: $hFavMenuMsg = DllCallbackRegister( "FavMenuMsg", "long", "int;wparam;lparam" ) $hFavMenuMsgHook = _WinAPI_SetWindowsHookEx( $WH_MSGFILTER, DllCallbackGetPtr( $hFavMenuMsg ), 0, _WinAPI_GetCurrentThreadId() ) ; $WH_MSGFILTER installs a hook procedure that monitors messages generated as a ; result of an input event in a dialog box, message box, menu, or scroll bar.The procedure is started in the bottom of the ShowFavoritesMenu() function immediately after the Favorites menu is displayed on the screen, and the procedure is stopped when the menu disappears from the screen. Either because the menu is cancelled or a selection is made. (If you comment out these commands in ShellFavoritesMenu.au3 the Favorites menu will still show up. But the submenus will not be expanded if you keep the mouse steady over a submenu or use the arrow keys.) This hook procedure is much better than the original window procedure. It's much easier to integrate the Favorites menu in other programs when it isn't depending on a "global" window procedure. A "global" window procedure can also have some influence on the GUI (at least on XP, I think it's better on 7). In the original example you saw it clearly when the GUI lost focus. When the GUI got focus back the upper line of the edit box could be behind the toolbar. This is not a problem with a hook procedure only running when the Favorites menu is displayed. Added an example with a menu. Zip updated. First post 2012-10-30 This is an implementation of the Favorites menu primary with the IShellMenu interface but several other interfaces are used as well. The main function: Func ShowFavoritesMenu( $hWnd, $hMenu, $xCoord, $yCoord ) ; --- Create a menu band object and the IShellMenu interface --- Local $oIShellMenu, $pIShellMenu ; Create a menu band object and get a pointer to the IShellMenu interface CoCreateInstance( $tCLSID_MenuBand, $NULL, $CLSCTX_INPROC_SERVER, $tRIID_IShellMenu, $pIShellMenu ) $oIShellMenu = ObjCreateInterface( $pIShellMenu, $sIID_IShellMenu, $dtag_IShellMenu ) If Not IsObj( $oIShellMenu ) Then Return SetError(1,0,0) ; --- Initialize the interface --- If $oIShellMenu.Initialize( $NULL, -1, $ANCESTORDEFAULT, BitOR( $SMINIT_TOPLEVEL, $SMINIT_VERTICAL ) ) <> $S_OK Then Return SetError(2,0,0) ; --- Specify the folder for the menu band to browse --- ; Get a pointer to the IShellFolder interface for the desktop Local $pIShellFolder = $NULL, $oIShellFolderDesktop, $pIShellFolderDesktop, $pidlRel SHGetDesktopFolder( $pIShellFolderDesktop ) SHGetSpecialFolderLocation( $NULL, $CSIDL_FAVORITES, $pidlRel ) $oIShellFolderDesktop = ObjCreateInterface( $pIShellFolderDesktop, $sIID_IShellFolder, $dtag_IShellFolder ) $oIShellFolderDesktop.BindToObject( $pidlRel, $NULL, $tRIID_IShellFolder, $pIShellFolder ) If $pIShellFolder = $NULL Then Return SetError(3,0,0) ; Get the registry key with the "Order" value of the Favorites folder Local $hRegOrder = _WinAPI_RegOpenKey( $HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites", $KEY_READ ) If $hRegOrder = 0 Then Return SetError(4,0,0) ; Specify the folder for the menu band to browse If $oIShellMenu.SetShellFolder( $pIShellFolder, $pidlRel, $hRegOrder, BitOR( $SMSET_BOTTOM, $SMSET_USEBKICONEXTRACTION ) ) <> $S_OK Then Return SetError(5,0,0) _WinAPI_CoTaskMemFree( $pidlRel ) _WinAPI_RegCloseKey( $hRegOrder ) ; --- Append a static menu to the menu band --- If $oIShellMenu.SetMenu( $hMenu, $hWnd, $SMSET_TOP ) <> $S_OK Then Return SetError(6,0,0) ; --- Get access to IMenuPopup, IDeskBar and IDeskBand interfaces --- Local $pIMenuPopup, $pIDeskBar, $pIDeskBand ; The IMenuPopup interface If $pIShellMenu Then If $oIShellMenu.QueryInterface( $tRIID_IMenuPopup, $pIMenuPopup ) <> $S_OK Then Return SetError(7,0,0) EndIf ; The IDeskBar interface If $pIMenuPopup Then Local $oIMenuPopup = ObjCreateInterface( $pIMenuPopup, $sIID_IMenuPopup, $dtag_IMenuPopup ) If $oIMenuPopup.QueryInterface( $tRIID_IDeskBar, $pIDeskBar ) <> $S_OK Then Return SetError(8,0,0) EndIf ; The IDeskBand interface If $pIDeskBar Then Local $oIDeskBar = ObjCreateInterface( $pIDeskBar, $sIID_IDeskBar, $dtag_IDeskBar ) If $oIDeskBar.QueryInterface( $tRIID_IDeskBand, $pIDeskBand ) <> $S_OK Then Return SetError(9,0,0) EndIf ; --- Create a menu desk bar object and the IMenuPopup interface --- Local $oIUnknown, $pIUnknown, $oIMenuPopup, $pIMenuPopup ; Create a menu desk bar object and get a pointer to the IUnknown interface CoCreateInstance( $tCLSID_MenuDeskBar, $NULL, $CLSCTX_INPROC_SERVER, $tRIID_IUnknown, $pIUnknown ) $oIUnknown = ObjCreateInterface( $pIUnknown, $sIID_IUnknown, $dtag_IUnknown ) ; Create the IMenuPopup interface $oIUnknown.QueryInterface( $tRIID_IMenuPopup, $pIMenuPopup ) $oIMenuPopup = ObjCreateInterface( $pIMenuPopup, $sIID_IMenuPopup, $dtag_IMenuPopup ) If Not IsObj( $oIMenuPopup ) Then Return SetError(10,0,0) ; --- Create a menu band site object and the IBandSite interface --- Local $oIBandSite, $pIBandSite ; Create a menu band site object and get a pointer to the IBandSite interface CoCreateInstance( $tCLSID_MenuBandSite, $NULL, $CLSCTX_INPROC_SERVER, $tRIID_IBandSite, $pIBandSite ) $oIBandSite = ObjCreateInterface( $pIBandSite, $sIID_IBandSite, $dtag_IBandSite ) If Not IsObj( $oIBandSite ) Then Return SetError(11,0,0) ; --- Set the band site object as client for the desk bar object --- If $oIMenuPopup.SetClient( $pIBandSite ) <> $S_OK Then Return SetError(12,0,0) ; --- Add the desk band object to the band site object --- If $oIBandSite.AddBand( $pIDeskBand ) <> $S_OK Then Return SetError(13,0,0) ; --- Show the Favorites menu --- Local $tPOINT = DllStructCreate( $tagPOINT ) DllStructSetData( $tPOINT, "X", $xCoord ) DllStructSetData( $tPOINT, "Y", $yCoord ) Local $tRECT = DllStructCreate( $tagRECT ) DllStructSetData( $tRECT, "Left", $xCoord ) DllStructSetData( $tRECT, "Top", $yCoord+1 ) DllStructSetData( $tRECT, "Right", $xCoord ) DllStructSetData( $tRECT, "Bottom", $yCoord+1 ) $oIMenuPopup.Popup( $tPOINT, $tRECT, $MPPF_ALIGN_RIGHT ) ; --- Create the IMenuBand interface --- Local $oIDeskBand $oIDeskBand = ObjCreateInterface( $pIDeskBand, $sIID_IDeskBand, $dtag_IDeskBand ) $oIDeskBand.QueryInterface( $tRIID_IMenuBand, $pIMenuBand ) $oIMenuBand = ObjCreateInterface( $pIMenuBand, $sIID_IMenuBand, $dtag_IMenuBand ) If Not IsObj( $oIMenuBand ) Then Return SetError(14,0,0) ; $oIMenuBand and $pIMenuBand are global variables ; $oIMenuBand is used to handle the messages from the Favorites menu in the function below ; $pIMenuBand is used to test if the Favorites menu is open ($pIMenuBand <> $NULL) Return 0 EndFunc Example The zip contains the example as you can see in the picture. There are two versions of the example: A version based on a toolbar (ExShellFavsProgsMenus.au3), and a version based on a menu bar (ExShellFavsProgsMenus2.au3). The purpose of the text box is just to have something to put in the window. The zip contains also the ShellFavsProgsMenus.au3 UDF. This zip contains the original scripts for 3.3.8. You need APIConstants.au3 and WinAPIEx.au3 by Yashied. The UDFs are not included in the zip. The zip can be opened with 7-Zip. ShellFavsProgsMenus.zip This zip contains the updated scripts for 3.3.10. Only a matter of UDFs. These scripts will not run under 3.3.8. TheFavoritesMenu.7z Testet on XP 32 bit and Win 7 32/64 bit.
    1 point
  5. Of course Edit: I edited the previous post to be more precise.
    1 point
  6. @PlayHD Why? By declaring your variables you define their scope, and the compiler (at least the executable interpreter) has not to do the job for you.
    1 point
  7. CatKaiser, Welcome to the AutoIt forum. I am sorry that your first contact with AutoIt has been in such unpleasant circumstances. However, AutoIt itself is not a virus - however some AV companies flag compiled AutoIt executables as such. This is because every compiled AutoIt executable uses the same interpreter stub to run - so when someone does write malware in AutoIt they also implicate every other AutoIt script. Alas there is nothing that we can do about it - we have repeatedly informed the AV companies of this problem but they still flag AutoIt on occasion. As AutoIt is widely used I am afraid there is no way that you can trace the origins of this script unless you are very lucky. All I can do is suggest that you use reputable AV software to prevent future infections. Bear in mind that all languages can produce malware - so please do not blame AutoIt itself. As you can see from the Forum rules (there is also a link at bottom right of each page) we do not support the coding of malware with AutoIt on this forum - but unfortunately we cannot prevent others from misusing it. However, I believe that that the good uses of AutoIt far outweigh the bad - even if that is small comfort to you. I hope that is a good enough explanation. M23
    1 point
  8. Sure, this is what I had. Haven't touched it since the original playing around since the GUI issues discouraged me too much and got busy with other things. This would definitely need a lot of cleaning up and more error handling, but this was a working model... I tried to take out everything except the parts that really pertain to the authorization and using it. You can piece it together depending on your application. Func Authorize($verifier_input = "") If $verifier_input = "" Then ; initial auth setup $path = "/oauth/request_token" $postdata = "oauth_consumer_key=" & $oauth_consumer_key $header = 'Authorization: OAuth oauth_consumer_key="' & $oauth_consumer_key & '"' $header &= ',oauth_signature_method="PLAINTEXT"' $header &= ',oauth_timestamp="' & Timestamp() & '"' $header &= ',oauth_nonce="' & Nonce() & '"' $header &= ',oauth_signature="' & $oauth_signature & '"' $response = MakeRequest("POST", $path, $postdata, $header) SetTokenStrings($response[1]) $path = "/oauth/authorize" $postdata = $response[1] $header = "" $link = "https://" & $host & $path & "?" & $postdata ShellExecute($link) Else ; returning setup, process verifier $oauth_verifier = $verifier_input $path = "/oauth/access_token" $postdata = "oauth_consumer_key=" & $oauth_consumer_key $header = 'Authorization: OAuth oauth_consumer_key="' & $oauth_consumer_key & '"' $header &= ',oauth_token="' & $oauth_token & '"' $header &= ',oauth_signature_method="PLAINTEXT"' $header &= ',oauth_timestamp="' & Timestamp() & '"' $header &= ',oauth_nonce="' & Nonce() & '"' $header &= ',oauth_signature="' & $oauth_signature & '"' $header &= ',oauth_verifier="' & $oauth_verifier & '"' $response = MakeRequest("POST", $path, $postdata, $header) SetTokenStrings($response[1]) IniWrite($ini, "auth", "tk", $oauth_token) IniWrite($ini, "auth", "sig", $oauth_signature) AuthStuff("HIDE") Refresh() EndIf EndFunc Func Refresh() ; make sure it isn't too recent first If Timestamp() - $last_refresh > 44 Then $last_refresh = Timestamp() $path = "/api/v1/messages.xml" $postdata = "" $header = 'Authorization: OAuth oauth_consumer_key="' & $oauth_consumer_key & '"' $header &= ',oauth_token="' & $oauth_token & '"' $header &= ',oauth_signature_method="PLAINTEXT"' $header &= ',oauth_timestamp="' & Timestamp() & '"' $header &= ',oauth_nonce="' & Nonce() & '"' $header &= ',oauth_signature="' & $oauth_signature & '"' $response = MakeRequest("GET", $path, $postdata, $header) $last_xml = $response[1] Else MsgBox(0, "", "Too soon to refresh!") EndIf _XMLLoadXML($last_xml) $nNodes = _XMLGetNodeCount("/response/messages/message") For $i = 1 To $nNodes $body = _XMLGetValue("/response/messages/message[" & $i & "]/body/plain") $text = $body[1] Next EndFunc Func Post($s) $path = "/api/v1/messages.xml" $postdata = "body=" & $s ; need to encode this $header = 'Authorization: OAuth oauth_consumer_key="' & $oauth_consumer_key & '"' $header &= ',oauth_token="' & $oauth_token & '"' $header &= ',oauth_signature_method="PLAINTEXT"' $header &= ',oauth_timestamp="' & Timestamp() & '"' $header &= ',oauth_nonce="' & Nonce() & '"' $header &= ',oauth_signature="' & $oauth_signature & '"' $header &= ' Content-Type: application/x-www-form-urlencoded' $response = MakeRequest("POST", $path, $postdata, $header) _ArrayDisplay($response) ;~ Refresh() EndFunc Func Startup() ; see if ini file is there first If Not FileExists($ini) Then FileOpen($ini, 10) FileClose($ini) EndIf $temp_token = IniRead($ini, "auth", "tk", "") $temp_signature = IniRead($ini, "auth", "sig", "") If $temp_token = "" Then ; if blank, do initial authorization first AuthStuff("SHOW") MsgBox(16, "Initial setup required", "It appears that you have not set up authorization.") Authorize() Else $oauth_token = $temp_token $oauth_signature = $temp_signature ;~ Refresh() EndIf EndFunc Func MakeRequest($req_type, $req_path, $req_postdata, $req_header, $req_return_type = 1) ; set up connection, pass arguments and return something ... options for returning? Local $t_or_f Switch $req_return_type Case 1 ; default return type $t_or_f = "True" Case 2 $t_or_f = "False" EndSwitch Local $session = _WinHttpOpen() Local $connection = _WinHttpConnect($session, $host) Local $response = _WinHttpSimpleSSLRequest($connection, $req_type, $req_path, $req_postdata, Default, $req_header, $t_or_f) _WinHttpCloseHandle($connection) _WinHttpCloseHandle($session) Return $response EndFunc Func SetTokenStrings($s) ; we need oauth_token and oauth_token_secret from string and might be out of order $aResponse = StringSplit($s, "&") For $i = 0 To UBound($aResponse) -1 If StringInStr($aResponse[$i], "oauth_token=") Then $oauth_token = StringReplace($aResponse[$i], "oauth_token=", "") ElseIf StringInStr($aResponse[$i], "oauth_token_secret=") Then $oauth_token_secret = StringReplace($aResponse[$i], "oauth_token_secret=", "") EndIf Next $oauth_signature = $oauth_consumer_secret & "%26" & $oauth_token_secret EndFunc Func Timestamp() Local $rslt = DllCall("msvcrt.dll", "int:cdecl", "time", "int", 0) If @error = 0 Then Return $rslt[0] Return -1 EndFunc Func Nonce() Return Random(100000000, 999999999, 1) EndFunc
    1 point
×
×
  • Create New...