Aplicar estilos de parrafo com scripts
Olá a todos
perdon por mi español
Lo que que pretiendo é aplicar a texto estilos de párrafo ou de caracter com scripts, los exemplos que traz Indesign parecem sensillos mas no es assi.
Me explico: Tengo el texto: Articulo
et un estilo que se designa AR
quando introduzo
{findtext:"Articulo"} {AppliedParagraphStyle:"AR"} no me funciona
Grato por vuestra Ayuda.
Hola, José.
No aclaras para qué versión de InDesign solicitas el script (2.0, 3 o 4), ni el lenguaje del script (Applescript, Visual Basic o Javascript), ni la plataforma en la que utilizas la aplicación (Mac o PC). Estas cosas es necesario citarlas cuando se trata de scripts.
No obstante, te adjunto el script que yo utilizo, el cual está hecho en javascript.
//Cambiar estilos de párrafo
var mydialog = app.dialogs.add({name:"Cambiar estilo de párrafo",cancancel:true});
with(mydialog){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Buscar estilo"});
var miviejo1 = textEditboxes.add({editContents:"",minWidth:200});
var miviejo2 = textEditboxes.add({editContents:"",minWidth:200});
var miviejo3 = textEditboxes.add({editContents:"",minWidth:200});
var miviejo4 = textEditboxes.add({editContents:"",minWidth:200});
var miviejo5 = textEditboxes.add({editContents:"",minWidth:200});
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Nuevo estilo"});
var minuevo1 = textEditboxes.add({editContents:"",minWidth:200});
var minuevo2 = textEditboxes.add({editContents:"",minWidth:200});
var minuevo3 = textEditboxes.add({editContents:"",minWidth:200});
var minuevo4 = textEditboxes.add({editContents:"",minWidth:200});
var minuevo5 = textEditboxes.add({editContents:"",minWidth:200});
var myresult = mydialog.show()
if(myresult == true){
miantiguo1 = miviejo1.editContents;
miantiguo2 = miviejo2.editContents;
miantiguo3 = miviejo3.editContents;
miantiguo4 = miviejo4.editContents;
miantiguo5 = miviejo5.editContents;
mimoderno1 = minuevo1.editContents;
mimoderno2 = minuevo2.editContents;
mimoderno3 = minuevo3.editContents;
mimoderno4 = minuevo4.editContents;
mimoderno5 = minuevo5.editContents;
change()
mydialog.destroy();
else{
mydialog.destroy();
function change(){
miprimario1 = [miantiguo1];
misecundario1 = [mimoderno1];
miprimario2 = [miantiguo2];
misecundario2 = [mimoderno2];
miprimario3 = [miantiguo3];
misecundario3 = [mimoderno3];
miprimario4 = [miantiguo4];
misecundario4 = [mimoderno4];
miprimario5 = [miantiguo5];
misecundario5 = [mimoderno5];
myDoc = app.documents[0];
app.findPreferences = null;
app.changePreferences = null;
if (miprimario1.length==misecundario1.length){
for (var j = 0; miprimario1.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario1[j]},{appliedPara graphStyle:misecundario1[j]});
else {
for (var j = 0; miprimario1.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario1[j]},{appliedPara graphStyle:misecundario1[0]});
if (miprimario2.length==misecundario2.length){
for (var j = 0; miprimario2.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario2[j]},{appliedPara graphStyle:misecundario2[j]});
else {
for (var j = 0; miprimario2.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario2[j]},{appliedPara graphStyle:misecundario2[0]});
if (miprimario3.length==misecundario3.length){
for (var j = 0; miprimario3.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario3[j]},{appliedPara graphStyle:misecundario3[j]});
else {
for (var j = 0; miprimario3.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario3[j]},{appliedPara graphStyle:misecundario3[0]});
if (miprimario4.length==misecundario4.length){
for (var j = 0; miprimario4.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario4[j]},{appliedPara graphStyle:misecundario4[j]});
else {
for (var j = 0; miprimario4.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario4[j]},{appliedPara graphStyle:misecundario4[0]});
if (miprimario5.length==misecundario5.length){
for (var j = 0; miprimario5.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario5[j]},{appliedPara graphStyle:misecundario5[j]});
else {
for (var j = 0; miprimario5.length > j; j++) {
myDoc.search("",false,false,undefined,{appliedParagraphStyle:miprimario5[j]},{appliedPara graphStyle:misecundario5[0]});
{alert ("Cambiados los estilos antiguos por los nuevos" );}
Te aclaro que está hecho para la versión de InDesign 3 (es decir, CS1) y, por si no lo sabes, que debes salvarlo con cualquier nombre, en formato texto y la extensión .js en la carpeta de scripts (en mi caso, c:/Archivos de programa/Adobe InDesign CS/Presets/Scripts).
Espero que te ayude.
Similar Messages
-
Convertir estilo de parrafo a objeto anclado
Hola a todos!
Necesito convertir un estilo de parrafo a un objeto anclado, tengo cientos en cada capítulo del libro
¿Se podría hacer mediante script?
¿Alguien me puede ayudar?
Muchas Gracias@Oddela – there already should be some script snippets doing this (more or less). The methods identifying the right text ranges might vary a bit. Some work with special strings before and after the text as identifier, some work with footnotes as identifier, some work with character styles, some with paragraph styles. Some would do it, if you exchange your own names for paragraph styles, character styles and object styles. That means: You have to read the code and understand where to change parameters for your special needs.
Here one example by Kai Rübsamen on hilfdirselbst.ch that is using special content strings as identifiers for the text, that define exactly what should go into the anchored text frame and what should not:
Texte automatisiert in Marginalien ändern
Kai Rübsamen
Texte automatisiert in Marginalien ändern - Adobe InDesign Skriptwerkstatt - HilfDirSelbst.ch - Forum
There are many more examples out in the web…
Uwe -
Pass oracle user id - forms to unix com script
In 10g Forms when using the host command to launch a unix .com script, is there anyway to pass the Form user's Oracle user id from the form session to the .com script?
The unix script executes an sqr program that requires an oracle id.I managed to pass the UDT to another procedure as long as I only passed one at a time, instead of passing 2 instances of the UDT at once. Does anyone know if this is a limitation of ODP.NET or is there a way to pass multiple UDTs to a stored procedure? (I checked the code samples which come with ODP.NET but didn't find an exmaple of passing multiple UDTs.)
Thanks -
How to access the "Genre", "Artist", and "Album" Panel via COM/script
I thought I posted this a couple of days ago, but checking on "My Posts", it appears I didn't. Oooops
I'm using the COM interface, which is also same as the scripting one.
I'm trying to discover what elements in the iTunes main window have been selected, and thus "highlighted".
The main window appears, to the interface, to be the "BrowserWindow", not to be confused with the View -> Show Browser window. Within this main window, I can identify which Playlist is currently selected, and/or which individual tracks are selected.
But, what I'm trying to do, is also identify if any elements in the View -> Show Browser window are also selected. "Genre", "Artist", and "Album".
Does anyone know if this is possible, and if so, how do I achieve it.
Cheers,
EddieIn case you don't get any replies here, Eddie (your post might get buried under queries about iTunes 7.7), it might also be worth checking in at Teridon's google discussions. Robert's post here has a link through to those:
http://discussions.apple.com/thread.jspa?threadID=1584683&tstart=30
(Robert is the person I think of immediately in the context of scripting issues.) -
Tem um componente no Flash que aplica a barra de rolagem, mas queria saber se tem uma maneira de personalizála. o componente scrollbar, apenas muda a coloração da barra, quero saber como criar uma barra de rolagem personalizada.
It has a component in the Flash that applies the bar of clod roller, but wanted to know if it has a way of personalizála. the component to scrollbar, only dumb the coloration of the bar, I want to know as to create a bar of personalized clod roller.
Exemplo :http://www.djfilipemonteiro.com.br/?gclid=CNa4lsLes6ECFQUf7god-1x8_wI am modifying the correct httpd.conf file on the server, it just doesn't seem to work. - If I put the rewrite rules in the <Directory /> the rewrite works but it adds /Library/WebServer/Documents to the URL.
I also tried putting the rewrite rules in <IfModule mod_rewrite.c> but that did not work either.
mod_rewrite is enabled and running on the server.
I will post the rewrite rules again in the code brackets. Sorry for the long post. - If some one can try them out on their Leopard Server to see if they can get them to work, it would be much appreciated. Again, these work on my Leopard Client but I can't get them to work on Server.
-- The httpd.conf file posted above is just the default conf file found in /private/etc/apache2/
<code>
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^(.+)/$ http://%{HTTP_HOST}$1 [R=301, L]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.php(.*)\ HTTP
RewriteRule (.+)\.php(.*)$ $1$2 [R, L]]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.asp(.*)\ HTTP
RewriteRule (.+)\.asp(.*)$ $1$2 [R, L]]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.aspx(.*)\ HTTP
RewriteRule (.+)\.aspx(.*)$ $1$2 [R, L]]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.htm.(.)\ HTTP
RewriteRule (.+)\.htm.(.)$ $1$2 [R, L]]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.cfm(.*)\ HTTP
RewriteRule (.+)\.cfm(.*)$ $1$2 [R, L]]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.bak(.*)\ HTTP
RewriteRule (.+)\.bak(.*)$ $1$2 [R, L]]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.inc(.*)\ HTTP
RewriteRule (.+)\.inc(.*)$ $1$2 [R, L]]
RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\..(.)\ HTTP
RewriteRule (.+)\..(.)$ $1$2 [R, L]]
<code> -
How come script for cursor doesnt work in jsp pg?
it works in an html pg but it doesnt work in a jsp page when i put in a javascript for an animated cursor btw the body tags:
<script>blah</script>
WHY? thanksWHY?Because it doesn't like you.
View source on the generated JSP page.
Compare it to the html page.
Save the source as a static html file.
Find what is causing the problem - maybe a javascript error on the page that prevents your code running?
If you have IE, Tools:options: advanced tab, and uncheck "disable script debugging" so you can see the error messages - or get a browzer with a decent javascript debugger.
Good luck,
evnafets -
Hi All:
I'm currently looking for a freelancer to write a quick Bridge script for me. If you could handle the job--or know someone who could--could you please shoot me a quote at [email protected]? I have some budget, and want to pay fairly.
If you're interested, here's what I'm after. Many thanks for your consideration!
Adam
Adam O'Hern
Industrial Designer / Spitwad Marksman
[email protected]
cadjunkie.com
solidsmack.com
engineervsdesigner.com
Script: Stack Frame
Language: Javascript
Version: CS6
Description:
When doing product renderings, I often render out animations as image sequences, each frame consisting of several layers. Each layer is output as a separate file. For example:
image_finalColor_0001.jpg
image_finalColor_0002.jpg
image_finalColor_0003.jpg
image_Alpha_0001.jpg
image_Alpha_0002.jpg
image_Alpha_0003.jpg
image_SurfID_0001.jpg
image_SurfID_0002.jpg
image_SurfID_0003.jpg
etc.
This script would 'stack' each frame in Bridge, and also create a separate layered PSD file for each, so that the result, in bridge, looks like this:
image_finalColor_0001.jpg [stack]
image_finalColor_0002.jpg [stack]
image_finalColor_0003.jpg [stack]
image_0001.psd
image_0002.psd
image_0003.psd
Requirements:
Two ways to start run the script:
Right-click any file and select 'stack frame' from the drop-down to analyze a single frame
Menubar > Stacks > 'stack frames' to analyze all frames in folder
Beginning with the end of the filename, script loops backward through each character until it finds a number. It then continues back until it finds a non-number, and stops, storing the last number in the filename as the 'frame number'. Examples:
file_0001.jpg => '0001'
file_0001_backplate.jpg => '0001'
file_02_backplate_0001.jpg => '0001'
file_0001_backplate_02.jpg => '02'
Script then searches other files in the folder using the same method, looking for other files with the same frame number. For example, when looking for frame 0001:
file_0001_foreground.jpg => match
file_foreground_0001.jpg => match
file_02_foreground_0001.jpg => match
file_0001_foreground_02.jpg => no match
Script selects all files containing the same frame number, and assigns them to a 'stack' in Bridge.
With the same files selected, script runs the Photoshop 'Load Files into Photoshop Layers' command
Saves resulting layered file as PSD named with the common elements of the filenames (trimming non-alphanumeric chars):
file_0001_background.jpg + file_0001_foreground.jpg = file_0001.psd
file_background_0001.jpg + file_foreground_0001.jpg = file_0001.psd
file_02_background_0001.jpg + file_02_foreground_0001.jpg = file_02_0001.jpg
file_02_background_0001.jpg + file_foreground_0001.jpg = file_0001.jpg
foobar_file_0002_0001.jpg + file_0001_foreground.jpg = file_0001.jpg
Must exit gracefully on error and provide dialog hints where possible (e.g. 'found no matching frames' etc)
Must ignore non-image file formats (to avoid errors in the Photoshop script)
Resulting PSD layers must be in the same order for every frame where possible (so future Batch operations will work across all PSD files). Obviously this only applies if all layers are present for every frame.
Must ROCK MAJORLY HARD!!
Thanks again!I use Final Cut Pro; keyframing the motion, scaling, etc as needed.
But there's also many other programs available, to name a few:
iMovie
Still Life
Photo to Movie
Motion Pictures
-DH -
Help needed to enhance Image Processor Pro Script to save transparency in TIF
Hi everyone,
this is my first post in this community.
We have a droplet which reduces the resolution of tif images to 72dpi and save the tif image with transparency. This works fine, but it took to long for the whole process of many picture in different folders. That's the reason why we searched for another script which can preserve the folder structure and set the resolution of every tif image to 72dpi.
We found Image Processor Pro, which does exactly what we needed. The script works perfectly in CS5 and CS5.5 as it saves the tif with the transparency. Those saved tif images could be used in InDesign with the transparency.
BUT Image Processor Pro script works not so perfectly in CS6 as it seems that this option to save a tif with transparency is not implemented or does not work in the script. The result is that those converted tif images are w/o transparency in InDesign. That's a huge problem for us.
This is the point where I need your help. Neither I have experience yet with jsx-files nor with the right syntax of it.
Is there a way for anybody of you to implement / enhance Image Processor Pro so it will save tif with transparency?
We used the latest German Version of Image Processor Pro: 2.3.1 (link: http://www.russellbrown.com/scripts.html)
(The German version contains only german on screen texts!)
I am very thankful for every help you can give.
Thanks in advance for your help.Possible causes:
1) It probably has nothing to do with your image files, but you won't know until someone else tests one of them. You could create a small 50% gray TIFF file with transparency and post it, assuming you know it exhibits the issue with IPP.
2) At the download link you provided:
http://www.russellbrown.com/scripts.html
There are two installers for Image Processor (CS5 and CS6). Did you download and install the CS6 Version Installer?
3) Another possible solution other than modifying the script is to reset the PS Preferences file. When strange things happen in PS with no explanation this usually fixes them. My PS CS6 was inflating all new files by 1.4MB. After examining one of the files it turned out PS was inserting a Costco printer profile into every new file. So don't automatically assume your PS image files are not somehow being corrupted and causing loss of transparency in IPP. Creating a new Preferences file resolved my issue:
http://forums.adobe.com/thread/375776
You may want to record your old Preferences settings prior to creating a new one, but test it first with the default settings. -
Script to fix invalid characters for SharePoint synced share
I'm hoping for some help implementing a script that will rename files with characters that are invalid for SharePoint, in a synced file share that is accessed by everyone at an office.
Some background: I'm working for a small nonprofit that has a SBS 2012 server and a local domain with about 30 users. I'm the sole volunteer IT person here. We have a network file share on the server that everyone stores their documents on. Recently,
we signed up with Office 365 Online and I set up a SharePoint library and synced it with the document share on our server. A few files aren't being uploaded, though, because of invalid characters (For instance, a file like "Outline/Team plan #3.doc"
Expecting everyone to remember not to use any of the invalid characters isn't really a solution, particularly since I'm not here full-time if things go wrong. I'm looking for a script to run on the server every few minutes that will rename any incompatible
files so that they can be uploaded to SharePoint. Personally, I think it's just plain criminal that Microsoft hasn't provided this functionality itself (it's the least they could do) but that's another rant for another time. Unfortunately, while
I do have a couple of years of experience with basic server administration and group policy, I'm not experienced at all when it comes to PowerShell scripting. I can string together some command line commands in a batch file, and that's about it.
I did find this promising post here:
http://community.spiceworks.com/scripts/show/2097-fix-file-names-for-skydrive-pro-syncing
I was hoping for opinions - is this the sort of thing I'm looking for, and what would be the best way to implement it (eg, every few minutes as a scheduled event)? Also, is this a straight-up powershell script, or are there additional languages/resources
involved? (Like I said, I'm sort of a script newbie).
Additional background: I posted a similar question asking if it could be done with GPOs, and they directed me here, suggesting it could be done with scripts.
Thanks!!That script that Mike linked to is a good one, i've used it myself a fair few times. Just to weigh in with a bit of information on why those characters are forbidden:
The reason that some characters aren't allowed is that those characters are used as special characters in URLs. If you were to allow them to go into the file names (without 'escaping' them) then all the traffic to and from SharePoint would start to
go horribly wrong.
Now it is theoretically possible to build a tool that recognises the characters, escapes them, then uploads them. As well as updating the SharePoint interface to 'unescape' the characters when it renders them. However it's not a trivial bit of engineering,
you'd have to gut SharePoint and re-do some of the core behaviour. You've then got to re-test it and make sure it doesn't break any previous SharePoint behaviour.
The way MS want you to work is to save the files directly to SharePoint, which would pick up that you have protected characters and prompt the user to correct them. That does break down a bit with OneDrive as you can use the characters locally, it's only
the next step that fails... -
Hi
Iam using Data merge in indesign to produce some school reports to print for pupils in year 11 there are 22 subjects but some of the children only do say 8 of those 22 subjects. i need to be able to automatically delete tables text boxes and pages if they do not display anything on the pages from the data merge. I do have some javascript experience so I'm willing to give the scripting a go to save me masses of time. but I'm unsure what is possible and whether i have set the document up correctly would anyone have the time to check the document and give me some advice on how to set up the scripting for this.
Im working in CS3 if that makes a difference.
http://www.theoldhamacademynorth.com/scripts/testscript.inddYou can do if-checks with characters, they just have to be enclosed in quotes:
var fState = this.getField("State").value;
if ( fState == "MN" ) {
this.getField("Tax").value = parseInt(this.getField("Total").value) * 0.065;
That is assuming your field names are "State", "Tax" and "Total". -
I'm trying to install sharepoint tools to users machines. This requires admin privledges. The script below is in a .bat files and installs the product no problems with admin rights. To be able to apply this to users when they log on is where I'm stuck.
Ive tried it as a computer startup script in GPO when the computer starts but it doesnt do anything. Its also hard to know as you cant see any messages.
Any suggestions?
script below:
setlocal
REM *********************************************************************
REM Environment customization begins here. Modify variables below.
REM *********************************************************************
REM Get ProductName from the Office product's core Setup.xml file, and then add "office14." as a prefix.
set ProductName=Office14.SharePointDesigner
REM Set DeployServer to a network-accessible location containing the Office source files.
set DeployServer=\\clientsource\clientSource\Sharepoint
REM Set ConfigFile to the configuration file to be used for deployment (required)
set ConfigFile=\\clientsource\clientSource\Sharepoint\SharePointDesigner.WW\config.xml
REM Set LogLocation to a central directory to collect log files.
set LogLocation=\\clientsource\clientsource\Sharepoint\log
REM *********************************************************************
REM Deployment code begins here. Do not modify anything below this line.
REM *********************************************************************
IF NOT "%ProgramFiles(x86)%"=="" (goto ARP64) else (goto ARP86)
REM Operating system is X64. Check for 32 bit Office in emulated Wow6432 uninstall key
:ARP64
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432NODE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductName%
if NOT %errorlevel%==1 (goto End)
REM Check for 32 and 64 bit versions of Office 2010 in regular uninstall key.(Office 64bit would also appear here on a 64bit OS)
:ARP86
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductName%
if %errorlevel%==1 (goto DeployOffice) else (goto End)
REM If 1 returned, the product was not found. Run setup here.
:DeployOffice
start /wait %DeployServer%\setup.exe /config %ConfigFile%
echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt
REM If 0 or other was returned, the product was found or another error occurred. Do nothing.
:End
EndlocalHello,
Have you checked that the script is in a place where it can be run with the local system account of the computer the "default" location of the scripts is \\domain.com\SysVol\domain.com\scripts OR inside the Group Policy.
Have you checked that the Group policy / script are assigned to the right place (common mistake). If you assign COMPUTER-settings make sure the GP is assigned so that the test computer will get the policy (you can the rcop.msc or GPRESULT /h c:\pathherewhereyouwanttheraport.html
to make sure the computer really gets the right policy)
When you have created the group policy and selected: Computer Configuration, Windows settings, Scripts (Startup/Shutdown), Startup. On Scripts-tab selected ADD. please check that the information is
right
Script name: MyScript.bat
Script Parameters (the path where the script is located comes here): \\domain.com\SysVol\domain.com\Policies\{557740FF-AFAE-4300-9BD7-B90555FDA1BE}\Machine\Scripts\Startup -
Is there any color picker component , i tried java script ones with no luck
Hi
Thank you for reading my post.
I tried to use a java script color picker inside my JSC portlet , but it does not works.
i tried many things , but at least i did not find any solution for it.
here is color picker that i tried to use :
http://www.flooble.com/scripts/colorpicker.php?op=get
http://www.flooble.com/scripts/colorpicker.php
and also i tried to use this one with no luck . i tried both of them in html files and they works
http://www.mattkruse.com/javascript/colorpicker/
can some one with more knowledge about javascript and JSC help me ?any comment or advice on this problem ?
-
Horizontal Scrolling Page Script
Okay, I am trying to make a website that scrolls from left to
right, & up and down when the user rolls their mouse across the
screen, like this page (hit enter site first, then let the page
load):
http://www.sonypictures.com/movies/21/
I either need the code or if somebody could point me to a
page where there's a good tutorial on how this works. I know basic
Action Scripting, but I'm having trouble figuring this one out. I
tried something with invisible buttons but it just doesn't flow (it
jumps on rollout) like the site I linked above!
PLEASE SOMEBODY HELP ME! I NEED TO TURN IN A PRICE QUOTE TO
THE CUSTOMER SOON! So I need to know how long this is going to take
meThe method is called parallax scrolling.
First search pulls up
http://webscripts.softpedia.com/script/Multimedia/Parallax-scrolling-21131.html
but I'm sure you can find better resources.
Hope that helps,
Adam
http://www.visitmyworld.co.uk -
How to set a PDF to expire (Working Script)
Here is a little script I made up the other night. You can use it to allow a PDF to be opened only until a set date. I use this for when my employees go to service a customer. I want them to be able to see the customer's information, but only for 24 to 48 hours.<br /><br />CheckExpiration()<br /><br />function CheckExpiration()<br />{<br />/*-----START EDIT-----*/<br />var LastDay = 21<br />var LastMonth = 3<br />var LastYear = 2008<br />/*-----END EDIT-------*/<br /><br />/* DO NOT EDIT PAST HERE !!! */<br />var today = new Date();<br />var myDate=new Date();<br />LastMonth = LastMonth - 1<br />myDate.setFullYear(LastYear,LastMonth,LastDay);<br /><br />if (myDate<today)<br /> {<br /> this.closeDoc(1);<br /> app.alert("This files has expired.",1,0,"Expired");<br /> }<br />}
Here's a slightly different method, but it works..... (and, there is certainly no 'work around' for anyone to get data you don't want them to get!)
<br />
<br />It uses the Action on Open (sorry, I don't know the 'official' name of this - I'll describe it below..) in the pdf to send the user to a server checking mechanism (in this case, a date checker - but you could do the same thing with lots of stuff...)
<br />
<br />Here's how I set it up and it works great!
<br />
<br />1. Start a new document that you can get a form field into (don't use LiveDesign for this - that's too fancy... - just make a document in Word that says ______ then print to pdf to get a nice simple pdf that you can edit directly in Acrobat)
<br />
<br />2. Do a 'Run Form Field Recognition' and Acrobat will find the blank as a field.
<br />
<br />3. Edit this field to have a "key" name (my example, I will use "today" which tells me this is the day that my document starts).
<br />
<br />4. Under the 'Options' tab, make a Default Value of today's date (this will be the 'test against' date - for my example I'm showing how to expire a document in 30 days from creation date, but you could use anything you like - it is simple to modify!)
<br />
<br />5. From the 'Format' tab, use the Select format category of Date. Use a date format you like (my example uses mm/dd/yyyy) Note that this MUST match the server side code described later).
<br />
<br />6. For a 'live' document, you may want to go to the General tab and make the field Hidden as well as other things to not see the 'false' page, but that is outside the scope of this example.
<br />
<br />OK, now on to setting up the document to automatically send this info to your server for testing...
<br />
<br />1. Go to the 'Pages' view (click on the icon at the top left)
<br />2. right-click on the page, select Page Properties.
<br />3. Under the 'Actions' tab, select "Page Open" and "Submit a form" from the drop down boxes.
<br />4. Enter a URL to your web page (see below) that does the checking (like http://mytestdomain.com/Scripts/checkexpiredate.php so it is easy to remember)
<br />5. Check the HTML radio button.
<br />6. Check the 'Only these...' button and then 'Select fields'. Make sure your "key" field is checked as well as the 'Include Selected' button (sometimes, for me, these weren't - I don't know why, so check it!)
<br />
<br />Now, on to the server side...
<br />
<br />Here's the code that goes into the php server file;
<br />
<br /><?php<br />$day = date("d");<br />$month = date("m");<br />$year = date("Y");<br />$today = substr($_REQUEST["today"],3,2);<br />$tomonth = substr($_REQUEST["today"],0,2);<br />$toyear = substr($_REQUEST["today"],6,4);<br /> $tsp = mktime(0, 0, 0, $month, $day, $year);<br /> $tsd = mktime(0, 0, 0, $tomonth, $today, $toyear);<br /> $xdays = ($tsp - $tsd)/(24*60*60); // as calculated from dates<br />$maxdays = 30; //set this to whatever your 'expire from today' date is<br />if ($xdays >= $maxdays)<br /> //do what you like to tell the user it is expired<br />else<br /> //show the info you want them to see<br />?>
<br />
<br />i (the info shown (or not) is outside the scope of this message, this is just a 'one way to make this work' example. In my system, I use a program called fpdf [http://fpdf.org] to create the pdf from 'scratch', building it to show the reader what I want them to see - whether it is a "Sorry, this is expired" document, or the data that they came for if the time hasn't expired.)
<br />
<br />THAT'S IT!!! It works great and you can use it to do tons of stuff - just set the "key" on the original document and make the server code check whatever it is you want!
<br />
<br />Pretty cool, I think! (and, it only took me, a novice programmer, about 3 hours to figure it all out!)
<br />
<br />Best of success with it - enjoy! -
How to script out linked in servers from sql 7.0
Can someone help me with the syntax of scripting out the linked server. Thanks
Hi Suresh,
In addition to other post, you can use the detailed T-SQL scripts below to script out all linked and remote servers on SQL 7.0.
--Script to script out all linked/remote servers
--Works on 7.0 and 2000 servers
--remote password decrypt only works on 7.0
declare
@status smallint, -- server status
@server sysname, -- server name
@srvid smallint, -- server id
@srvproduct nvarchar(128), -- product name (dflt to ss)
@allsetopt int, --sum of all settable options
@provider nvarchar(128), -- oledb provider name
@datasrc nvarchar(4000), -- oledb datasource property
@location nvarchar(4000), -- oledb location property
@provstr nvarchar(4000), -- oledb provider-string property
@catalog sysname, -- oledb catalog property
@netname varchar(30), -- Server net name
@srvoption varchar(30), -- server options
@loclogin varchar(30), -- Local user
@rmtlogin varchar(30), -- Remote user
@selfstatus smallint, -- linked server login status
@rmtpass varbinary(256), -- linked server login password
@pwdtext nvarchar(128), -- linked server decrypted password
@i int, -- linked server pswd decrypt var
@lsb tinyint, -- linked server pswd decrypt var
@msb tinyint, -- linked server pswd decrypt var
@tmp varbinary(256) -- linked server pswd decrypt var
select @allsetopt=number from master.dbo.spt_values
where type = 'A' and name = 'ALL SETTABLE OPTIONS' -- Only 7.0 else use 4063
declare d cursor for SELECT srvid,srvstatus, srvname, srvproduct, providername, datasource,
location, providerstring, catalog, srvnetname
from master..sysservers
where srvid > 0 -- Local Server
open d
fetch next from d into @srvid, @status, @server, @srvproduct, @provider, @datasrc,
@location, @provstr, @catalog, @netname
SET NOCOUNT ON
while (@@FETCH_STATUS<>-1) begin
PRINT '--------------------------------'
Print '-- ' + @server
PRINT '--------------------------------'
If @status in (64,65) --Remote Server
Begin
Print 'sp_addserver'
Print ' @server = '''+ @server + ''''
Print ' GO'
If @status = 64
Begin
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''rpc'','
Print ' @optvalue = ''false'''
Print ' GO'
End
exec ('declare r cursor for
select l.name, r.remoteusername from
sysremotelogins r join sysservers s on
r.remoteserverid = s.srvid
join syslogins l on
r.sid = l.sid
where s.srvname = '''+ @server + '''')
open r
fetch next from r into @loclogin, @rmtlogin
while (@@FETCH_STATUS<>-1)
begin
Print 'sp_addremotelogin'
Print ' @remoteserver = '''+ @server + ''','
Print ' @loginame = '''+ @loclogin + ''','
Print ' @remotename = '''+ @rmtlogin + ''''
Print ' GO'
fetch next from r into @loclogin, @rmtlogin
end
close r
deallocate r
End
Else --Linked server
Begin
If exists (select * from tempdb..sysobjects where name like '#tmpsrvoption%')
Begin
drop table #tmpsrvoption
End
Create Table #tmpsrvoption
srvoption varchar(30)
insert #tmpsrvoption
select v.name
from master.dbo.spt_values v, master.dbo.sysservers s
where srvid = @srvid
and (v.number & s.srvstatus)=v.number
and (v.number & isnull(@allsetopt,4063)) <> 0
and v.number not in (-1, isnull(@allsetopt,4063))
and v.type = 'A'
PRINT 'sp_addlinkedserver'
Print ' @server = '''+ @server + ''''
Print ', @srvproduct = ''' + @srvproduct + ''''
If @srvproduct <> 'SQL Server' --Cannot specify additional info for SQL Server Product
Begin
Print ', @provider = ''' + @provider + ''''
Print ', @datasrc = ''' + @datasrc + ''''
Print ', @location = ''' + @location + ''''
Print ', @provstr = ''' + @provstr + ''''
Print ', @catalog = ''' + @catalog + ''''
End
Print ' GO'
-- Set all servers options to false, then reset correct server options
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''rpc'','
Print ' @optvalue = ''false'''
Print ' GO'
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''rpc out'','
Print ' @optvalue = ''false'''
Print ' GO'
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''data access'','
Print ' @optvalue = ''false'''
Print ' GO'
declare s cursor for SELECT srvoption
from #tmpsrvoption
open s
fetch next from s into @srvoption
while (@@FETCH_STATUS<>-1)
begin
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = '''+ @srvoption + ''','
Print ' @optvalue = ''true'''
Print ' GO'
fetch next from s into @srvoption
End
close s
deallocate s
--Script linked server logins
If exists (select * from tempdb..sysobjects where name like '#tmplink%')
Begin
drop table #tmplink
End
create table #tmplink
rmtserver sysname,
loclogin sysname null,
selfstatus smallint,
rmtlogin sysname null
insert #tmplink
exec ('sp_helplinkedsrvlogin '''+ @server + '''')
declare ll cursor for
select loclogin, selfstatus, rmtlogin from #tmplink order by rmtlogin
open ll
fetch next from ll into @loclogin, @selfstatus, @rmtlogin
while (@@FETCH_STATUS<>-1)
begin
-- Use self no remote user/password
If (@selfstatus = 1 and @loclogin is null)
Begin
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''true'''
Print ' GO'
End
Else
If (@selfstatus = 1 and @loclogin is not null) Begin
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''true'','
Print ' @locallogin = '''+ @loclogin + ''','
Print ' @rmtuser = NULL,'
Print ' @rmtpassword = NULL'
Print ' GO'
End
Else
If (@selfstatus = 0 and @rmtlogin is null) Begin
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''false'','
Print ' @locallogin = NULL,'
Print ' @rmtuser = NULL,'
Print ' @rmtpassword = NULL'
Print ' GO'
End
Else
If (@selfstatus = 0) Begin -- Check for Use self mappings
exec ('declare pwd cursor for
select l.password from master..sysservers s
join master..sysxlogins l on s.srvid = l.srvid --where l.sid is not null
where s.srvname = '''+ @server + ''' and l.name = '''+ @rmtlogin + '''')
-- Decrypt passwords
-- Only works for 7.0 server
-- Encrypt algorithm changed in 2000
open pwd
fetch next from pwd into @rmtpass
while @@fetch_status = 0
begin
set @i = 0
set @pwdtext = N''
while @i < datalength(@rmtpass)
begin
set @tmp = encrypt(@pwdtext + nchar(0))
set @lsb = convert(tinyint, substring(@tmp, @i + 1, 1))
^ convert(tinyint, substring(@rmtpass, @i + 1, 1))
set @i = @i + 1
set @tmp = encrypt(@pwdtext + nchar(@lsb))
set @msb = convert(tinyint, substring(@tmp, @i + 1, 1))
^ convert(tinyint, substring(@rmtpass, @i + 1, 1))
set @i = @i + 1
set @pwdtext = @pwdtext + nchar(convert(smallint, @lsb)
+ 256 * convert(smallint, @msb))
end
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''false'','
If (@loclogin is null)
Begin
Print ' @locallogin = NULL,'
End
Else
Begin
Print ' @locallogin = '''+ @loclogin + ''','
End
If (@rmtlogin is null)
Begin
Print ' @rmtuser = NULL,'
End
Else
Begin
Print ' @rmtuser = '''+ @rmtlogin + ''','
End
If (@pwdtext is null)
Begin
Print ' @rmtpassword = NULL'
End
Else
Begin
print ' @rmtpassword = '''+ @pwdtext + ''''
End
Print ' GO'
fetch next from pwd into @rmtpass
end
close pwd
deallocate pwd
End
fetch next from ll into @loclogin, @selfstatus, @rmtlogin
End
close ll
deallocate ll
End
If @netname <> @server -- If the srvnetname.sysservers is different from srvname.sysservers
Begin
Print 'sp_setnetname'
Print ' @server = '''+ @server + ''','
Print ' @network_name = '''+ @netname + ''''
End
fetch next from d into @srvid,@status, @server, @srvproduct, @provider, @datasrc,
@location, @provstr, @catalog, @netname
End
close d
deallocate d
Reference:
http://www.sqlservercentral.com/scripts/Miscellaneous/30620/
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support
Maybe you are looking for
-
Memory upgrade on a 3.33GHz C2D late 2009 27" iMac
Hi, I was pretty much ready to buy a 8GB memory kit for my late 2009 27" iMac (KTA-MB1066K2/8G), and now I read on wikipedia that optionally some of the C2D 3.33GHz iMacs had a bus speed of 1333MHz, rather than a 1066MHz. I just checked on mine under
-
Cash discount amount field in MIRO and FI document
Hi , In MIRO we are overwriting the cash discount amount but for some reason in the FI document instead of the overwritten cash discount amount SAP is taking the payment term and calculating the discount. Any solutions to correct this? Thanks
-
How to end my Adobe account?
I would like to end my Adobe account but I don't know how.
-
Agilent 53131A LabWindows/CVI device driver showing timeout error
Hi All, I have developed TestStand sequences for Measurements using Agilent 53131A frequency counter instrument. I have developed 2 sequences one using CVI drivers and the other using LabVIEW drivers. The functionality of the sequence is as follows 1
-
What does a number in upper righthand corner of FaceTime icon mean?
Since yesterday there is a number 1 in the upper right-hand corner of the FaceTime icon on my iPad (iOS 7.0.2 - doesn't seem to be available in "my products"). I suspect that this is related to an attempted FaceTime call which didn't get through to m