Why my script does not work on all files in the folder?
Hi , here's a script I've hobbled together from various sources using the search function on this forum. It is supposed to replace dashes quadratins in a file in a folder. However, when I run it, it only works on a single file. After making the changes and closes the first file, it stops. Can someone help me troubleshoot and resolve the problem?
var destFolder sourceFolder, files, type sourceDoc file, targetFile, pdfSaveOpts;
sourceFolder = Folder.selectDialog;
If (sourceFolder! = null)
{
files = new Array();
fileType = "* .ai;
files = sourceFolder.getFiles (file type);
If (files.length > 0)
{
destFolder = sourceFolder;
for (i = 0; i < files.length; i ++)
{
sourceDoc = app.open (files [i]); Returns the document object
var active_doc = app.activeDocument;
var search_string = '-';
var replace_string = "\u2013;
var text_frames = active_doc.textFrames;
If (text_frames.length > 0)
{
for (var i = 0; i < text_frames.length; i ++)
{
var this_text_frame = text_frames [i];
var new_string = this_text_frame.contents.replace (search_string, replace_string);
If (new_string! = this_text_frame.contents)
{
this_text_frame.contents = new_string;
}
}
sourceDoc.save ();
sourceDoc.close ();
}
}
}
}
you use the same variable (var I =...) for two loops, when you start to treat the first file I = 0, then after that loop you through all managers of related texts, I = 10 for example, then he wants to treat the next file, file [11] and if you have fewer files, it will stop, if you have more than 10 then it will continue...
.. .change one of them to something else (var j =...)
Tags: Illustrator
Similar Questions
-
Tiara startup script does not work when running file associated with
Hello
I have a startup script that works correctly with tiara itself, however when I open a file associated with tiara (tdms files) the startup script does not work. Is it possible to ensure that the script runs without worrying? Thanks for the help!
Bala
Hi Bala,
Depending on your use case, I suggest you call the next VI, which comes with LabVIEW, after your purchase VI is the creation of the data file. Just pass the data file path in the upper part of entry and your path to the VBScript file in less than entry.
"C:\Program Files (x 86) \National Instruments\LabVIEW 2013\vi.lib\ExportToExcel\DIAdem report Assistant Start CSC.vi '.
Brad Turpin
Tiara Product Support Engineer
National Instruments
-
Scanner does not work for all users on the computer Windows 7
Photosmart 7510 Scanner does not work. My scanner has the habit of work. Now it does not for one of the three users on my Windows 7 desktop.
I spent over 3 hours on the phone with HP. They had me restart the computer, Plug and unplug the printer, reinstall the software twice under different names. The software depending on what user id, it is installed under allows access to the scanner/printer to one or more users. The scanner works with Windows Paint software for all three nicknames.
HP response is that some user control prevents the scanner software, who used to work on all three nicknames on the computer, which now works on one or more of the users. They couldn't tell me which user control need changing.
The HP solution is to restore my system when I could scan for all users of three. I don't want to do that. Does anyone have a better solution?
The real problem is HP error messages. When I click on scan a document, there is no answer. Nothing happened.
Then I tried to scan using Windows Fax and Scan. I got an error message which helped me locate the source of the error. I was able to fix the problem without creating a new user account. I had deleted bu error the file MY Document. Restore this file fixes the problem.
-
Why my scripts does not work when scheduled in the calendar?
Hello
I created scripts to start and stop onedrive using the "Tell" command
When I plan their schedule they fail to run. They were created as programs and work if I launch them manually.
Is there something that I am missing? Or is there a better way?
PS: Scripts are the OneDrive to run after hours to prevent it completely hogging my bandwidth to broadband.
If there is a better way to control the use of bandwidth for OneDrive I would be grateful.
See you soon
Memn
A workflow schedule alarm will not work unless it is attached to a local calendar ("on my Mac"), instead of a network such as iCloud calendar.
-
Describe in SQL script does not work as you wish
Hello
Could you please help me determine why this script does not work.
He said that the date is not set.
Thanks in advance
set p_day_sh = & data_sh
set p_rowid_sh = & rowid_sh
declare
date of p_day_sh;
p_rowid_sh varchar2 (18);
Start
If & p_day_sh is not null then
trains t update
Set t.offdate = to_date ('& p_day_sh ',' DD-MM-YYYY HH24:MI:SS')
where t.rowid = '& p_rowid_sh';
commit;
end if;
end;Hello
In a command SET, if the string to the right of the = sign contains spaces, then it must be in quotes: in the case otherwise, only the first group of characters, white space will be affected.
For example:define p_day_sh = &data_sh
If & data_sh has this value:
11-06-2009 06:25:09
then the DEFINE command is
define p_day_sh = 11-06-2009 06:25:09
and & p_day_sh Gets the value of the part to the workspace:
11-06-2009
Either eliminate the space, Alex has proposed, or place the chain on the right side of the sign = in double - quote:
define p_day_sh = "&data_sh"
The double quotes will not change the meaning if & data_sh contains no white space.
-
Please tell me why this script does not work with Firefox. It works with Safari. Here is the page that includes the script: www.lionsgatehoa.org/newslettertest.html. Thank you. Tom Engleman
Here's the script in my html document:
< embed src = "News2008Fall.pdf" width = '615' height = '3200' > < / embed > "
Edit: removed # phone
Works for me on Linux.
Your system details list does not display the Adobe Reader plugin, so you'll have to (re) install this program.See:
-
Point culminating script does not work correctly
I try to get the yellow filled rectangle to become visible behind the digital field when the numeric field is greater than "1". Can anyone help to see why my script does not work?
https://Acrobat.com/#d=MJObRvA * l9tbFmrlHcMHUA
Thank you
-Don
Hi Don,
Your code does not work because because it is not actually executed. It's because of put you the code on the text box itself output event and this would require the user to move to that field and then leave the field and then run the code.
I would recommend you change you form to add this code at the end of the code that runs your "addAttachment" button and then the form works as I expect.
If (NumberOfAttachments.rawValue > 1) {}
RectangleYellow.presence = "visible";
}
Hope this helps
Malcolm
-
Why xbox 360 controller does not work with all pc games
Why xbox 360 controller does not work with all pc games
Ask in an xbox forum.
-
Why CRYSTAL_REPORT program does not work with windows Vista? __
Why CRYSTAL_REPORT program does not work with windows Vista?
http://www.Microsoft.com/Windows/compatibility/Windows-Vista/default.aspx
Windows Vista Compatibility Center
First thing to do is to check its Vista compatibility at the link above, and if not to see what patches/solutions are available from its manufacturer...
http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-compatibility-mode/
If this is not Vista compatible, read the info on the link above.
It works for some programs, but not all.This applies to software programs, NOT hardware drivers.
If it's Vista compatible > uninstall it > Re-download/save to your desktop > right click on the setup.exe > run as admin.
See you soon.
Mick Murphy - Microsoft partner
-
Why my Skype does not work? "KERNEL32.dll".
[The update by the moderator topic title should be more descriptive. Original section title was: "why my Skype does not work:------?']"
It's saying "Fatal error failed to get proc for GetLogicalProcessorInfromation (KERNEL32.dll) address; __ ; someone help me?
You must update your installation of Windows XP to the latest Service Pack 3 (SP3).
-
Why Apple cards does not work in Saudi Arabia?
Why Apple cards does not work in Saudi Arabia?
Hi msmadi,
I understand you are trying to use cards for Apple in Saudi Arabia, but faced problems. I don't know what questions you are running, but if you want to use a specific feature, it may not be available here. Take a look at the link below to review what features are available with an iOS device using iOS 9.
iOS 9 feature availability
http://www.Apple.com/iOS/feature-availability/Nice day
-
I would like to know why my hotmail does not work
I would like to know why my hotmail does not work
Rex
I think it might be a problem with Hotmail right now because I have seen numerous amounts of threads, saying "cannot connect to hotmail. You could post your question Hotmail forums below and they will have probably more information about it.
-
Why my pc does not work no matter what .exe? I couldn't even run diagnostics
Why my pc does not work no matter what .exe? I couldn't even run diagnostics
Hi SteliosArmenis,
Thank you for keeping us posted on the State of the question.
I see there is that the antivirus installed on the computer could not detect infections. To ensure that the computer is clean, we can run a thorough scan using Windows Defender in offline mode.
I suggest to download Windows Defender Beta offline to a flash drive, CD, DVD or USB and then perform the steps.
The articles explain how to create a disk and run the scan.
NOTE: the program must not not to be run / run from the office.
http://Windows.Microsoft.com/en-us/Windows/what-is-Windows-Defender-offline
http://Windows.Microsoft.com/en-us/Windows/Windows-Defender-offline-FAQ
Note: the data files that are infected must be cleaned only by removing the file completely, which means there is a risk of data loss.
Hope the information is useful. If you need help with this problem, feel free to post you question in the forum. We will be happy to help you.
-
Why pes 2012 does not work with me and my video card is 1699 MB Intel HD Graphics(core i3)?
Hello
You receive an error message?
Method 1:
You can update the drivers of graphics cards and check.
Updated a hardware driver that is not working properly
http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly
Method 2:
You can also perform a clean boot and check if it works:
How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
http://support.Microsoft.com/kb/929135
Note: after a repair, be sure to set the computer to start as usual as mentioned in step 7 in the Knowledge Base articleYou can also check out the link:
The problems of the game performance
http://Windows.Microsoft.com/en-us/Windows7/fixing-game-performance-problems
Diagnose problems running DirectX
http://Windows.Microsoft.com/en-us/Windows7/diagnosing-basic-problems-with-DirectX -
I've upgraded to 2015 CC Photoshop today. However, the quick selection tools and brush do not appear in a circular/round shape. I tried to use the support key to enlarge to see if it carries the form circle/round in sight, but it does not work. All I get is a focus. Can anyone help with this please. Thank you.
Remove the caps lock
Maybe you are looking for
-
I have an iPhone 6 running iOS10. "Whenever I connect my iPhone to my laptop, which runs windows 7, iTunes come and gives me this message: iTunes could not connect to the iPhone (the iPhone name) because an invalid response was received from the devi
-
Satellite C660: the system stops when I use internet or read a file
for 2 days the laptop (I have win7 Home premium) hang up when I use internet, play a game, use a program, read a document. I'm not be able to move the mouse pointer and also pressing CTRL-ALT - ANNU system stops too. The only way to turn off the lapt
-
I received that, in my view, are photos (maybe videos) of my grandchildren on memory cards SDHC my MacBook Pro cannot read. Looks like it's a M2T format... Could someone help. Thank you Norbert
-
Case structure works is not as expected
Hello all I have a business structure which does not seem to work there in the State on. I created the circuit 1st in 1st red slice and it works each led flashes on then off in sequence, but when I try this logic in a case statement (in the 2nd red b
-
15 - r210dx: Wireless driver problem
My laptop comes with windows 8. But I wanted to use windows 7 64 bit which I'm more comfortable with it. I used diskpart and erase all the data and then converted the HARD of GPT on the MBR disk. Then I installed 7 easily. Now the question is, I down