Why does this script beep at me :-(
Writing a script that creates job folders and duplicates files, all works great, but when I save the script as an application, I get a beep after every file is copied.
Perhaps I am doing something wrong, so I created a test script just that just copies files and the same thing happens, when I run it the files get copied, and at the end it beeps once, save it as an application, the files get copied, but I get four beeps.
this is sample script:
-- move file test
tell application "Finder"
set FromFolder to "Macintosh HD:Users:cls:Scripts Test Center:NewJob:MoveFromFiles:"
set ToFolder to "Macintosh HD:Users:cls:Scripts Test Center:NewJob:MoveToFiles:"
set FileName to "NewJob1.txt"
set MvFile1 to FromFolder & FileName
set FileName to "NewJob2.txt"
set MvFile2 to FromFolder & FileName
set FileName to "test1.tif"
set MvFile3 to FromFolder & FileName
set FileName to "test2.tif"
set MvFile4 to FromFolder & FileName
duplicate file MvFile1 to ToFolder
duplicate file MvFile2 to ToFolder
duplicate file MvFile3 to ToFolder
duplicate file MvFile4 to ToFolder
end tell
as I said this is just a test, my original intent is to copy files from different locations, but this test has the same one beep per file after saving as an application.
Can I turn off the beep, or am I doing something wrong?
Thanks
Hi ErstO. Welcome to Apple Discussions!
You can hear a beep even when you duplicate a file with ⌘D in the Finder. That's normal. Try this:
*set FromFolder to "Macintosh HD:Users:cls:Scripts Test Center:NewJob:MoveFromFiles:"*
*set ToFolder to "Macintosh HD:Users:cls:Scripts Test Center:NewJob:MoveToFiles:"*
*set MvFile1 to FromFolder & "NewJob1.txt"*
*set MvFile2 to FromFolder & "NewJob2.txt"*
*set MvFile3 to FromFolder & "test1.tif"*
*set MvFile4 to FromFolder & "test2.tif"*
*set volume with output muted* -- StandardAdditions.osax > Miscellaneous Commands
*tell application "Finder"*
* duplicate file MvFile1 to folder ToFolder* -- the word folder is required before the path
* duplicate file MvFile2 to folder ToFolder*
* duplicate file MvFile3 to folder ToFolder*
* duplicate file MvFile4 to folder ToFolder*
*end tell*
*delay 1* -- should be enough
*set volume without output muted*
Hope it can help.
(The script seems to work even without the word folder being put before the ToFolder path. However, if you open the Event Log History window after having run the script, you will see a huge difference.)
Message was edited by: Pierre L.
Similar Messages
-
Why does this script behavior change with the phase of the moon ?
Can anyone from adobe corp or non-adobe volunteers tell me where to look in their docs to find out why this script change its behavior or how to use the debugger to figure out the same. I read the guide and the whole section on debugger and break points etc well.
try{
this.getField('Button4').strokeColor = color.red ;
app.setTimeOut( "this.getField('Button4').strokeColor = color.green ;" , 500 );
app.setTimeOut( "this.getField('Button4').strokeColor = color.blue ;" , 1000 );
app.setTimeOut( "this.getField('Button4').strokeColor = color.red ;" , 1500 );
app.setTimeOut( "this.getField('Button4').strokeColor = color.green ;" , 2000 );
app.setTimeOut( "this.getField('Button4').strokeColor = color.blue ;" , 2500 );
app.setTimeOut( "this.getField('Button4').strokeColor = color.red ;" , 3000 );
app.setTimeOut( "this.getField('Button4').strokeColor = color.green ;" , 3500 );
app.setTimeOut( "this.getField('Button4').strokeColor = color.blue ;" , 4000 );
catch(e){}
Sometimes the above script cycle thru all the colors in proper order and other time it get stuck.
I have linked it to a button so its part of the button javascript.
Is there a way to craft setTimeOut calls that it becomes a reliable delay ?
How to craft it such that the file does not change and does not have to be saved ? This is wanted in addition but not the essential issue at the moment.
Thanks,
RainbowMAXcount=20
// Create a simple color animation on a field called “Color” that changes every second.
function DoIt() {
var f = this.getField("Button4");
var nColor = (timeout.count++ % 10 / 10);
// Various shades of red.
var aColor = new Array("RGB", nColor, 0, 0);
f.fillColor = aColor;
console.println( 'change' + ' ' + nColor + '; count=' + timeout.count );
if (timeout.count >= MAXcount)
app.clearInterval ( timeout );
console.show();
console.clear();
console.println('Start');
// save return value as a variable
timeout = app.setInterval("DoIt()", 1000);
// Add a property to our timeout object so that DoIt() can keep a count going.
timeout.count = 0;
console.println('End of code');
// And observe the results. I expect your new timer events are conflicting with each other. Note that in the above code the change is performed within the called function and not as new line of code.
I ran it but did not follow your last comment and acrobat disk icon prompts for saving the file. Can anyone remove this "latter problem" ? Can it be solved by any means ? -
Why does this script changes modification date???
Hello All,
I am using this script with an Acrobutton to advise my users of the current PDF version.
var stmDoc = Collab.documentToStream(this)
var strDoc = util.stringFromStream(stmDoc);
var strVer = strDoc.substr(5,3)
app.alert({cMsg: "The PDF version is: " + strVer, nIcon: 3, nType: 0, cTitle: "PDF Version Check"});
Problem is that when closing the document, even though not prompted, the file is saved (assumed, since the modification date changes).
Is there anything about this script that is doing this?I added a "this.dirty = false;" to the end, but it does not do as I had hoped. The pdf does not prompt for a save, which is what I understand the dirty flag to be effecting. The modification date changes anyway. Am I not using the dirty flag correctly? Thanks in advance for your help.
-
Why does this script fail with OS X Lion?
The following AppleScript has been woorking just fine ronning Snow Leopard. Under Lion only the first site is loaded and the other Safari tabs are Untitled. Does anyone know what is wrong and how do I fix it? Thanks for any help.
Hugh
---------------------------------------------------- Non-working script ---------------------------------------------------------------------
tell application "Safari"
open location "http://www.macrumors.com/"
tell window 1 to set current tab to make new tab with properties {URL:"http://www.macworld.com/"}
tell window 1 to set current tab to make new tab with properties {URL:"http://www.macnn.com/"}
tell window 1 to set current tab to make new tab with properties {URL:"http://reviews.cnet.com/macfixit/?tag=mfiredir"}
tell window 1 to set current tab to make new tab with properties {URL:"http://www.macintouch.com/"}
tell window 1 to set current tab to make new tab with properties {URL:"http://arstechnica.com/apple/"}
tell window 1 to set current tab to make new tab with properties {URL:"http://www.appleinsider.com/"}
end tellDoes anyone know what is wrong and how do I fix it?
Actually, I don't know why your script fails with Mac OS X Lion. I can only suggest the following workaround, which seems to work properly:
set myURLs to {"http://www.macworld.com/", "http://www.macnn.com/", "http://reviews.cnet.com/macfixit/?tag=mfiredir", "http://www.macintouch.com/", "http://arstechnica.com/apple/", "http://www.appleinsider.com/"}
open location "http://www.macrumors.com/"
tell application "Safari"
activate
tell window 1 to repeat with thisURL in myURLs
set current tab to make new tab
my newTab(thisURL)
end repeat
end tell
on newTab(theURL)
tell application "System Events"
keystroke "l" using command down
keystroke theURL & return
end tell
end newTab -
[Unknown] Bash: Why does this script break my environment?
I'm trying to build a script to do a couple makepkg tasks and it looks like I'm having trouble with a function breaking the environment. The function does several commands and then breaks makepkg. After I run the script, makepkg runs as if no options are entered:
makepkg -g
==> Check: Installer is the correct size.
==> Extracting archive...
==> Copying files...
cp: cannot overwrite non-directory `/var/abs/local/personal/worldofgoo/pkg/usr/share/games/worldofgoo/WorldOfGoo' with directory `WorldOfGoo'
==> ERROR: An unknown error has occurred. Exiting...
Instead of the expected:
makepkg -g
==> Retrieving Sources...
-> Found worldofgoo.desktop in build dir
==> Generating checksums for source files...
md5sums=('e49849a66aa50065d4d548653a33cc23')
Here's the script it just started happening when I added the function. I think it has to do with the curly brackets that awk uses.
#!/bin/bash
# mp - makepkg package building tasks
# Add md5sums following source array in PKGBUILD
md5add () {
# Delete previous md5sum entries
sed -i '/^md5sums/,/).*$/d' PKGBUILD
# Add md5sums to end if PKGBUILD
makepkg -g >> PKGBUILD
# Move md5sums to follow source array
awk 'BEGIN {
checkAt = 0
filesAt = 0
scanning = 0
/md5sums=\(/ {
checkAt = NR
scanning = 1
/source=\(/ {
filesAt = NR
scanning = 1
/)$/ {
if (scanning) {
if (checkAt > filesAt) {
checkEnd = NR
} else {
filesEnd = NR
scanning = 0
lines[NR] = $0
END {
for (i = 1; i <= NR; ++i) {
if (checkAt <= i && i <= checkEnd) {
continue
print lines[i]
if (i == filesEnd) {
for (j = checkAt; j <= checkEnd; ++j) {
print lines[j]
}' PKGBUILD > /tmp/PKGBUILD.tmp
if [ -f /tmp/PKGBUILD.tmp ]; then
mv /tmp/PKGBUILD.tmp PKGBUILD
fi
# Remove trailing blank lines
while [ "$(tail -n 1 PKGBUILD)" == "" ]; do
sed -i '$d' PKGBUILD
done
# Options
case $1 in
p ) if [ ! -f ./PKGBUILD ]; then
echo "No PKGBUILD in this directory ($(pwd))"
exit; else
makepkg -sf
fi
s ) if [ ! -f ./PKGBUILD ]; then
echo "No PKGBUILD in this directory ($(pwd))"
exit 1; else
echo "adding md5sums"
md5add
makepkg -f --source
fi
* ) # Display usage if full argument isn't given
echo " ${0##*/} <option> - makepkg building tasks:"
echo " p - build package (also installs dependencies)"
echo " s - build source-only tarball (adds md5sums, tars for submission)"
exit
esac
I have to restart to reset the environment (logout doesn't work) so I'l like to be able to fix this . Any ideas?
Last edited by Gen2ly (2009-10-30 15:19:17)Just reinstalled and not having it come up again. Putting this in wonderland.
Last edited by Gen2ly (2009-10-30 15:18:44) -
Why does this script error on shutdown?
it's the one from this package: http://aur.archlinux.org/packages.php?d … =1&ID=2885
http://aur.archlinux.org/packages/oss2j … ck/os2jack
Although it works good it spouts some ugly error on shutdown(although it manages to shutdown correctly)
Now i just copied the code from some other script so i don't know what could be wrong. So please, all you bash ppl out there!
/me makes mental note to read the rest of RUTE linux manual to 'get' this stuff more.Well, at a first glance, the script backgrounds the kill command and then checks the return status, which I'm pretty sure doesn't work... so it probably does it's job, but looks as if it's failing.
-
Why does this script not work when run with osascript cli?
I wrote the following to interface with geektool to display a list of todo's on my desktop (i'm sure it's been done elsewhere, but I wanted to try it myself). I had it working fine until I tried ordering the output to place the highest priority items at the top of the list. The following code works properly during development in Script Editor, but when geektool launches the command using osascript ~/Library/Scripts/todos.scpt it only displays the initial "TODOS:" without displaying the rest of the info. Searching the Applescript Release notes, I found that some versions of Applescript 1.8 had issues with null characters when using the osascript cli, however, I'm running 1.10.7 so it shouldn't be an issue (and I'm not sure how to check for null characters in Applescript even if it were). Anybody have any ideas on what's going on here?
set output to {"TODOS:
set highpri to {}
set medium to {}
set low to {}
set nada to {}
tell application "iCal"
repeat with i in calendars
repeat with j in todos of i
if (completion date of j as string) is equal to "" then
if priority of j as string is equal to "high priority" then
copy summary of j & "
" to end of highpri
end if
if priority of j as string is equal to "medium priority" then
copy summary of j & "
" to end of medium
end if
if priority of j as string is equal to "low priority" then
copy summary of j & "
" to end of low
end if
if priority of j as string is equal to "no priority" then
copy summary of j & "
" to end of nada
end if
end if
end repeat
end repeat
end tell
return (output & highpri & medium & low & nada) as stringwell, i'd been pulling my hair out for quite a while with this and decided it was time to ask for help, but I thought I'd give it one last shot and found a resolution almost immediately. I figured that problem had to be caused by the way applescript was concatenating the lists, so I got rid of the lists completely and it still wouldn't work. This convinced me that it must be newline related since that was the only special character left in the string. I opened up the script in vi, but the default compiled script format is not human readable. The osascript man page indicated that it would accept both compiled and text scripts, so I gave it a try, and osascript handled the raw text file wonderfully.
-
Why does this script only work on mobile devices?
Is there any reason this conditional statement would work on mobile devices and not in a desktop browser i.e. Chrome, Safari? I am using it in a scroll activated project to trigger a symbol to play forwards or backwards depending on where the playhead is in the symbol. Works great on an iPad but not Chrome, Safari on my desktop.
if (sym.getSymbol("icons_sym").getPosition("back") ) {
sym.getSymbol("icons_sym").playReverse();
else {
sym.getSymbol("icons_sym").play("front");
Thanks,
MarkIvan
Sorry, my original posting was complete rubbish - I'll try and find the right answer...
HTH
Regards Nigel
Message was edited by:
nthomas -
With "Do Not Disturb" active, why does the iPhone beep when plug in for recharge?
With "Do Not Disturb" active, why does the iPhone beep when plug in for recharge?
I usually go to bed after my wife. I have the Do Not Disturb set for 11 pm to 7 am, and I can see the moon symbol.
So why when I go to bed at midnight and plug in my iPhone to recharge do I get a LOUD BEEP?
My wife is banning my phone from being next to my bed and an alarm clock.
To me it seems that the "Do Not Disturb" should turn this beep into a vibrate.section2i:
If that is true, then you should file that as a bug using the link above:
If I am reading what you are saying correctly, you are saying that when vibrate is 'off', and you turn on the phone and plug it in that a vibration occurs, and that it is not respecting the vibrate 'off'.
That would be a slightly different issue from what I am asking about (Do Not Disturb), and would probably need a separate bug report. -
I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great!
The fact that you can receive means you have a valid e mail address, and have established the connection to the incoming server, so all of that works. Since the send does not work, that means your outgoing server is rejecting whatever settings you used formthe outgoing set up. Try them again.
Google your particular isp, and ipad and many times you will find the exact settings needed for your isp. Or tell us here, and soneone else may be on the same isp. Some mail services need you to change a port, or have a unique name for the outgoing server.
Kep trying. -
iTunes will not use the redeemed gift cards on my account, I have a $30 credit and when I try to purchase a song it goes right to my credit card on file. Why does this keep happening???
Any time you've changed anything in your billing, it does this once to very things.
-
every time that i sync my iphone with a cord to my imac some large portion of my music is placed in the cloud so that i must down load it from the cloud. this includes music that i have purchased on itunes and other music. it seems random.
why does this happen? is it a setting? i want to stop it. and music that wIt was gift back in September. You can follow the instructions in the link below to remove them:
Remove iTunes gift album "Songs of Innocence" from your iTunes music library and purchases - Apple Support -
Why does this happen?
What do other people do? (I can't go to sleep knowing there's a rogue album or song in my music. It's 2am now)
What do we tell apple so that they actually fix it. None of us want to pay £25 to have our own music.I am on the monthly payment plan because nobody at BT has told me there is any alternative!
Each year there I have a long, in-depth conversation with the person who sets up the contract for the next year but the gist of the thing is 'I'm not going to be paying more than [x amount] per month, am I? Because I can't afford any more'' and each year the person says that no, in fact I should be paying less... and then without notice and even with the bill saying 'We will continue to take....' a totally different - and higher - sum disappears from my bank account.
Then I go through the painful process of writing to complain about this, get some sort of sum refunded and then the payments go through at the level they should, with me paying any additional (usually small) amounts for usage over the allowance. Until contract end when we start all over again...
Even if the amount they seem to randomly decide on is based on some sort of forecast, this should not be happening as I am doing what they instruct me to do on the bill to keep my payments the same.
So something is going wrong, on many levels.
At no point have I been offered the sort of 'monthly billing' described here; maybe there is some reason I am not allowed it. Unfortunately 'whole bill' direct debit payment is beyond me. I really need to know what I will be paying each month and I need BT to correctly take that amount, as agreed, each month, from the get-go.
It shouldn't be that hard really! Does anyone from BT read these forums? Can somebody take this on and finally get this straight, please? -
Why does this message keep appearing when Itry to instal windows 7 through bootcamp? - "Your bootable USB drive could not be created. An error occurred while copying the Windows installation files."
Found a solution!
Follow the extended version of these directions here:
https://discussions.apple.com/docs/DOC-3581
Worked like a charm! -
I sometimes get e-mails with pdf attachments. However instead of opening a PDF icon the body of the e-mail message has the PDF's already opened. Why does this happen? Is there anything I can change on my mac book pro to make these PDF's come thru with their individual icons which can then be opened.
This is a long-standing design flaw in Apple Mail.
Prior to Mavericks, this command in Terminal would stop the annoying behavior:
defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
This Terminal command stopped working in Mail 7.1 under Mavericks. I have reported this to Apple as both a feature request and a bug. You should too.
http://www.apple.com/feeback
Maybe you are looking for
-
Just recently bought a brand-new iPod touch, 5th generation. To be exact, got it two days ago, this past Saturday, on 12/13/2014. Initially, when I first turned it on, it had a fully charge and I didn't need to charge it. I also didn't see anything i
-
Delivery free of charge Invoice should not Post to accounting
Hello, As per Client's specific Business process , till now ZERO value Invoice(Delivery Free of charge) is created (This is not SAP Standard). No accounting document is generated because of ZERO value of Invoice. Only COPA Document is generated. ZERO
-
Trying to store iTunes music using iclouds gbs
i just updated my mac to lion so i could have iCloud, i bought iTunes match and have 5,000 songs on my iTunes. i just purchased an iPhone 4s 32 gb. now is there anyway i can save all those songs over iclouds gb instead of wasting the space on my phon
-
If object is send twice BUT CHANGED server doesn't respond properly
It seams there is a bug in Java 6 Serialization: Instantiate object x. Send it to the server and check the values. Change your client-side instance. Resend and check the values again. The server still shows the old values. To prove this is wrote a li
-
Hi All, I am developing webservice application using Dynamic Proxy client. I am using Weblogic8.1 as my application server. All my services are generated using servicegen and clientgen task of Ant. While using Dynamic Proxy client to invoke webservic