Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 27, 2012, 04:15 PM   #1
etnad
macrumors newbie
 
Join Date: Sep 2012
Please help fixing this NON WORKING script

This isn't a working script but I hope someone can kindly fix it for me. is only what I would like to get based on another script which reads the first line in a tet file.
After this "non working Script" you will find additional explanation about my process

I am using Snow Leopard because of the lack of Rosetta in the various Lions (due to the indifference form Apple computers to renew the Rosetta licence held by PowerPC IBM [mysteries of computer companies deals]

Code:
set theDoc to choose file with prompt "Select:"
tell application "TextWrangler"
   set theDoc to document 1
   set parag to (count of paragraphs of text of theDoc)
       set Para to parag - 1
           select paragraph Para of theDoc
           if Para contains :"Myserverita"
           tell application "transmit"
           activate 
           connect to favirite "Myserverita"
           end tell
           exit script
          if Para contains :"MyserverOther"
           tell application "Safari"
           activate 
           end tell
           exit script
           else if
           Content Para contains :"MyserverFrance"
           tell application "speedownload"
           activate 
           end tell
           exit script
           else if
           Content Para contains :"MyserverGermany"
           tell application "Rapidshare Manager"
           activate 
           end tell
           exit script
 
end tell

Why I need this?

I need to upload download various large files often over 100 GB of space (mainly tentive film editing) and receive changes on the files.
All this happens either through ftp as we all have servers or most frequetly using the filesharing services such as rapidshare and so on, or news servers

Each series of files consists in Rar segments and PAR2 files to fix possible transmission errors. Each file is password protected as only my coworker world wide can load them.

The files are so very large because they are "raw" files, and often include FinalCUtPro additional data in video and sound.

Some of these apps are in Java and they do not have Applescript support at all, however I hope the Finder will still be able to activate them

Once opened the various apps willl be opened I will manually perform what is necessary to either upload or download the various files.

I'am aware of professional applications "srot of" doing this already: however they do not suit my needs. Any confrntation on this matter is beyond my request which I hope will not bother anybody. In my country Internet is very slow and I have no choice.
Because of this I need to use 2 or 3 mqachines and two or 3 different Interent lines else my router becomes an electric turtle and really I can only barely use internet

As I might be not too clear please let me know and I will organize this request again ....

Thanks a lot

Last edited by dejo; Nov 27, 2012 at 08:35 PM. Reason: Please use [code] tags.
etnad is offline   0 Reply With Quote
Old Nov 27, 2012, 04:45 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Although TextWrangler is a nice application you don't need it to read a text file within Applescript. You're telling application transmit to connect. Is transmit scriptable? Does it understand the connect statement? If you want to check if Para contains :Myserverita you should put the colon inside the quotes. Can you attach the text file you want to read to your post?
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote
Old Nov 27, 2012, 07:17 PM   #3
etnad
Thread Starter
macrumors newbie
 
Join Date: Sep 2012
ėthanks:
Yes Transmit is scriptable and these are the dictionary voices I believe I should use:

Code:
connect v : Connect to a favorite or a specified server.
connect
[to favorite] : The favorite to connect to.
[to address text] : The address to connect to.
[as user text] : The user name to use when connecting.
[using port integer] : The network port to use when connecting.
[with initial path text] : The initial path to change to after the connection is made.
[with password text] : The password to use when connecting.
[with protocol FTP/FTP implicit SSL/FTP TLS SSL/S3/SFTP/WebDAV/WebDAV HTTPS] : The connection type to use when connecting.
[mount boolean] : Try to mount the disk in the Finder.
→ boolean : Whether the connection was successful.

Code:
favorite n : A favorite in Transmit.
elements
contained by application.
properties
address (text, r/o) : The address of the favorite.
local path (text, r/o) : The local path for the favorite.
password (text, r/o) : The password for a favorite.
port (integer, r/o) : The port to connect to for a favorite.
protocol (FTP/FTP implicit SSL/FTP TLS SSL/S3/SFTP/WebDAV/WebDAV HTTPS, r/o) : The protocol a favorite uses to connect.
remote path (text, r/o) : The remote path for a favorite.
name (text, r/o) : The name of a favorite.
URL (text, r/o) : The root URL specified for a favorite.
user name (text, r/o) : The user name for a favorite.
identifier (text, r/o) : The unique identifier for a favorite.



this is a short example file pls consider most text flles are basically the same:


http://rapidshare.com/files/839936239/IM_here.avi.001
http://rapidshare.com/files/2008072689/IM_here.avi.002
http://rapidshare.com/files/1985424796/IM_here.avi.003
http://rapidshare.com/files/4260995399/IM_here.avi.004
http://rapidshare.com/files/29647928...l000%2B01.par2


these files are ot available as I erased them frm the server already, but they are legitimate and exact copies for what I need todo.

in this case I uploaded this short file (the list is not complete)
what matters for the script I hope to use is the first paragraph. In this case you read:
http://rapidshare.com
this should pop open the "speed dowload" application which is indeed scriptable but as such it has no use to me because once opened i can instantly paste the whole text file, and choose in one click if I want to upload it and to who, or download it

in other words the script might call different applications as every server uses faster certain transfer option, not all use FTP and not all use "speed download" (again scriptable, but so well furnished in terms of short cuts that just opening is fine)
Other apps are Java only so again al I need is to have it opened and then I will do whatever i need manually

Last edited by dejo; Nov 27, 2012 at 08:36 PM. Reason: Please use [code] tags.
etnad is offline   0 Reply With Quote
Old Nov 28, 2012, 11:50 AM   #4
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Try and change where needed :


Code:
set theDoc to choose file with prompt "Select your txt file to read:"
-- The first paragraph of theDoc
set theParagraph to first paragraph of (read theDoc)
-- Act on the first paragraph
if theParagraph contains "rapidshare" then
	tell application "speedownload" to activate
else if theParagraph contains "something else than rapidshare" then
	tell application "Rapidshare Manager" to activate
else if theParagraph contains "something else than rapidshare" then
	tell application "Safari" to activate
else if theParagraph contains "something else than rapidshare" then
	tell application "transmit"
		activate
		connect to favorite "whatever favorite"
	end tell
end if
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Geektool: ram script not working on mavericks?? beaumk UI Customization 0 Jan 20, 2014 06:36 PM
SMB login script to DiskStation has stopped working?? jmpage2 OS X 10.8 Mountain Lion 1 Aug 24, 2013 01:47 PM
Launchd and auto-enroll certificate script not working blabla296 Mac Programming 1 Jul 29, 2013 02:28 AM
Apple Script -> Copy and Paste HTML content - Not working gguerini Mac Programming 2 Apr 10, 2013 05:49 PM
UI login apple script not running on 10.8.3 but working fine on 10.6.x abidkhan135 OS X 10.8 Mountain Lion 0 Apr 2, 2013 02:39 AM

Forum Jump

All times are GMT -5. The time now is 10:52 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC