Open a terminal with applescript
I am using this script to open a terminal session and telnet:
tell application "Terminal"
activate
tell application "System Events" to keystroke "n" using {command down}
do script "telnet ipaddress" in front window
delay 5
do script "username" in front window
delay 5
do script "password" in front window
delay 5
do script "command to close session" in front window
end tell
When I run this it opens two terminal windows is there a way to only open the one? I have read other threads but they were all archived and didn't address two windows opening.
try
set pathToMyFolderOnDesktop to ("Macintosh HD:Users:jodyconnor:Desktop:") & "Dsource:" as alias
set rnd to (random number from 1 to 6)
set rndFileName to (rnd as text) & ".scpt"
set FullPath to pathToMyFolderOnDesktop & rndFileName as text
set myScript to load script (FullPath as alias)
run script myScript
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
return
end try
This code answered my question: Hats off to Digimonk from stackoverflow and Darrick Herewe from stackoverflow.
Similar Messages
-
How can I open a document with applescript without the doc. window opening.
How can I open a document with applescript without opening the document window and speak the text of the document? I can get it to open the file but the doc window always opens up.
try
set pathToMyFolderOnDesktop to ("Macintosh HD:Users:jodyconnor:Desktop:") & "Dsource:" as alias
set rnd to (random number from 1 to 6)
set rndFileName to (rnd as text) & ".scpt"
set FullPath to pathToMyFolderOnDesktop & rndFileName as text
set myScript to load script (FullPath as alias)
run script myScript
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
return
end try
This code answered my question: Hats off to Digimonk from stackoverflow and Darrick Herewe from stackoverflow. -
Opening terminal with applescript - changes default input language....
When I try to use Applescript to open terminal, it opens it but changes the input language to Japanese, so anything that I attempt to feed into terminal via applescript turns into nonsense Japanese. (The default language is English and kotoeri is set to romaji/roman alphabet by default)
How do i stop this?
ThanksSince my snow leopard MBP can't handle smb mounts, I've resorted to using sharity, except that its gui crashes the instant I try to mount a drive. But I can mount samba shares using sharity from the command line. I'd like to have it mount on startup which is supposedly something sharity can accomplish from its gui but since that doesn't work I would like to write an applescript and add it to the login items. I haven't been able mount it using do shell script as the sharity command line, unlike the normal samba mount command) doesn't seem to have an option of entering the password, so the mount fails:
sharity mount smb://user@address/folder
I thought if I open terminal via applescipt, then have it 'type' the command followed by a delay, then type the password, I could get around it but when I open terminal in applescipt, it starts in Japanese:
activate application terminal
tell application "System Events" to keystroke "sharity mount smb://user@address/folder"
tell application "System Events" to keystroke return
delay 2
tell application "System Events" to keystroke "password"
delay 2
tell application "Terminal"
quit
end tell
This almost does what I want it to but the input language has flipped to Japanese and sharityもうんtsmb://Sトラゲ-0165/けいthぱっすぉrd
is the result
Basically its all because of the samba bug in snow leopard (which I reported to apple and they confirmed its the same issue they know about) -
Launching terminal with applescript
I just recently ventured into the world of MAC, and I am trying to create an applescript (APS) to do the following
1. Launch Terminal
2. make terminal a X11 emulator ("/usr/bin/open-x11")
3. source blah1.sh ("source blah.sh")
4. source blah2.sh ("source blah.sh")
5. chage dir to foo1 ("cd foo1")
6. Leave window open
i have a good idea on how to use APS tolaunch terminal, but I am not sure if it is reading the source file, because it does not chage directory. Could someone help with an example script.
Thanks
MacBook Mac OS X (10.4.8)Hi Lanre,
try this
tell application "Terminal" to run
do shell script "/usr/bin/open-x11 ; source blah.sh ; source blah2.sh ; cd foo1"
or you can make a .term file (search google for how to) -
I have a PSD or a PSB. I need to be able to open all of the smart objects in the file so that i can get to the inner psd files so i can pull data from those. Is this possible? If not it definitely should be. Thank you very much. I am on a mac and will be using applescript.
You will NOT be able to do this directly with the model exposed to the AppleScript Dictionary…
You may be able to dig deeper in to PS with Action Manager code…
You can record this by using the scriptlistener plug-in…
As far as AppleScript is concerned this is JavaScript so just pass it to the do javascript command -
How to open notification center with Applescript?
Hi, I want to create an AppleScript file that open the Notification Center when I use a gesture with MagicPrefs. How can I do it?
Hello,
if you want you can use a tierce app to add gesture to your Magic Mouse. For me it's BetterTouchTool, it's free and easy to use.
bye -
How to open alias files with applescript in Powerpoint?
I would like to do something like this:
set F to choose folder
tell application "Finder" to set P to (files of entire contents of F whose name extension is "ppt")
repeat with oneFile in P
tell application "Microsoft PowerPoint"
activate
open (oneFile as alias)
end tell
end tell
It works fine if all files are regular files.
But I want/need it to work also, if some of the files are aliases (icon has the little pointer in Finder).
Could some kind soul explain to me what I would have to do?
TIA.
Gabriel.Are you saying this doesn't work? Generally applications don't/shouldn't care about whether you pass them an actual file or an alias.
In either case, it's not hard to dereference the alias back to the original file:
set F to choose folder
tell application "Finder" to set P to (files of entire contents of F whose name extension is "ppt")
repeat with oneFile in P
if class of oneFile is alias file then
tell application "Finder" to set oneFile to (original item of oneFile)
end if
open oneFile
end repeat
Note that I've just specified 'open oneFile' rather than targetting PowerPoint directly - there's no need to target PowerPoint if it's the default application for .ppt files. However, there's no problem telling PowerPoint to open the file if you prefer. -
Making and opening folder with applescript
I'm trying to create and open a folder with applescript, but my script gives an error...
This is what i've written but can't figure out what i'm doing wrong. I hope you can help me!
tell application "Finder"
activate
set the_folder to "106_WDJZ Eigen Magazine 20pp_Foto"
set myfolder to make new folder at "Press4:10. Specials:N19. WDJZ Eigen Magazine 20pp:F. Foto:" with properties {name:the_folder}
set openmap to (myfolder & the_folder)
end tell
Thank you very much in advanceThank you both for your awnsers. I really appreciate it! I was trying to create a folder (at "Press4:10. Specials:N19. WDJZ Eigen Magazine 20pp:F. Foto:") with a name (106_WDJZ Eigen Magazine 20pp_Foto) and after the folder is created I want the scrpt to open the folder.
The in FileMakerPro (calculated) applescript is now working and look like this:
"tell application \"Finder\"" & ¶ &
"set the_folder to \"" & Editie_standaardgegevens::UitgaveID & "_" & Editie_standaardgegevens::Editienaam_intern & "_Foto" & "\"" & ¶ &
"set sub_folder to \"Press4:10. Specials:" & Editie_standaardgegevens::Editienaam_intern_totaal & ":F. Foto:\"" & ¶ &
"set myfolder to make new folder at sub_folder with properties {name:the_folder}" & ¶ &
"set openfolder to (sub_folder & the_folder & \":\")" & ¶ &
"open folder openfolder" & ¶ &
"activate" & ¶ &
"end tell" -
Execute command in terminal with command?
What in terminal would I have to type to open another terminal with a command? I want to have something that can control my alsa levels in my openbox menu.
Oh and just a side question, what happened to weatherget? Pacman says the package doesn't exist. Is it in the AUR or am I just using the wrong package name?Thanks that worked.
The python script however doesn't support my weather code ((CXTO)It's out of range).
Anyone know one that does support Canada so I don't have to a bunch of them?
Last edited by cryticfarm (2009-08-07 03:50:39) -
Opening a folder with an application in one click, and automating Terminal
A forum member kindly recommended I move a question from 'Mac OS X Leopard' to this sub-forum as it was more appropriate to Unix:
Firstly, is it possible to create a desktop/dock icon (or perhaps a Safari or FireFox bookmark) that opens a folder with a certain application? I'm doing a lot of web development and hoping to create handy buttons for opening up entire folders (Ruby on Rails projects) with only one click. At the moment, I have to find the folder and drag it to the textmate icon; if I had a 'open in textmate' button, that would make my work so much quicker, as I'm often changing between projects. It would be even better if I could have the button as a bookmark in my browser (where I spend most of my time).
Secondly (probably related to the first question), is it possible to automate a process I follow every time I open up a Ruby on Rails project in Terminal (?);
1. Load Terminal by clicking on the icon in the dock
2. 'cd sites/rubyonrailsapp' (where 'rubyonrailsapp' is the rails application I want to load)
3. 'mate .' (opens the entire /rubyonrails/ folder in TextMate)
4. 'CMD + T' (to open up a new Terminal tab)
5. 'gitk --all &' (to open up the Wish version control interface for the rails application)
6. 'autotest' (to runs the tests in the rails application)
7. 'CMD + T' (to open up another new Terminal tab, ready for me to use)
If I could follow those steps with only one click, that would be amazing, so any suggestions are much appreciated (I just realised how many times-per-day I'm typing these commands).
Cheersyou can try this applescript. just copy it into the Script Editor and save it (1) as a script application that you can double-click, or (2) as a script that you can run from the script menu or quickkeys or etc. may need some tweaking...
<pre class="jive-pre">tell application "Terminal"
set cmd to "cd sites/rubyonrailsapp; mate ."
do script cmd
activate
end tell
tell application "System Events"
keystroke "t" using command down
end tell
tell application "Terminal"
set cmd to "gitk --all & autotest;"
do script cmd
activate
end tell
tell application "System Events"
keystroke "t" using command down
end tell</pre>
to solve your other question, you'll probably need to script textmate. something like:
<pre class="jive-pre">tell application "TextMate"
open alias "path:to:folder"
end tell</pre>
I don't have textmate to test it on, however.
sorry it's not a unix solution, but the task you're trying to accomplish fits better with applescript.
Message was edited by: twtwtw - sorry, wrong quote style... -
Can I open new terminal window with the same path?
Hello.
I use Terminal for bash-shell.
When I work at a certain directory, can i open new terminal(command + N) with the same directory?
For example, when i am in /Developer and press command+N, I want a new terminal window with /Developer path.
Thanks for reading and I'm sorry for my short english.Command-N will open a new Terminal window in your Home (~) Directory by default.
Use the "Open Terminal Here" script for more control
http://www.entropy.ch/software/applescript/ -
Hi,
I'm getting the below error for reports.
The report terminated with error:
REP-110: File test2. cannot be opened. REP-1070: An error occurred while opening or saving a document. REP-0110: File test2. cannot be opened. .
When checked Environment using url 'http://host:port/reports/rwservlet/showenv?server=your_repserver_name"
found below
==================================================
Reports Servlet Environment Variables 11.1.1.4.0
Security Mode Non-secure
HTTP Environment Variables 11.1.1.4.0
SERVER_NAME 09.14.4.41
SERVER_PORT 8888
SCRIPT_NAME /rwservlet
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE undefined
GATEWAY_INTERFACE undefined
SERVER_PORT_SECURE undefined
ACCEPT image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
REQUEST_METHOD GET
REMOTE_HOST test-wam-app
REMOTE_ADDR 09.14.4.41
REMOTE_USER undefined
AUTH_TYPE undefined
PATH_INFO showenv
QUERY_STRING server=RptSvr_test-wam-app_wamtest
PATH_TRANSLATED undefined
CONTENT_LENGTH undefined
CONTENT_TYPE undefined
AUTHORIZATION undefined
USER-AGENT Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; InfoPath.3; MS-RTC LM 8)
REMOTE_IDENT undefined
REFERER undefined
Oracle Reports Services - Servlet Environment Variables Select to jump to the top of the page Return to Top
KeyMapFile /u03/apptest/FMW_11.1.1/user_projects/domains/WamTest/config/fmwconfig/servers/WLS_REPORTS/applications/reports_11.1.1.2.0/configuration/cgicmd.dat
DBAUTH /u03/apptest/FMW_11.1.1/apphome/reports/templates/rwdbauth.htm
SYSAUTH /u03/apptest/FMW_11.1.1/apphome/reports/templates/rwsysauth.htm
server rep_wls_reports_test-wam-app_wamtest1
DIAGNOSTIC yes
ERRORTEMPLATE /u03/apptest/FMW_11.1.1/apphome/reports/templates/rwerror.htm
SERVER_IN_PROCESS yes
COOKIEEXPIRE 30
ENCRYPTIONKEY reports9i
DIAGHEADTAGS undefined
DIAGBODYTAGS undefined
HELPURL undefined
RELOAD_KEYMAP undefined
IMAGEURL http://09.14.4.41:8888/reports/rwservlet
SINGLESIGNON no
Oracle Reports Services - Server and Engine Environment Variables Select to jump to the top of the page Return to Top
PATH /u01/wamtest/FMW_11.1.1/apphome/jdk/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/wamtest/FMW_11.1.1/apphome/jdk/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/java/jdk1.6.0_23/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
DISPLAY
LD_LIBRARY_PATH /u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/server:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/../lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/native_threads:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/lib:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/server:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/native_threads:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/lib:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/server:/u01/wamtest/FMW_11.1.1/apphome/opmn/lib:/u01/wamtest/FMW_11.1.1/apphome/lib
ORACLE_HOME /u01/wamtest/FMW_11.1.1/apphome
TNS_ADMIN /u01/wamtest/FMW_11.1.1/instance1/config
NLS_LANG AMERICAN_AMERICA.WE8ISO8859P1
USER_NLS_LANG
RW /u01/wamtest/FMW_11.1.1/apphome/reports
REPORTS_PATH /u01/wamtest/FMW_11.1.1/apphome/reports/templates:/u01/wamtest/FMW_11.1.1/apphome/reports/samples/demo:/u01/wamtest/FMW_11.1.1/apphome/reports/integ:/u01/wamtest/FMW_11.1.1/apphome/reports/printers:/u01/wamtest/FMW_11.1.1/instance1/reports/fonts:/u01/wamtest/FMW_11.1.1/apphome/reports/templates:/u01/wamtest/FMW_11.1.1/apphome/reports/samples/demo:/u01/wamtest/FMW_11.1.1/apphome/reports/integ:/u01/wamtest/FMW_11.1.1/apphome/reports/printers:/u01/wamtest/FMW_11.1.1/instance1/reports/fonts:
REPORTS_TMP /tmp
REPORTS_TAGLIB_URI /WEB-INF/lib/reports_tld.jar
java.class.path /u01/wamtest/FMW_11.1.1/apphome/reports/jlib/rwrun.jar
sourceDir
tempDir
useDataCache
ignoreDataParameter
=========================================================================
ORACLE_HOME is on mount point u03, checked config.properties but no mention of mount point /u01.
Dont know from where /u01 came. Could you please help me re configuring the env pointing to /u03.
Reports server is up though without any issues.
Regards,
DjayEnsure that the report name is correct. Also ensure that the report exist in REPORTS_PATH environment variable. Otherwise run the report including the reports path.
E.g.
report=<reports directory>/test2.rdf -
How can I open images in Photo Mechanic with AppleScript
I need an AppleScript that displays a chosen folder of images in a Photo Mechanic as a Contact Sheet.
A FileMaker script – with the help of a plug-in called Troi-File-Plug-in 2.8.2 - already allows me to navigate to the folder which opens on the desktop. The final step would be for the script to display the images in Photo Mechanic, where they can be viewed, captioned, edited etc. (The process can be performed manually by dragging the images onto the Photo Mechanic icon).Whenever I want a script to open a file with a certain app I use (e.g. FireFox)
set thefile to choose file
do shell script "open -a /Applications/Firefox.app " & quoted form of POSIX path of thefile
if the app's name contains special characters or blanks you will have to quote it e.g.
set thefile to choose file
do shell script "open -a /Applications/'Final Cut Express.app' " & quoted form of POSIX path of thefile -
Open a UNIX terminal (with a remote login session) on JButton click
All,
-- The domain of this problem blurs the line which decides if this question has to be posed on a Java swing audience or a UNIX forum. To understand this problem apart from being a Java swing person, you would also need to have a basic understanding of UNIX concepts such as gnome-terminal, xterm and rsh --
I am creating a network monitoring GUI which has a JTable having many entries that pertains to various system information about nodes in a network. I have overridden the default cellEditor in the table with a custom TableCellEditor (camickr's archive) and have a column containing JButtons labelled with hostnames.
Now, when a user clicks on any of these buttons, I would like to open up a terminal (xterm or /usr/bin/gnome-terminal) followed by executing some commands on this NEW terminal shell. In other words, I would like to automate this process as if the user opens a terminal and then keys in commands to rsh into the remote host by specifying the hostname (which is the label on the JButton) and finally provide the user with this state, from where on she takes control on that remote login session.
I tried searching through various previous posts. I did find a related one:
http://forum.java.sun.com/thread.jspa?threadID=5180094&messageID=9699614#9699614
But I still have difficulty in getting my problem solved.
The following statements are executed when one such button (labelled by a hostname) is clicked:
public void actionPerformed(ActionEvent e) {
String hostname = e.getActionCommand();
fireEditingStopped();
System.out.println( "probing: " + hostname); //This appears correctly on the console
Process p;
try {
p = Runtime.getRuntime().exec("/usr/bin/gnome-terminal");
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
out.write("rsh -l root "+hostname); //attempting to remote login in the NEW shell (terminal)..... I guess :|
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
.I guess I am not having control on the new terminal. Is there any way I could control the newly spawned shell?
Appreciate,
RajivAlright...
assuming gnome-terminal is in /usr/bin path,
/usr/bin/gnome-terminal -e "<command>"
would solve this problem -
Hi Gurus
We have created a custom oracle report and concurrent program and when we ran the concurrent program it is error out with below error
Enter Password:
REP-0004: Warning: Unable to open user preference file.
REP-0300: ORACLE error occurred.
REP-0069: Internal error
REP-57054: In-process job terminated:Terminated with error:
REP-300: ORACLE error occurred.
Can any one help us
Thanks in advance.
KumarPlease see
REP-0004 Warning - Unable to Open User Preference File. (Doc ID 26014.1)
ApPsMaStI
sharing is Caring
Maybe you are looking for
-
hi. i using window 8.1, adobe reader version XI. when i installed reader xi, that worked well. after some hours pass, double click pdf file and nothing happen.(only can see adobe reader on window task manager list) i reinstalled reader several times
-
How to connect WAD in BI 7?
Hi All, I am not able see the option for WAD connectivity in BEx Analyser in BI 7.0. Please provide me the steps to connect WAD in BI 7. Thanks & Regards Ramakanth.
-
T3 Load Balancing with Weblogic Server 6.1
We are using rwo weblogic 6.1 servers A and B behind a load balancer with a DNS name (eg. www.loadbalancer.com). We are using T3 for Java client to application server communication. The client creates the Initial context with the load balancer url,cr
-
BPC 10.1 Unified - error when selecting a planning function
Hi BPC experts, configured planning function in BW-IP. Opened EPM Add-in, went to data processing tab to look for the planning function, Found it but when tried to select the function got the following: epm error: object reference not set to an insta
-
Disable Journaling on Software RAID
Hello. I am running OS 10.7.3 and have four internal drives I would like to create a raid set with using disk utility. I can seem to create a software raid without journalising, is this possible. Creating the raid and option clicking file wont allow