Opening files using a script...
Every time I use the "open" command in applescript, I get the message "cannot get file." How do I open files with a script?
Your usage of documents folder in this case is incorrect. They are reserved words, but as part of *Standard Additions'* path to command. The Finder is expecting a file path, so try this instead:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #DAFFB6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "Finder"
open every document file of (path to documents folder) whose name contains searchtext
--where searchtext is text input from the user
end tell
</pre>
Similar Messages
-
Read Text file using Java Script
Hi,
I am trying to read a text file using Java Script within the webroot of MII as .HTML file. I have provided the path as below but where I am not able to open the file. Any clue to provide the relative path or any changes required on the below path ?
var FileOpener = new ActiveXObject("Scripting.FileSystemObject");
var FilePointer = FileOpener.OpenTextFile("E:\\usr\\sap\\MID\\J00\\j2ee\\cluster\\apps\\sap.com\\xapps~xmii~ear\\servlet_jsp\\XMII\\root\\CM\\OCTAL\\TestTV\\Test.txt", 1, true);
FileContents = FilePointer.ReadAll(); // we can use FilePointer.ReadAll() to read all the lines
The Error Log shows as :
Path not found
Regards,
MohamedHi Mohamed,
I tried above code after importing JQuery Library through script Tag. It worked for me . Pls check.
Note : You can place Jquery1.xx.xx.js file in the same folder where you saved this IRPT/HTML file.
<HTML>
<HEAD>
<TITLE>Your Title Here</TITLE>
<SCRIPT type="text/javascript" src="jquery-1.9.1.js"></SCRIPT>
<script language="javascript">
function Read()
$.get( "http://ldcimfb.wdf.sap.corp:50100/XMII/CM/Regression_15.0/CrossTab.txt", function( data ) {
$(".result").html(data);
alert(data);
// The file content is available in this variable "data"
</script>
</HEAD>
<BODY onLoad="Read()">
</BODY>
</HTML> -
Move group of pages from one InDesign file to another InDesign File using VB.Script
Dear team,
I am trying to move group of InDesign pages from one indesign file to another indesign file using vb.script.
I have written the code like
Dim Pages=IndDoc.Pages
Dim Mytype=TypeName(Pages)
Pages.Move(InDesign.idLocationOptions.idBefore,IndDoc1.Pages.LastItem)
but it is giving an error as method Move is not a member of Pages
please give mme the solution to move the Multiple pages or a group of page from one Indd to another Indd.Hey Peter, if I wan to move several page that part of Auto Flow text, I checked the "delete page after moving" but the content still there, not deleted.
Is there any way to delete it automatically, just to make sure I have moved that autoflowed page? -
How to get ORA errors in alertlog file using shell script.
Hi,
Can anyone tell me how to get all ORA errors between two particular times in an alertlog file using shell script.
ThanksHi,
You can define the alert log as an external table, and extract messages with SQL, very cool:
http://www.dba-oracle.com/t_oracle_alert_log_sql_external_tables.htm
If you want to write a shell script to scan the alert log, see here:
http://www.rampant-books.com/book_2007_1_shell_scripting.htm
#!/bin/ksh
# log monitoring script
# report all errors (and specific warnings) in the alert log
# which have occurred since the date
# and time in last_alerttime_$ORACLE_SID.txt
# parameters:
# 1) ORACLE_SID
# 2) optional alert exclusion file [default = alert_logmon.excl]
# exclude file format:
# error_number error_number
# error_number ...
# i.e. a string of numbers with the ORA- and any leading zeroes that appear
# e.g. (NB the examples are NOT normally excluded)
# ORA-07552 ORA-08006 ORA-12819
# ORA-01555 ORA-07553
BASEDIR=$(dirname $0)
if [ $# -lt 1 ]; then
echo "usage: $(basename) ORACLE_SID [exclude file]"
exit -1
fi
export ORACLE_SID=$1
if [ ! -z "$2" ]; then
EXCLFILE=$2
else
EXCLFILE=$BASEDIR/alert_logmon.excl
fi
LASTALERT=$BASEDIR/last_alerttime_$ORACLE_SID.txt
if [ ! -f $EXCLFILE ]; then
echo "alert exclusion ($EXCLFILE) file not found!"
exit -1
fi
# establish alert file location
export ORAENV_ASK=NO
export PATH=$PATH:/usr/local/bin
. oraenv
DPATH=`sqlplus -s "/ as sysdba" <<!EOF
set pages 0
set lines 160
set verify off
set feedback off
select replace(value,'?','$ORACLE_HOME')
from v\\\$parameter
where name = 'background_dump_dest';
!EOF
`
if [ ! -d "$DPATH" ]; then
echo "Script Error - bdump path found as $DPATH"
exit -1
fi
ALOG=${DPATH}/alert_${ORACLE_SID}.log
# now create awk file
cat > $BASEDIR/awkfile.awk<<!EOF
BEGIN {
# first get excluded error list
excldata="";
while (getline < "$EXCLFILE" > 0)
{ excldata=excldata " " \$0; }
print excldata
# get time of last error
if (getline < "$LASTALERT" < 1)
{ olddate = "00000000 00:00:00" }
else
{ olddate=\$0; }
errct = 0; errfound = 0;
{ if ( \$0 ~ /Sun/ || /Mon/ || /Tue/ || /Wed/ || /Thu/ || /Fri/ || /Sat/ )
{ if (dtconv(\$3, \$2, \$5, \$4) <= olddate)
{ # get next record from file
next; # get next record from file
# here we are now processing errors
OLDLINE=\$0; # store date, possibly of error, or else to be discarded
while (getline > 0)
{ if (\$0 ~ /Sun/ || /Mon/ || /Tue/ || /Wed/ || /Thu/ || /Fri/ || /Sat/ )
{ if (errfound > 0)
{ printf ("%s<BR>",OLDLINE); }
OLDLINE = \$0; # no error, clear and start again
errfound = 0;
# save the date for next run
olddate = dtconv(\$3, \$2, \$5, \$4);
continue;
OLDLINE = sprintf("%s<BR>%s",OLDLINE,\$0);
if ( \$0 ~ /ORA-/ || /[Ff]uzzy/ )
{ # extract the error
errloc=index(\$0,"ORA-")
if (errloc > 0)
{ oraerr=substr(\$0,errloc);
if (index(oraerr,":") < 1)
{ oraloc2=index(oraerr," ") }
else
{ oraloc2=index(oraerr,":") }
oraloc2=oraloc2-1;
oraerr=substr(oraerr,1,oraloc2);
if (index(excldata,oraerr) < 1)
{ errfound = errfound +1; }
else # treat fuzzy as errors
{ errfound = errfound +1; }
END {
if (errfound > 0)
{ printf ("%s<BR>",OLDLINE); }
print olddate > "$LASTALERT";
function dtconv (dd, mon, yyyy, tim, sortdate) {
mth=index("JanFebMarAprMayJunJulAugSepOctNovDec",mon);
if (mth < 1)
{ return "00000000 00:00:00" };
# now get month number - make to complete multiple of three and divide
mth=(mth+2)/3;
sortdate=sprintf("%04d%02d%02d %s",yyyy,mth,dd,tim);
return sortdate;
!EOF
ERRMESS=$(nawk -f $BASEDIR/awkfile.awk $ALOG)
ERRCT=$(echo $ERRMESS|awk 'BEGIN {RS="<BR>"} END {print NR}')
rm $LASTALERT
if [ $ERRCT -gt 1 ]; then
echo "$ERRCT Errors Found \n"
echo "$ERRMESS"|nawk 'BEGIN {FS="<BR>"}{for (i=1;NF>=i;i++) {print $i}}'
exit 2
fi -
Script to export Security file using maxl script
can anyone provide me the Script to export Security file using maxl script.It should create a log file and a batch file should also be there to schedule the Maxl script.Please help me with this
Hi,
You can use something like
[b]login admin password on localhost;
[b]spool on to 'c:\temp\log.txt';
[b]export security_file to data_file C:\temp\sec_file.txt;
[b]spool off;
[b]logout;
Then you can have a batch file that just calls the maxl script
essmsh name_of_maxl_script.mxl
The batch script can then be scheduled.
Cheers
John
http://john-goodwin.blogspot.com/ -
Is it possible to monitor State change of a .CSV file using powershell scripting ?
Hi All,
I just would like to know Is it possible to monitor State change of a .CSV file using powershell scripting ? We have SCOM tool which has that capability but there are some drawbacks in that for which we are not able to utilise that. So i would like
to know is this possible using powershell.
So if there is any number above 303 in the .CSV file then i need a email alert / notification for the same.
Gautam.75801Hi Jrv,
Thank you very much. I modified the above and it worked.
Import-Csv C:\SCOM_Tasks\GCC2010Capacitymanagement\CapacityMgntData.csv | ?{$_.Mailboxes -gt 303} | Export-csv -path C:\SCOM_Tasks\Mbx_Above303.csv;
Send-MailMessage -Attachments "C:\SCOM_Tasks\Mbx_Above303.csv" -To “[email protected]" -From “abc@xyz" -SMTPServer [email protected] -Subject “Mailboxex are above 303 in Exchange databases” -Body “Mailboxex are above 303 in Exchange databases"
Mailboxex - is the line which i want to monitor if the values there are above 303. And it will extract the lines with all above 303 to another CSV file and 2nd is a mail script to email me the same with the attachment of the 2nd extract.
Gautam.75801 -
How to open files using cmd command?
Hello... First:
try {
Process p = Runtime.getRuntime().exec("cmd.exe ?????");
catch(Exception e){ }well... I'm trying to open files using a cmd command. It's working only oppening files on my own pc, but i need to know if i can open files using a localweb's pc, with the follow address, for example:
"\\172.21.0.4\firstdir\seconddir\thirddir..."
Thanks :DGamboua wrote:
normaly, i type \\172.21.0.4\dir\dir\dir... directly directly in my cmd.This only works because you are already running cmd.exe
Try getting it to work with cmd.exe at the start of the line. -
Question about openning files using SDK 10.
I have written a Plug-In for SDK 9 that works wonderfully. One of the functions is for the user to be able to page (Next/Previous) between PDF files on our server. This functionality now longer works without crashing Acrobat 10. All I am doing is creating the URL path to the next/previous PDF, creating a CustomFileSys with the path and calling AVDocOpenFromFile.
Does this no longer work with Acrobat 10 SDK?
Thanks!Should work fine, AFAIK.
For this level of issue, I would open a formal support request with developer support.
From: Adobe Forums <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Date: Mon, 10 Oct 2011 08:51:08 -0700
To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
Subject: Question about openning files using SDK 10.
Question about openning files using SDK 10.
created by Greggars<http://forums.adobe.com/people/Greggars> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/3963065#3963065 -
Reproducable program locks when opening files using finders "Today" filter
Hi,
I am experiencing lockups (have to force quit the programs - which works) in different software products when I try to open files using the "Today" smartfilter from finder / the open dialogue. This wil happen when I attach files to websites using a file-input in Safari as well as with Photoshop just to name an example. It happens every time. Don't know why - and sure, I can avoid using a workflow like this - but I think this is not normal.
Anyone else experiencing these problems? Seems to be related to snow leopard since I do not remember having had these issues in the past.
The filetype does not seem to matter. It happened with PDF's, Jpg's, PSD's, etc.
Message was edited by: jmuellerRollingRocker, did you ever get a solution for this? I am having the same problem. I produce a pdf using a JSF third party api called flying saucer, which actually uses itext to produce the pdf. I can attempt to produce the same exact pdf over and over and about 85% of the time the error occurs and the rest of the time the pdf opens successfully with no error. Obviously 15% of the time the reader is completely happy with this pdf, so it is not a malicious document in any way.
-
Open a file using matlab script block
Hello!
I want to open a file from a specified directory using matlab script block.
The input of this block is a string with file's name......but it doesn't work in this way. I have to change the input data or I have to change it into matlab matlab script?
Some idea?
Thanks!
Attachments:
example.PNG 4 KBOoooppss!
My computer is crazy....sorry.
I'm near to solve my problem...
The problem is that I have a column of strings like this
str=['labview'
'labview2'
'labview3'
'labview4']
I use the double command but the byte array to string block only converts me an element, do you know is exist another block to change all the elements.
I've tried to do with a for loop block....using an index array and changing with i the index element, but it doen'st work.
You have some idea? -
Subtracting Columns from Import File Using Import Script
The file I am importing to FDM contains two amount columns, 1 Debit, 1 Credit. I want to have the Amount field populate as the Debit minus Credits. I have attempted an import script that is giving me an error in the bolded line:
Function GBS_Amount(strField, strRecord)
'Oracle Hyperion FDM Integration Import Script:
'Created By:
'Date Created:
'Purpose:
'Set variables
dim strNatural
dim strCurmnthDR
dim strCurmnthCR
dim strCurAmount
'Store the Natural Account as Column 1 of 11 of a comma delimited file
strNatural = Trim(DW.Utilities.fParseString(strRecord, 11, 1, ","))
'Store the Current Month Debit Amount as Column 7 of 11 of a comma delimited file
strCurmnthDR = Trim(DW.Utilities.fParseString(strRecord, 11, 7, ","))
'Store the Current Month Credit Amount as Column 8 of 11 of a comma delimited file
strCurmnthCR = Trim(DW.Utilities.fParseString(strRecord, 11, 8, ","))
'Calculate the YTD Amount
strCurAmount = strCurmnthDR - strCurmnthCR
GBS_Amount = strCurAmount
End If
End Function
What syntax do I need to use to subtract two defined variables?Hi Experts,
I have a similar situation,I am trying to import the Multiple amount columns to be addedd and imported as one amount column.Below is the script I am using for the same,script is getting verified in Script editor but When I am trying to Load the File in import, I am gettig an error as below.but if I try to import without using the script for the amount, inport is getting done.I have attached script to amount column only.
ERROR
Code............................................. 9
Description...................................... Subscript out of range
Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
Component........................................ upsWObjectsDM
Version.......................................... 1112
Thread........................................... 8380
Scirpt being used
Function Import_YTD(strField, strRecord)
'Set variables
dim strCurmnth1
dim strCurmnth2
dim strCurmnth3
dim strCurmnth4
dim strCurmnth5
dim strCurmnth6
dim strCurmnth7
dim strCurmnth8
dim strCurmnth9
dim strCurmnth10
dim strCurmnth11
dim strCurmnth12
dim strCurAmount
strCurmnth1 = Trim(DW.Utilities.fParseString(strRecord, 20, 9, ","))
strCurmnth2 = Trim(DW.Utilities.fParseString(strRecord, 20, 10, ","))
strCurmnth3 = Trim(DW.Utilities.fParseString(strRecord, 20, 11, ","))
strCurmnth4 = Trim(DW.Utilities.fParseString(strRecord, 20, 12, ","))
strCurmnth5 = Trim(DW.Utilities.fParseString(strRecord, 20, 13, ","))
strCurmnth6 = Trim(DW.Utilities.fParseString(strRecord, 20, 14, ","))
strCurmnth7 = Trim(DW.Utilities.fParseString(strRecord, 20, 15, ","))
strCurmnth8 = Trim(DW.Utilities.fParseString(strRecord, 20, 16, ","))
strCurmnth9 = Trim(DW.Utilities.fParseString(strRecord, 20, 17, ","))
strCurmnth10 = Trim(DW.Utilities.fParseString(strRecord, 20, 18, ","))
strCurmnth11 = Trim(DW.Utilities.fParseString(strRecord, 20, 19, ","))
strCurmnth12 = Trim(DW.Utilities.fParseString(strRecord, 20, 20, ","))
If strCurmnth1="" Then strCurmnth1="0" End If
If strCurmnth2="" Then strCurmnth2="0" End If
If strCurmnth3="" Then strCurmnth3="0" End If
If strCurmnth4="" Then strCurmnth4="0" End If
If strCurmnth5="" Then strCurmnth5="0" End If
If strCurmnth6="" Then strCurmnth6="0" End If
If strCurmnth7="" Then strCurmnth7="0" End If
If strCurmnth8="" Then strCurmnth8="0" End If
If strCurmnth9="" Then strCurmnth9="0" End If
If strCurmnth10="" Then strCurmnth10="0" End If
If strCurmnth11="" Then strCurmnth11="0" End If
If strCurmnth12="" Then strCurmnth12="0" End If
'Calculate the YTD Amount
strCurAmount = CDbl(strCurmnth1) + CDbl(strCurmnth2) + CDbl(strCurmnth3) + CDbl(strCurmnth4) + CDbl(strCurmnth5) + CDbl(strCurmnth6) + CDbl(strCurmnth7) + CDbl(strCurmnth8) + CDbl(strCurmnth9) + CDbl(strCurmnth10) + CDbl(strCurmnth11) + CDbl(strCurmnth12)
Import_YTD =strCurAmount
End Function -
How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?
I want to do the below task using powershell script only.
I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
This image is csv file only.
Could you please any one help me.
Thanks in advance.
By
A Path finder
JoSwa
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
Best Online JournalNot certain this is what you're after, but this :
#import the contents of both csv files
$dbexcel=import-csv c:\dbexcel.csv
$liveexcel=import-csv C:\liveexcel.csv
#prepare the output csv and create the headers
$outputexcel="c:\outputexcel.csv"
$outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
$outputline | out-file $outputexcel
#Loop through each record based on the number of records (assuming equal number in both files)
for ($i=0; $i -le $dbexcel.Length-1;$i++)
# Assign the yes / null values to equal the word equivalent
if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
#create the live of csv content from the two input csv files
$outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
#output that line to the csv file
$outputline | out-file $outputexcel -Append
should do what you're looking for, or give you enough to edit it to your exact need.
I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers). -
Error when opening files using SMB server
I’m trying to download files using a Windows SMB server, but it does not work properly. I'm using a VPN connection to access the server. I already added smb protocol in my system preferences (using 'more internet'), but when I’m trying to open a file, the following error message (code 36) appears:
The Finder cannot complete the operation because some of the data in smb://........ could not be read or written.
The Console gives the following error message:
mount_smbfs: can't get server address `……:
Unknown host
mount_smbfs: can't get server address: syserr = Network is down
Does anyone know how to solve thed error? Thanx in advance!
iBook G4 Mac OS X (10.4)This has been bugging me. Typically, the FileOpenClient error would include the name of the "client" referenced by the FileOpenClient parameter in the ditafm.ini file (I don't think it really does anything, but that's not the point). In this case it's not indicating the name of the client. After some testing it looks like FM10 (probably FM9 as well) prints this error along with the message about being unable to open a file. I have a feeling that it's just a bogus error message. However, the message about being unable to open the file is real.
Note that there is a difference between being unable to "open" of "locate" a file .. you'll see different messages in each condition. This (and the message from M_Boyd) are "open" errors. Off hand I don't know why. Try manually opening the file specified and see if you get any errors. I've not been able to replicate the "open" error (just a "locate" error) even when I corrupt the target file so it is invalid XML. When I do this, the xref does not properly resolve, and it *does* add significant time to the time it takes to open the referencing file .. but I'm not getting any errors written to the console for this .. strange.
Also note that the error says "Unable to resolve link" .. this means a "link" element is the referencing element, as opposed to an "xref". If it was an xref it would say "Unable to resolve xref".
Bottom line .. don't worry about the FileOpenClient error .. I think it's just bogus. But there is some reason that FM isn't able to open your referenced files. I'd strip out all of the references and start over with just one .. make sure it works before adding more. The simpler you can keep the directory structure the better.
Cheers,
...scott -
Bridge opens image files using Windows Photo viwer - not Photoshop CC. This is an utterly useless default setting. How do I get Bridge to open a file in Photoshop?
Edit/preferences/file type association. Set extensions to prefered default.
-
does anyone know how to open a file using wild cards in the name.
For example, a certain folder will contain a number of files, with the name constructed as follows:
CALDB_ then a 6 digit serial number, and then 14 characters which could be ANYTHING. so it might look like this
CALDB_123456_33KA1234567890.txt
or
CALDB_123457_33KA1234567890.txt
The key part of the file name is the 6 digit serial number which is unique, and the CALDB_ which is always the same.
I would like to use a file open command with the file name something like CALDB_123456_*.txt, but it doesn't appear to work.
Can anyone help?
Thanks
Solved!
Go to Solution.Hi Dylan,
I have been searching along our forum, and found a similar question for using wildcards in selecting files. An active user (unclebump) replied on this request with a VI, with which you can select a folder on your computer which is scanned for certain files. I've adjusted this VI for selecting the CALDB_* files. Enclosed you will find this file (zipped) including my test folder.
Maybe this will be helpfull for your application.
Best regards,
Peter Schutte
Message Edited by Peter S on 10-14-2008 03:22 AM
Attachments:
File selecting.zip 12 KB
Maybe you are looking for
-
I'm looking for an app to help with math tutoring.
I doubt that I will find exactly what I am looking for, but if anyone can provide suggestions, I would appreciate it. Groupboard is close, but has a few fatal flaws. Criteria List(required): Whiteboard where I can see what my student is writing in re
-
I am running Photoshop elements 5.0 on Windows Vista. After downloading some pics that froze the download in the middle, I now get an error message when I try to open the organizer. Message is as follows: Microsoft Visual C++ Runtime Library The appl
-
I want to change my default email to hotmail (currently it goes to Outlook, which I don't use). Firefox instructions say to choose "webmail" in applications, but when I do, the only webmail account that shows up is gmail, which I don't use. The other
-
Having trouble transferring hosting to BC
Hi, Last week I transfered hosting of one of my websites to BC. I cancelled hosting with old host, and added the BC DNS to the Domain Registrar (still JustHost.com) of ns1.worldsecuresystems.com, ns2.worldsecuresystems.com and ns3.worldsecuresystems.
-
I am trying out Acrobat 9 Pro. I am trying to figure out how to do something in AA9 that I did for years with AA7 using an add-on from Organic Toolbox called Eraser. That add-on allowed me to "erase" any portion of a page and at one stroke could do