SpinningCone 0 Posted May 5, 2010 OK back story. i frequently copy from the web to email and hated that outlook grabs the text formatting, tired of using the notepad trick I wrote a simple script to strip the formatting from my clipboard HotKeySet("+^{v}", "copyPlain") while 1 sleep(50) wend func copyPlain() $temp = ClipGet() ClipPut($temp) send("^v") EndFunc I love this script it saves me loads of time, works great. now i also frequently use the double click method to highlight text in my browser and then copy it to another location. this often grabs a trailing whitespace that i often need to delete. so i figured i would modify my copy plain script to strip leading and trailing whitespace as well as strip formatting. HotKeySet("+^{v}", "copyPlain") while 1 sleep(50) wend func copyPlain() $temp = ClipGet() ConsoleWrite($temp & "[end]" & @crlf) StringStripWS($temp, 3) ConsoleWrite($temp & "[end]" & @crlf & @crlf) ClipPut($temp) send("^v") EndFunc seems simple enough just use stringstripws on temp before sticking it back in ther. problem is it doesnt work. i get that trailing space anyway. am i missing something? is the contents sent by clipget not actually a string? Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted May 5, 2010 (edited) StringStripWS returns the new string, not modifies the parameter, see helpfile So you could do like: $temp = StringStripWS($temp, 3) Edited May 5, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
Melba23 3,452 Posted May 5, 2010 SpinningCone,You need to save the result of the StringStripWS command: HotKeySet("+^{v}", "copyPlain") While 1 Sleep(50) WEnd Func copyPlain() $temp = ClipGet() ConsoleWrite($temp & "[end]" & @CRLF) $NewTemp = StringStripWS($temp, 3) ConsoleWrite($NewTemp & "[end]" & @CRLF & @CRLF) ClipPut($NewTemp) Send("^v") EndFunc ;==>copyPlainM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
SpinningCone 0 Posted May 5, 2010 *sigh* i knew it was something stupid like that. think i need to go make a cup of coffee now. :-p Share this post Link to post Share on other sites