Questions tagged [tell]
37 questions
18
votes
2 answers
'telling' a specific application by a specific full path using Applescript
I am looking to tell application "xyz", but by specifying a full path to the application. This is because there may be various versions of the app on the system in different places, but with the same name.
If this possible?

Mathieu Tozer
- 278
- 2
- 8
10
votes
4 answers
f.seek() and f.tell() to read each line of text file
I want to open a file and read each line using f.seek() and f.tell():
test.txt:
abc
def
ghi
jkl
My code is:
f = open('test.txt', 'r')
last_pos = f.tell() # get to know the current position in the file
last_pos = last_pos + 1
f.seek(last_pos) # to…

John
- 3,888
- 11
- 46
- 84
9
votes
2 answers
AppleScript: Call handler inside tell statement
I get this error everytime i run this script: System Events got an error: "Test123" doesn’t understand the notify message.
Code:
--more code...
tell application "System Events"
if some_system_events_property then
my notify of "Test123"…

Tyilo
- 28,998
- 40
- 113
- 198
6
votes
2 answers
Is there a way to go back when reading a file using seek and calls to next()?
I'm writing a Python script to read a file, and when I arrive at a section of the file, the final way to read those lines in the section depends on information that's given also in that section. So I found here that I could use something like
fp =…

aaragon
- 2,314
- 4
- 26
- 60
5
votes
2 answers
Can an applescript "tell" call execute without visibly launching the application?
I have a Mail rule set up to launch the following applescript:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
-- do stuff, including...
…

eykanal
- 26,437
- 19
- 82
- 113
4
votes
0 answers
Finding position in file during iteration
I am trying to use f.tell() in a normal text file during iteration:
with open('test.txt') as f:
for line in f:
print(f.tell())
I get the following error:
Traceback (most recent call last):
File "", line 3, in
OSError:…

Mad Physicist
- 107,652
- 25
- 181
- 264
4
votes
3 answers
Deleting a line from a huge file in Perl
I have huge text file and first five lines of it reads as below :
This is fist line
This is second line
This is third line
This is fourth line
This is fifth line
Now, I want to write something at a random position of the third line of that file…

H.Burns
- 419
- 2
- 9
- 22
4
votes
2 answers
Python file.tell gives wrong value location
I am trying to extract a number of locations from an existing file using Python. This is my current code for extracting the locations:
self.fh = open( fileName , "r+")
p = re.compile('regGen regPorSnip begin')
for line in self.fh :
…

ktom
- 43
- 1
- 4
3
votes
2 answers
how to resume read operation of file using python
I have a file sized 15-16GB containing json objects seperated by new line (\n).
I am new to python and reading the file using the following code.
with open(filename,'rb') as file:
for data in file:
dosomething(data)
If while reading the…

Lijo Abraham
- 841
- 8
- 30
2
votes
1 answer
Python seek() not shifting pointer to right place
I was trying out the following python seek()/tell() function.
"input.txt" is a text file containing 6 letters, one per row:
a
b
c
d
e
f
text = " "
with open("input.txt", "r+") as f:
while text!="":
text = f.readline()
fp = f.tell()
…

PyEplorer
- 23
- 3
2
votes
2 answers
tell application - string vs. string?
If I run:
tell application "Maps"
set miniaturized of windows to false
end tell
...this works fine
Yet, when I run:
set applicationName to "Maps"
tell application applicationName
set miniaturized of windows to false
end tell
...I get:
Maps…

Jeff
- 169
- 9
2
votes
1 answer
Python error using zipfile: 'list' object has no attribute 'tell'
I'm trying to zip up only *.csv files in a directory with this code:
allFiles = os.listdir( dirName + apt + '/' )
csvList = [i for i in allFiles if i.endswith('.csv')]
zf = zipfile.ZipFile([ dirName + apt + '.zip' ], mode='w')
for f in…

Benjamin Levy
- 333
- 6
- 19
2
votes
2 answers
python csv distorts tell
I am trying to find a percent of where I am when reading through a csv file. I know how I could do this using tell() with a file object, but when I read that file object using csv.reader, then do a for loop on the rows in my reader object, the…

Blair Connolly
- 584
- 2
- 7
- 21
1
vote
1 answer
AppleScript Finder "open using" issue
I'm having some trouble scripting (what I thought would be) a very easy section of something I'm working on. Basically, I want to tell Finder to open a file with a specific application. Simple, right? From what I've read I should be able to…

EightQuarterBit
- 313
- 2
- 4
- 6
1
vote
0 answers
Tell() method not reliable when dealing with text files in Python
It seems that the .tell() method is not very reliable when dealing with text files in python. I am trying to use this method to stand in for an EOF condition as found in other programming languages.
For various reasons, I do not want to iterate over…

Lance Skelly
- 11
- 1