erikson Posted November 21, 2009 Share Posted November 21, 2009 Hi all, i try to make a script that copy some selected text and with a press on a hotkey will write that text in a .txt file. Can you give some hints where to start? Link to comment Share on other sites More sharing options...
water Posted November 21, 2009 Share Posted November 21, 2009 You already found the solution Open the AutoIt help and search for "Hotkey". If you need example scripts please search the forum for "hotkey" or even "hotkey copy paste". This will get you started. If you then have some code and still have questions please post question and code and we will try to help. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erikson Posted November 21, 2009 Author Share Posted November 21, 2009 belive me that i first search the help file and the forum, but i don`t fine anything helpful ... Link to comment Share on other sites More sharing options...
water Posted November 21, 2009 Share Posted November 21, 2009 Ok, to get you started. I use the following code in my scripts to mimic Ctrl+A (mark all) and Ctrl+C (copy to clipboard): expandcollapse popup; Set two Dummy fields in the GUI Global $hButtonStrgA = GUICtrlCreateDummy() Global $hButtonStrgC = GUICtrlCreateDummy() ; Set accelerators for Strg+a and Strg+c Global $asAccelKeys[2][2] = [["^a", $hButtonStrgA],["^c", $hButtonStrgC]] GUISetAccelerators($asAccelKeys) While 1 $vMsg = GUIGetMsg(1) Case $vMsg[0] = $hButtonStrgA _SelectAll() Case $vMsg[0] = $hButtonStrgC _Clipboard() EndSelect WEnd Func _SelectAll() ; Mark all Entries in SysListView If ControlGetFocus($hForm1) = "SysListView321" Then _GUICtrlListView_SetItemSelected($hGUIUserList, -1, True) EndIf EndFunc ;==>_SelectAll Func _Clipboard() ; Copy selected items to clipboard $vZf = _GetSelectedItems() If $vZf = "" Then MsgBox(16, $sFormTitle, "Sie haben keine Datensätze ausgewählt!") Return EndIf ClipPut(StringStripWS($vZf, 2)) EndFunc ;==>_Clipboard My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erikson Posted November 21, 2009 Author Share Posted November 21, 2009 (edited) . Edited November 21, 2009 by erikson Link to comment Share on other sites More sharing options...
erikson Posted November 21, 2009 Author Share Posted November 21, 2009 So i figured out a little bit hotkeyset ("{ESC}", "copy") sleep (100) func copy() Send("{LCTRL}") ;Holds the A key down send ("{c}" ) Send("{LCTRL}") ;Releases the A key endfunc $bak = ClipGet() MsgBox(0, "Clipboard contains:", $bak) $file= "G:\1.txt" fileopen ($file, 1) filewrite ($file , $bak ) fileclose ($file) the question is , how do i make to run function only when i press ESC key Link to comment Share on other sites More sharing options...
water Posted November 21, 2009 Share Posted November 21, 2009 Yes, this is just a code snipped and no complete solution for your problem. The snipped shows how to establish CTRL+A and CTRL+C in a GUI. The functions _SelectAll and _Clipboard are tailored to my needs. They definitely have to be adapted by you. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now