Lefora Free Forum
login join
Loading
886 views

xCode/AppleScript interact with Perl

Page 1
1–3
rookie - member
1 posts

Hi guys and girls!
I am very new to xCode and did very simple things in AppleScript so, please understand my not understanding of things at first. Thank you!

Here is the problem:
I have a Perl script and need to create a UI wrapper for it. Let's say Perl has the following line:


print "Enter your Name: ";
$name = <STDIN>; chomp $name;

I need a UI for that so it will run Perl catch the text "Enter your Name", print it in dialog or so with textbox where user could enter his/her name and passes value from the textbox back to Perl script so it could process data from the input.

Any help is greatly appreciated!
Mark.


?
63 posts

Let me guess. You want a dialog box to pop up, asking for a user name. The user enters their name and presses OK. Then it runs a Perl script.

Mm, I don't know anything about this. Sorry.

__________________
kompilesoft

come and see my website! it's real cool reviews
?
288 posts

If your script is very simple, you'll probably find the package "CocoaDialog" to be very helpful.

http://cocoadialog.sourceforge.net/examples.html

If you want to execute Perl from Cocoa, you can use the NSTask class to invoke programs - it's something like Perl's system() function. Cocoa and Obj/C is of course C - so you can use the standand library system() function.  In a GUI program however, accepting input from the user using <STDIN> is likely to either fail, or pop up a terminal window or something - I'm not too sure - give it go and see what happens.

However in the first instance, please look at CocoaDialog - it'll probably get you up and running in a few minutes.

__________________
Page 1
1–3

Locked Topic


You must be a member to post in this forum

Join Now!