• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing String Variables to Visual Basic withinApplescript???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing String Variables to Visual Basic withinApplescript???


  • Subject: Re: Passing String Variables to Visual Basic withinApplescript???
  • From: Ian MacLachlan <email@hidden>
  • Date: Sun, 24 Jun 2001 13:58:29 -0700

After implementing this script I still get no joy in VB. If I code the strings
into the VB code like this : \"sample string\" everything works fine. Getting
the user input to work is proving to be more difficult.

Ian

Paul Berkowitz wrote:

> On 6/24/01 12:07 PM, "Ian MacLachlan" <email@hidden> wrote:
>
> > Help,
> >
> > I' m putting together a script (droplet) that takes user input
> > (old_string, new_string) and opens a series of Word Documents and makes
> > changes to the text using MS Word's replace command.
> >
> > Question: How do I refer to the string variables captured in the
> > Applescript section when I initiate the Visual Basic section? The
> > relevant parts of the script follow. I'll attach the whole thing as
> > well.
> > Applescript that gets variables:
> >
> > display dialog "What text would you would like to remove?" default
> > answer "Remove this text"
> > set the old_string to the text returned of the result
> > set old_string to ((old_string) as text)
>
> You don't need this line. 'text returned' of display dialog is ALWAYS text.
>
> >
> > display dialog "Any occurance of '" & old_string & "' will be replaced
> > with?" default answer "Replace with this text"
> > set the new_string to the text returned of the result
> > set new_string to ((new_string) as text)
>
> Same. You don't need that line.
>
> >
> > set the response_text to "Any text containing the string '" & the
> > old_string & "' will be replaced with '" & the new_string & "'."
> > display dialog response_text buttons {"OK"} default button 1
> >
> > The section that opens Word and should make the repacements:
>
> Before you do this, you need another handler to add escape characters (\")
> for internal strings. I've also included the stuff you need in case you have
> any carriage returns I your applescript strings (you don't this time, but
> you might another time. Run each of your string variables (old_string,
> new_string) through this handler.
>
> on ProcessForVB(theString)
>
> set finalString to ""
>
> set num to (count paragraphs of theString)
> repeat with i from 1 to num
> set thePar to paragraph i of theString
> set thePar to "\"" & thePar & "\""
> set finalString to finalString & thePar
>
> if i = num then
> set finalString to finalString & return
> else
> set finalString to finalString & " & vbCr & "
> end if
> end repeat
> return finalString
> end ProcessForVB
>
> --
> Paul Berkowitz
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


  • Follow-Ups:
    • Re: Passing String Variables to Visual Basic withinApplescript???
      • From: Greg Strange <email@hidden>
References: 
 >Re: Passing String Variables to Visual Basic within Applescript??? (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Passing String Variables to Visual Basic within Applescript???
  • Next by Date: Re: Passing String Variables to Visual Basic withinApplescript???
  • Previous by thread: Re: Passing String Variables to Visual Basic within Applescript???
  • Next by thread: Re: Passing String Variables to Visual Basic withinApplescript???
  • Index(es):
    • Date
    • Thread