Thanks for this, Peter, I’m going to give it a try…
> On Aug 21, 2016, at 9:26 AM, Peter M. Brigham <pmb...@gmail.com> wrote: > > Sorry, forgot to include the little utility script q(): > > on q tString > return quote and tString and quote > end q > > The full frontscript then is: > > ------- > > on controlkeydown whichKey > -- put this in a frontscript universally available in LC > put the long name of the target into tarName > put the shiftkey is down into shK > switch whichKey > case "'" -- put quotes around the selection > if not shK then pass controlkeydown > if "field" is not in tarName then pass controlkeydown > if "revNewScriptEditor" is not in tarName then pass controlkeydown > -- you could take the above line out if you want this in all LC fields > get the selection > put q(it) into the selection > if it = "" then > put the selectedChunk into tSel > put word 4 of tSel into word 2 of tSel > put (word 4 of tSel) - 1 into word 4 of tSel > select tSel > end if > break > case "9" > case "0" -- put parens around the selection > if not shK then pass controlkeydown > if "field" is not in tarName then pass controlkeydown > if "revNewScriptEditor" is not in tarName then pass controlkeydown > -- you could take the above line out if you want this in all LC fields > get the selection > put "(" & it & ")" into the selection > if it = "" then > put the selectedChunk into tSel > put word 4 of tSel into word 2 of tSel > put (word 4 of tSel) - 1 into word 4 of tSel > select tSel > end if > break > case "[" > case "]" -- put brackets around the selection > if not shK then pass controlkeydown > if "field" is not in tarName then pass controlkeydown > if "revNewScriptEditor" is not in tarName then pass controlkeydown > -- you could take the above line out if you want this in all LC fields > get the selection > put "[" & it & "]" into the selection > if it = "" then > put the selectedChunk into tSel > put word 4 of tSel into word 2 of tSel > put (word 4 of tSel) - 1 into word 4 of tSel > select tSel > end if > break > case " " -- scriptPaint > if not shK then pass controlkeydown > if "field" is not in tarName then pass controlkeydown > if "revNewScriptEditor" is not in tarName then pass controlkeydown > put the mouseText into the selection > break > case "d" > -- insert date > put the shiftKey is down into wantLongDate > insertDate wantLongDate > break > case "i" -- getPaint > if not shK then exit controlkeydown > if the selobj = "" then > answer "Select an image first." > exit controlkeydown > else if word 1 of (the name of the selobj) <> "image" then > answer "You must select an image." > exit controlkeydown > end if > answer file "Choose replacement image:" > if it = empty then exit to top > put url ("binfile:" & it) into the selobj > break > default > pass controlkeydown > end switch > end controlkeydown > > on insertDate getLongDate > -- control-d inserts short date, control-shift-d inserts long date > -- see the controlkeydown handler for implementation > -- note: Windows users can implement this with other modifier keys > -- put these scripts into a frontscript so it is available anywhere in LC > -- requires controlkeydown > > put the selectedChunk into selCh > if selCh = empty then exit insertDate > put word -1 of selCh into fldNbr > put word 4 of selCh into theCharNbr > put the selectedtext into selText > put length(selText) into origLength > if getLongDate then > -- long date > put sr(item 2 to 3 of the long date) into tDate > else > -- short date > put the short date into tDate > end if > put tDate into the selectedchunk > select after char (theCharNbr + length(tDate) - origLength) of fld fldNbr > end insertDate > > on q tString > return quote and tString and quote > end q > > ------- > > -- Peter > > Peter M. Brigham > pmb...@gmail.com > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode