[JS, Win/Mac] The Clipboard string variable?

Hello

I want to put the contents of a string variable to the system Clipboard. For Mac, it is simple via AppleScript, but how this might work for windows? I searched and read all relevant messages and did some research with google.

Here is my potion of the code:

// copy to clipboard
if ( $.os.toLowerCase().indexOf('mac') >= 0 ) {  
    app.doScript ( 'set the clipboard to item 1 of arguments', ScriptLanguage.applescriptLanguage, [_stringOUT] );  // mac
} else {
    app.doScript ( 'echo ' + _stringOUT + ' | clip', ScriptLanguage.visualBasic );  // win
}

One of my friends has tested the Windows part - I work only on a Mac-, but it does not work. Is someone can you please help me understand this?

Thank you!

Tobias

After a long search, I think I finally did:

_OUT = "Ich bin ein Copy-Paste-Test.";
if ( $.os.toLowerCase().indexOf('mac') >= 0 ) {  // widows to clipboard
    app.doScript ( 'set the clipboard to item 1 of arguments', ScriptLanguage.applescriptLanguage, [_OUT] );  // mac
} else {
    app.doScript ( 'Dim theObject\r Set theObject = CreateObject (\"htmlfile\")\r Call theObject.ParentWindow.ClipboardData.SetData(\"text\",\"'+_OUT+'\")', ScriptLanguage.visualBasic );  // win
}

Can someone please test this piece of code on a windows machine?

Thank you!

Tobias

Tags: InDesign

Similar Questions

  • Size of the concatenated string variable?

    Hi all

    I have the following question:

    In Labview, there is a function called concatenate strings. When I want to 'Add' three strings I can pull the string to concatenate to the size three for three entries.

    Is there a possibility to implement a digital control where I can enter a number that ranges from my entries for the string concatenation function?

    If I want to add three channels I enter 3 in my digital control, my function gets three entries. After my program that I want to have five added channels so I would like to enter 5. Is it possible to do this?

    Thank you for your help in advance.

    Best regards

    Tresdin

    It seems to me that your program should be in a loop FOR, autoindexing on the points table.

  • addition of transport refers to a member or the text string variable

    I would like to structure a variable text line 1 at a time and then put this text in the text member and ultimately in an external text file but get a 'bad type' error when I use the script below. I guess I can't refer to the line in the sub-provincial text until they are there, but how can I add the?

    also how can I get to pick the text in this member of text in an external file... or better yet, how to take the text of the text variable in an external text file?

    There seems to be no 'next' code

    The constant RETURN can be appendd to the text to insert a new line

    myString = "this is a line" & return & "second line".

    Member ("textDisplay"). Text = myString - he would put in a text member

    Included with the Director fileIO xtra is the standard for writing in a
    text file, the simplest form would take about 5 lines of code to get
    to write to a text file.

    -Here is an approximate example

    myFile = new (xtra "fileio")
    openFile (myFile, myPath, 0)-read/write access
    writeString (myFile, myString)
    closeFile(f) (myFile)
    myFile = empty - purge xtra instance, also directed by Manager ending

  • Using the string Variable name to ChnFind

    Overview - I find crossing points of zero on a set of data so that I can calculate the phase shift of channel to another in my data.

    Small image - I start by finding the zero 1 cross in the data, once I found I want to use the index to find the next and so on

    Problem

    The posted script comes from looking for the 1st pass by zero before moving on to the next channel. The problem is that I can't find out do my group and channel changes with loops.

    Option Explicit  ' force explicit declaration of all variables in a script.
    Dim intCount, intChan ' loop variables
    Dim z

    IntCount = 2 GroupCount-1 ' groups
    Call GROUPDEFAULTSET (intCount) ' change the current group
    IntChan = 1 to ChnNoMax ' Browse channels
    Z = ChnFind ("Ch(""[intCount]/[intchan]"")<0") 'this="" does="" not="" work,="" but="" i'm="" not="" sure="" how="" to="" fix="">
    MsgBox (z)
    next

    I don't know I'm missing something obvious.

    MK

    Hi Michael,

    You need not global variables to simplify this, but I would certainly use object variables to simplify.  When indexing of groups or channels, it is easier to use the variable of index with the Data.Root.ChannelGroups collect or Group.Channels collection directly.  I also prefer to store the group object and the channel object in a variable.  For example, you can then use Channel.DataType to add exactly the same string data to the new group coming from the old group.  You can also easily get the name, unit and all sorts of other properties directly from the object variable.  I prefer to use a separate group object variable to reduce congestion in the colde, although it adds 2 lines to your example of code snippet.

    Set FromGroup = Data.Root.ChannelGroups (intCount)
    Set FromChannel = FromGroup.Channels (intChan)
    Define participatory = Data.Root.ChannelGroups ("Index" & FromGroup.Name)
    The rise in the value = ToGroup.Channels.Add (FromChannel.Name & "Rising", DataTypeChnFloat64)
    Fall in the value = ToGroup.Channels.Add (FromChannel.Name & "Falling", DataTypeChnFloat64)

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Insert variable in the text string

    Hi, can someone help me insert variables in a text string? I use the "base series writing and Read.vi in labview.

    I need to send the following string to the serial port:

    Normal 0 false false false fr X-NONE X-NONE MicrosoftInternetExplorer4 / * Style Definitions * / table. MsoNormalTable {mso-style-name : « Table Normal » ; mso-tstyle-rowband-taille : 0 ; mso-tstyle-colband-taille : 0 ; mso-style-noshow:yes ; mso-style-priorité : 99 ; mso-style-qformat:yes ; mso-style-parent : » « ;" mso-rembourrage-alt : 0 cm 5.4pt cm 0 5.4pt ; mso-para-margin : 0 cm ; mso-para-marge-bottom : .0001pt ; mso-pagination : widow-orphelin ; police-taille : 11.0pt ; famille de police : « Calibri », « sans-serif » ; mso-ascii-font-family : Calibri ; mso-ascii-theme-font : minor-latin ; mso-fareast-font-family : « Times New Roman » ; mso-fareast-theme-font : minor-fareast ; mso-hansi-font-family : Calibri ; mso-hansi-theme-font : minor-latin ; mso-bidi-font-family : « Times New Roman » ; mso-bidi-theme-font : minor-bidi ;}

    -$$ INPUT1SMSPHONE = numbers1, telephone2, phone3

    -$$ INPUT1SMS_WSEC = 5

    -$$ INPUT1SMS_DATAON = MESSAGE TYPE SMS HERE

    How to do a vi with numbers1, telephone2 phone3 and TYPE SMS MESSAGE HERE as variables and send it to the serial port?

    If someone could make an example vi that would be fantastic.

    Kind regards

    Mark

    Thank you for your quick response. Your example is perfect thanks mate.

    See you soon,.

    Mark

  • How do I do to convert the text of the String object to the Clipboard.

    Hi all, I am a beginner and I have a problem with the method of the Clipboard. I want to put a text string to the Clipboard, but the Clipboard.put method requires an object. What can I do to convert my text from the string object?

    My code below:

    String message = OriginalMessage.getBodyText();
    
                    String[] selections = {"Copy","Cancel"};                            Dialog addDialog = new Dialog("Copy to Clipboard", selections, null, 0, null);                           LabelField field = new LabelField(message);                addDialog.add(field);    
    
                if(addDialog.doModal() == 0) // User selected "Copy".            {
    
                    Clipboard cb = new Clipboard.put(message);
    
                }
    

    Please help me.

    A string is an object in Java.  You can simply call Clipboard.getClipBoard () .put (message);

  • How can I get the contents of an object of Document (XMLDOM) in a string variable?

    Hello

    I created an XML document by using the Document and XMLElement classes and now I need to get the XML object and a string variable, so I can send by e-mail.

    I'm on 4.5 JDE

    Help!

    Hello

    Unlike some other posts, there is a solution.

    Document myDocument = pdocXMLDocument;  / * This is the document that you created that you want to convert to a string

    ByteArrayOutputStream OS = new ByteArrayOutputStream(); / * where you want the XML to go * /;
    XMLWriter writer = new XMLWriter (os);

    configure as you want using one or more of:
    writer.setPrettyPrint (); or setPrintCompressedOutput();
    writer.setPrintCompressedOutput ();
    writer.setPreserveSpacing ();
    writer.setExpandingEntities (boolean);
    writer.setEntityResolver (EntityResolver);
    try {}
    DOMInternalRepresentation.parse (pdocXMLDocument, writer);
    String myXML = os.toString ();        THIS IS THE STRING
    }
    catch (Exception ex) {}
    }

  • I just bought LR 6 upgrade Ver 4.  The download doesn't let me download version Win MAC, only the win version?

    Why won't the website let me down version Win MAC of LR6.  Only the Win version seems to be available.

    Hi Robert,.

    Because you bought only Windows version of Lightroom you won't access to the download of Lightroom on your MAC computer.

    You can follow the article: a product of Adobe of a different version of the language or the trading platform that will help you make an exchange of your application platform.

    Let us know if it works or not.

    Thank you

    Yann Arora

  • How can I copy images to the Clipboard for Mac?

    Mac OS 10.10.3

    Acrobat Pro

    I was able to copy 2 Acrobat images into another application. But now, nothing of Acrobat is in my Clipboard after copying. I tried to copy and paste to other applications (after all it's fundamental features of Mac) and it works as expected. But not from Acrobat. So strange. What might stop Acrobat to copy an element of the image or text to the Clipboard?

    Hi xatom.

    Have you tried to use the snapshot tool in Acrobat? Choose Edition > take a snapshot, and then click the element on the page that you want to copy.

    Please let us know how it goes.

    Best,

    Sara

  • dynamic SQL for OPEN will not take the SQL string in the form of a string variable

    Hello

    I use "OPEN-for", not "EXECUTE IMMEDIATE" because I want to do multi lines request. However, 'OPEN-for' won't take a variable "strSQL' in the clause, it only took fixed ropes?

    create or replace function fnEnumSystemUser
    (
    LogonFilter nvarchar2,
    ...
    AdditionalWhereClause nvarchar2,
    OrderByClause nvarchar2
    )
    RETURN xxxxx.cursorType
    AS
    strSQL nvarchar2 (2000);

    FormatAdditionalWhereClause nvarchar2 (2000);
    FormatOrderByClause nvarchar2 (2000);

    SystemUserCursor xxxxx.cursorType;
    BEGIN

    If AdditionalWhereClause IS NULL THEN
    FormatAdditionalWhereClause: = ' ';
    ON THE OTHER
    FormatAdditionalWhereClause: = TRIM (AdditionalWhereClause);
    END IF;

    If OrderByClause IS NULL THEN
    FormatOrderByClause: = ' ';
    ON THE OTHER
    FormatOrderByClause: = TRIM (OrderByClause);
    END IF;

    strSQL: = 'select Id, FirstName, MiddleName, LastName, PrimaryEmail, PersonType, CreateDate, CreatedBy, LastUpdate, LastUpdateBy, connection, PasswdHash, IsSuspended, had left join SystemUser person on SystemUser.PersonId = Person.Id';
    -It won't work, just says "WARNING: compiled, but with compilation errors" when I tried to create the function
    Open SystemUserCursor for strSQL;

    -This is to call "ORA-01006: bind variable does not exist.
    Open SystemUserCursor
    ' select Id, FirstName, MiddleName, LastName, PrimaryEmail, PersonType, CreateDate, CreatedBy, LastUpdate, LastUpdateBy, connection, PasswdHash, IsSuspended, had left join SystemUser person on SystemUser.PersonId = Person.Id WHERE SystemUser.Logon like: x: y ' using LogonFilter, OrderByClause;

    -This failed also (on call, "ORA-00900: invalid SQL statement")
    Open SystemUserCursor
    ' select Id, FirstName, MiddleName, LastName, PrimaryEmail, PersonType, CreateDate, CreatedBy, LastUpdate, LastUpdateBy, connection, PasswdHash, IsSuspended, had left join SystemUser person on SystemUser.PersonId = Person.Id WHERE SystemUser.Logon like: x' | OrderByClause using LogonFilter;

    RETURN SystemUserCursor;
    END;

    That's how I invoked:
    declare
    Int NumItemsSelected;
    lstResult xxxxx.cursorType;

    TYPE SystemUserRecordType IS RECORD
    (
    ID numeric (19.0),.
    FirstName nvarchar2 (50).
    MiddleName nvarchar2 (50).
    LastName nvarchar2 (50).
    PrimaryEmail nvarchar2 (190),
    PersonType int,
    CreateDate timestamp,
    CreatedBy numeric (19.0),.
    LastUpdate timestamp,
    LastUpdateBy numeric (19.0),.

    Logon nvarchar2 (75).
    PasswdHash int,
    IsSuspended tank,
    Display timestamp
    );
    SystemUserRecordType oUser;
    Start

    lstResult: = fnEnumSystemUser (...) '%',... Person.PrimaryEmail like '% a %', "order by ASC Logon", 0, 10, NumItemsSelected);
    LOOP
    extract lstResult in oUser;
    When the output lstResult % notfound;
    dbms_output.put_line ('Id: ' | oUser.Id);
    END LOOP;
    end;

    I need the ability to add to the SQL string because ultimately say I need to join:
    1. ORDER BY section
    2 call a FUNCTION in WHERE Clause
    3 pagination and ROW_NUMBER() clause

    What can I do? Thank you!

    1. why you use NVARCHAR2 to the SQL string. Use VARCHAR2 or LONG.

    2. use

     tags to preserve formatting of your code.
    
    3. In the bind variable does not exist example it looks like you have one bind, :y, but are trying to bind two variables logonfilter and orderbyclause.
    
    4. In the third example, try logging the sql string in a table or dbms_output and running it in sql - you should get the same error and it might then be easier to diagnose.
    
    Cheers,
    Dominic                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • Test a string Variable in a Script of the Application

    Hey all, I am working with a script that takes the calling party number when the town crier. This string is converted to an integer and this number is used to fill our desktop application help when the call is connected to an agent. It works very well unless the calling party number is unknown. When this produces the application stops when it tries to convert the string value to an integer. Anyone know how I can test the string value to determine if it's a number before converting entire? This is how my script works.

    1. get call details. (sets the number of the call as string CallingParty)

    2 set CallingPartyINT = CallingParty (this is the breaking point)

    3 test CallingPartyINT and determine the location for the routing of the CSQ.

    Thanks in advance, if you have ideas on how I should do this.

    After the first step where you get the number of the caller in the CallingParty string. I would use an 'IF' check to see if there is something in the chain of CallingParty.

    Use the 'IF' step, and then click... to launch the expression editor. Then type:

    CallingParty == «»

    If there is anything she will assess as 'true' and you can take steps to prevent it to be converted to an integer. If it is false, you can handle the call and convert the value to an integer.

  • replacement of the same value in a string variable values

    If I have a string:

    "%s is %s that I'm talking about."

    and - I want to replace the instances with DIFFERENT values %s... What is the best way to do it.

    I thought of her analysis in separate using substr and instr chains, but I don't know if that's an exaggeration or not.

    Replace is ideal but - it replaces all occurrences of if - you can indicate just replace the first occurrence of a value, and the second with one another (i.e. If the result after replacement of the string above was supposed to be "it's the chain that I'm talking about"

    Any help is appreciated.

    Thank you

    Hello

    wtlshiers wrote:
    If I have a string:

    "%s is %s that I'm talking about."

    and - I want to replace the instances with DIFFERENT values %s... What is the best way to do it.

    Whenever you have any questions, please post CREATE TABLE and INSERT statements for some examples of data and the results desired from these data.
    Explain how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.3.0).
    See the FAQ forum {message identifier: = 9360002}

    I thought of her analysis in separate using substr and instr chains, but I don't know if that's an exaggeration or not.

    Depending on your needs, you may need to do this.

    Replace is ideal but - it replaces all occurrences of if - you can indicate just replace the first occurrence of a value, and the second with one another (i.e. If the result after replacement of the string above was supposed to be "it's the chain that I'm talking about"

    As you say, REPLACE replaces all occurrences. There is no way to say (for example) to change only the first.
    REGEXP_REPLACE, is much more flexible. There is no option for giving a specific occurrence, but you won't even have this feature. You want maybe just something like

    REGEXP_REPLACE ( '%s is the %s I am referring to'
                , '(.*)%s(.*)%s(.*)'
                , '\1This\2string\3'
                )
    

    Depends on your data and your needs.
    Are the new values (e.g. 'This' and 'chain') fixed, or if they can change from one line to the other?
    You will always have 2 (or certain known number) of ' %s in the original string?
    '%' Always report something that needs to be replaced? If not, how can you tell when he does and when it doesn't?
    Of ' always come right after "%"? If this is not the case, what are the possibilities, and what the different characters?

  • How can I copy the list of names of files in the finder and set the Clipboard filenames separated by commas?

    Hi guys, I was wonder if anyone can give me a hand with a script.

    I need to be able to paste a list of file names of the files as follows:

    0001.jpg 0002.jpg 0003.jpg 0004.jpg

    At the moment, if I select the files in the Finder, copy to the Clipboard and paste them in TextEdit, they are like this:

    0001.jpg

    0002.jpg

    0003.jpg

    0004.jpg

    I found a similar but slightly different script and I don't know how to change it. Here it is:

    Define extension_list to {"jpg", "" JPG","jpeg","JPEG"}

    the value cbNames (Clipboard text) paragraphs

    Set csvNames to {}

    the tid value delimiters to point to the text of the AppleScript

    the text value of the AppleScript point delimiters ".»

    -now, make a list of names without extensions

    Repeat with the names in cbNames

    If the point 2 of the text names is extension_list then

    copy of text 1 of names at the end of csvNames

    end if

    end repeat

    Journal csvNames

    -now the filenames as comma CONCATENATE string separated

    the text value of the point delimiters AppleScript «»

    csvNames value cross-as text

    the text value of the point AppleScript delimiters tid

    There is an easier way. Open a TextEdit document and paste the list in. Place the cursor at the end of the first item and drag it to the start of the second.

    Press on + command + c to copy and then command + f to bring up find it. Press command + v (do not click in the first search field). Check the 'Replace' box, click in the field replace, and then type a comma and a space.

    Click 'All' and then 'done '.

  • What native video streaming protocol is reliable supported in recent versions of FF on Win/Mac?

    Hi guys,.

    I'm looking for a way to deliver HTML5 video streaming (video on demand).

    What native video streaming protocol is reliable supported in recent versions of FF on Win/Mac?

    We use JWplayer and reports that HLS cannot be read.
    Dashboard is supported?

    Is there a special kind that we define so that the browser responds positively on video.canPlayType () and plays?

    Best regards
    Svetoslav

    Hello, Svetoslav, does that help? :
    https://developer.Mozilla.org/en-us/apps/build/Audio_and_video_delivery/Live_streaming_web_audio_and_video#Video_Streaming_File_Formats

  • How to use the Clipboard with some sites

    I use the copy and paste function from the Clipboard frequently to allow access to certain pages. It worked fine until I updated Firefox to the latest version of 29,0. It doesn't work anymore! I followed the usual instructions to create a user.js file and place it in the profile directory. But the problem is still there. Need help with this problem.

    You can do this is through buttons using JavaScript to make the paste.

    You can only do this via the keyboard.

    Use keyboard shortcuts if the buttons on the web page or other methods do not work.

    • Copy: Ctrl + C or Ctrl + insert (Mac: command + C)
    • Paste: Ctrl + V or shift + insert (Mac: command + V)
    • Cut: Ctrl + X or shift + delete (Mac: command + X)

    See also:

Maybe you are looking for

  • Update iOS 9.3.6

    Since the 5s iPhone update and iPad with security and last difficulty in iOS 9.3.5 all appointments in iCal before July 2016 disappeared. Everyone knows this and how can I get back them?

  • Problem with the help of Dynadock with Internet Explorer

    I don't know if cela the right forum, but I have a problem I'm trying to understand. Here are the basics: Toshiba Satellite L750 laptop with Windows 7 64 bit OSDynadock U with software version 2.4.0.13 (for the monitor, printer, keyboard and mouse, E

  • Battery won't charge on my Satellite A110

    6 months ago my adapter stopped working. I replaced it with a universal which works well for some time. Then I had a problem.When I connect the adapter to the laptop the blue light indicating the power supply Burns ok. The battery light turns orange

  • Performance issues on large applications of RT NSV

    Hello The end of http://www.ni.com/white-paper/12176/en says "...". misuse of shared Variables in LabVIEW Real-time application may cause performance poor machine... Bad typical uses include the use of too many shared Variables... In deployed applica

  • Eception Exception Java.lang.IndexOutOfBounds blackBerry smartphones

    Someone knows how to fix this?  I get it trying to open text thank you Messages