Surpress Dialog in Script
Hello everybody,
I have a little issue with photoshop cs scripting.
I generated a script with scriptlistener and costumized it for my needs (arguments). When I'm running the script (it does a conditional mode change) everthing works fine but at the end of the conversion a dialog pops up and says something like (sorry I have to translate from german)
The title of the window: Grayscale (Graustufen)
Label: Scale (Größenverhältnis)
a textbox and a OK button.
How to surpress this dialog?
It occous when I convert mode:bitmap to mode:rgb
I attached my script.
Thanks in advandce.
Best regards
Moritz
I didn't include the conversion to grayscale. when im converting manually it works fine but the windows comes up. I'll try to convert to grayscale first and then to rgb and post the results here.
Hum, because my script is not yet available i'll post the relevant parts here. I hope this is ok.
var mstrpath = arguments[0];
// =======================================================
var id5 = charIDToTypeID( "Opn " );
var desc2 = new ActionDescriptor();
var id6 = charIDToTypeID( "null" );
desc2.putPath( id6, new File( mstrpath ) );
executeAction( id5, desc2, DialogModes.NO );
// =======================================================
var id7 = stringIDToTypeID( "8cba8cd6-cb66-11d1-bc43-0060b0a13dc4" );
var desc3 = new ActionDescriptor();
var id8 = charIDToTypeID( "SrcM" );
var list1 = new ActionList();
var id9 = charIDToTypeID( "Cndn" );
var id10 = charIDToTypeID( "UBtm" );
list1.putEnumerated( id9, id10 );
var id11 = charIDToTypeID( "Cndn" );
var id12 = charIDToTypeID( "UGry" );
list1.putEnumerated( id11, id12 );
var id13 = charIDToTypeID( "Cndn" );
var id14 = charIDToTypeID( "UDtn" );
list1.putEnumerated( id13, id14 );
var id15 = charIDToTypeID( "Cndn" );
var id16 = charIDToTypeID( "UInd" );
list1.putEnumerated( id15, id16 );
var id17 = charIDToTypeID( "Cndn" );
var id18 = charIDToTypeID( "URGB" );
list1.putEnumerated( id17, id18 );
var id19 = charIDToTypeID( "Cndn" );
var id20 = charIDToTypeID( "UCMY" );
list1.putEnumerated( id19, id20 );
var id21 = charIDToTypeID( "Cndn" );
var id22 = charIDToTypeID( "ULab" );
list1.putEnumerated( id21, id22 );
var id23 = charIDToTypeID( "Cndn" );
var id24 = charIDToTypeID( "UMlt" );
list1.putEnumerated( id23, id24 );
desc3.putList( id8, list1 );
var id25 = charIDToTypeID( "DstM" );
var desc4 = new ActionDescriptor();
var id26 = charIDToTypeID( "RGBM" );
desc3.putObject( id25, id26, desc4 );
executeAction( id7, desc3, DialogModes.NO );
// =======================================================
var id27 = charIDToTypeID( "save" );
executeAction( id27, undefined, DialogModes.NO );
// =======================================================
var id28 = charIDToTypeID( "Cls " );
executeAction( id28, undefined, DialogModes.NO );
Similar Messages
-
How to prompt user to select multiple files in file dialog using scripts
Hi, is there a way to allow user to select multiple files inside the file dialog using scripts? So not just something like "*.ai" or "*.eps" but where the user can actually use their shift key to select a batch of files inside the file dialog and then the script would process each one.
Thanks!// Main Code [Execution of script begins here]
here's what I have so far. it would also be nice to not have illustrator stop at errors.. right now, it skips dialogs but on errors, it still stops.
// uncomment to suppress Illustrator warning dialogs
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pdfSaveOpts, folderName;
var fullPath = "";
var finalSlash;
// Select the source folder.
sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator .ai files you want to convert to PDF');
f = find_files(sourceFolder);
function find_files (dir)
return find_files_sub (dir, []);
function find_files_sub (dir, array)
var f = Folder (dir).getFiles ("*.*");
for (var i = 0; i < f.length; i++)
if (f[i] instanceof Folder)
find_files_sub (f[i], array);
else
if (f[i].name.slice (-3).toLowerCase() == ".ai" || f[i].name.slice (-4).toLowerCase() == ".eps")
//convert the array-listing to a string so we can manipulate it
fullPath = String(f[i]);
//find the position of the last / to indicate where the filename starts
finalSlash = fullPath.lastIndexOf("/");
//get the foldername by "slicing" from start to where finalSlash is located
folderName = fullPath.slice(0, finalSlash).toLowerCase();
sourceDoc = app.open(f[i]); // returns the document object
// Call function getNewName to get the name and file to save the pdf
targetFile_PNG = getNewName(".png");
if(targetFile_PNG.exists) {
} else {
pngExportOpts = getPNGOptions();
sourceDoc.exportFile(targetFile_PNG, ExportType.PNG24, pngExportOpts );
targetFile_PDF = getNewName(".pdf");
pdfSaveOpts = getPDFOptions();
sourceDoc.saveAs(targetFile_PDF, pdfSaveOpts );
targetFile_SVG = getNewName(".svg");
svgSaveOpts = getSVGOptions();
sourceDoc.exportFile(targetFile_SVG, ExportType.SVG, svgSaveOpts );
sourceDoc.close();
array.push (f[i]);
getNewName: Function to get the new file name. The primary
name is the same as the source file.
function getNewName(ext)
var ext, docName, newName, saveInFile, docName, finalDot
var loop = 0;
docName = sourceDoc.name;
ext = ext; // new extension for pdf file
newName = "";
finalDot = sourceDoc.name.lastIndexOf(".");
while(loop < finalDot)
newName += docName[loop];
loop = loop + 1;
newName += ext; // full pdf name of the file
newName = newName.replace(" [Converted]","");
// Create a file object to save the pdf
saveInFile = new File( folderName + '/' + newName );
return saveInFile;
getPDFOptions: Function to set the PDF saving options of the
files using the PDFSaveOptions object.
function getPDFOptions()
// Create the PDFSaveOptions object to set the PDF options
var pdfSaveOpts = new PDFSaveOptions();
// Setting PDFSaveOptions properties. Please see the JavaScript Reference
// for a description of these properties.
// Add more properties here if you like
pdfSaveOpts.acrobatLayers = false;
pdfSaveOpts.colorBars = false;
pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;
pdfSaveOpts.compressArt = true; //default
pdfSaveOpts.embedICCProfile = false;
pdfSaveOpts.enablePlainText = false;
pdfSaveOpts.generateThumbnails = false; // default
pdfSaveOpts.optimization = true;
pdfSaveOpts.pageInformation = false;
pdfSaveOpts.preserveEditability = true;
return pdfSaveOpts;
function getSVGOptions()
var svgSaveOpts = new ExportOptionsSVG();
//just using defaults aside from what's written below
//see http://cssdk.host.adobe.com/sdk/1.0/docs/WebHelp/references/csawlib/com/adobe/illustrator/ ExportOptionsSVG.html
svgSaveOpts.embedRasterImages = true;
svgSaveOpts.sVGTextOnPath = true;
return svgSaveOpts;
function getPNGOptions()
// Create the PDFSaveOptions object to set the PDF options
var pngExportOpts = new ExportOptionsPNG24();
// Setting PNGExportOptions properties. Please see the JavaScript Reference
// for a description of these properties.
// Add more properties here if you like
pngExportOpts.antiAliasing = true;
pngExportOpts.artBoardClipping = false;
pngExportOpts.horizontalScale = 100; // scaling to 350%
pngExportOpts.saveAsHTML = false;
pngExportOpts.transparency = true;
pngExportOpts.verticalScale = 100; // scaling to 350%
return pngExportOpts; -
Open "Attach file" dialog by scripting
Hi,
Is it posible to open the "Attach file dialog" by scripting?
Thanks in advance, OliverHello,
It is possible by using Acrobat scripting API.
You can do it by the following code:
event.target.importDataObject("name"); -
Can I suppress dialog outside script?
I have a start up script that is used in cross-plattform production. It fixes the links of pictures. Works fine but the user still gets the warning message before the script does its work. If the document is opened by script I can suppress the dialog but I did not find a way for the regular InDesign Open action.
Is it possible by script?
(I think it was the case in the old days that setting userinteraction level to neverinteract would get rid of all dialogs but this seems to be no longer the case.)
Any idea?
Thank you,
RalfOkay, sometimes it is a good idea to simply ask a non-scripting guy. One can just turn off the dialog in the InDesign preferences.
I am sure you all knew that.
Ralf -
Hello,
I use java script to create a document and I want to choose how and where it should be saved.
var docName = File.saveDialog ('Save', 'Adobe InDesign publications:*.indd');
If I try to run this code in ExtendScript toolkit without choosing my configuration then dialog will open, but if I try to run it under server this dialog will be skipped and docName = null
Could anyone help me how to solve it?
Thank you in advanceIf you are running Server as a desktop app, I'm not sure why you are using Server at all. You should be using the Desktop version.
That said, there's plenty of ways to go about it. The simplest is probably to use VB or Applescript.
Also, this is not the best forum for this question.
Try here:
http://forums.adobe.com/community/indesign/indesign_server_developers
or here:
http://forums.adobe.com/community/indesign/indesign_scripting
Harbs -
Button launch shutdown/reset/logout dialog box script
Remember when you had a button that would ask you if you wanted to shutdown/reset/logout? Wouldn't it be nice to have it back?
Is there a script where I could assign a Function key to bring up that dialog box?Just press the Control and Eject keys at the same time. Voila!
-
Print without dialog box, scripting php
I have build a php based application that has a printing requirement.
I would like the user to be able to print a simple html file to a network printer without seeing a dialog box.
the JS window.print() shows the user a dialog box. I would prefer the user bypass this dialog and just print some output generated by a php script.
this is probably the wrong forum to post this, but i didn't see much activity elsewhere and i figureds some type of unix command line print function might be the solution.
any thoughts?You will have to use a tool like swfstudio
or zinc to achieve this.
Flash itself can`t (and shouldn`t) override the systemwide settings . -
Datenüberg​abe Dialog - Script nicht mgl?
Hallo,
habe mir für die Übergabe eine Variable in MyVar.vas erstellt.
MyVekt_ : F [200](50)
Sie soll max. 200 Pfadangaben a max. 50 Zeichen aufnehmen.
Im Sud-Edit habe ich die Variable als Vektor Freier Text MyVekt_ eingebunden. Sie wurde anstandslos neu ermittelt.
Im Dialogedit belege ich sie mit den Zeilen einer Liste
For i = 2 To x
MyVekt_(i-1) = ListBox1.Items(1).Text + ltrim(ListBox1.Items(i).Text)
Next
Im DIAdem Script binde ich die Variable ein
Call UserVarCompile("D:\National Instruments\DIAdem 11.1\script\MyVar.vas")
lade den Dialog
Call SudDefLoad(Dateipfad & "\" & dialog)Call SUDDlgShow("StartDialog")
und versuche eine Datei zu öffene
Call DataFileImport(MyVekt_(1),"csv", 0)
Es erscheint die Fehlermeldung
Dialogeditor (SUD)
Die Variable(n) konnte nicht mit dem Dialog verbunden werden:
MyVekt_ : Sie haben diese Variable mit einem falschen Typ spezifiziert. Der richtige Typ wäre: Variant
Was natürlich nicht stimmen kann, denn Anwendervariablen kann man NICHT als Variant in der vas deklarieren!?
Weiß jemand Hilfe, wie ich Dialog und Script über diesen Vektor verbinden kann?
Gruß TraderhansHallo,
nun habe ich nach Rechere in der Hilfe einen Weg ohne vas und GlobalDim gefunden.
DD:
Option Explicit Dim i, oArray
Redim oArray(300) 'Vektor mit 300 Elementen anmelden const dialog = "CVSload.SUD"const Dateipfad = "D:\National Instruments\DIAdem 11.1\script\" Call SUDDlgShow("StartDialog",Dateipfad & "\" & dialog,oArray) 'Vektor an SUD übergeben Call DataFileImport(oArray(1),"csv", 0)
SUD:
Sub Dialog_EventInitialize()
Dim This : Set This = Dialog
Dim oDlgParams
oDlgParams = Dialog.GetArgument() 'oArray von DIAdem übernehmen
Sub Button1_EventClick()
Dim This : Set This = Button1
Dim x, i
x = ListBox1.Items.Count
Redim oDlgParams(x) ' an Listenlänge anpassen
For i = 2 To x
oDlgParams(i-1) = ListBox1.Items(1).Text + ltrim(ListBox1.Items(i).Text) 'Liste schreiben in oArray
Next
Dialog.SetArgument(oDlgParams) 'an DIAdem übergeben
End Sub
Funktioniert prima!
Gruß Bernard -
ScriptUI run script from dialog button
Here is what I have right now. It is a little clunky in the way it works, and I would just like to make it a bit slicker.
I have a script on startup that creates a Menu item with a dropdown submenu item. when you click on the submenu item, it starts a script.
The first thing the script does is pop up a message box that tells them that two dialog boxes are going to popup. The first one asking them to choose the location of an xml file and the second dialog box that ask them to choose the location of their image folder. After they finish choosing their folder in the second dialog, the script takes those two values, makes them variables, and continues to run the rest of the script.
Here is what I would like it to do..
1. open a dialog window with two input fields, two "browse" buttons, and OK and CANCEL buttons
2. when you click the first browse button next to the first input field, it will open a file dialog window. You select your file and the file string will populate the input field
3. when you click the second button next to the second input field, it opens a folder dialog window. You select the folder and the string populates the second input field.
4. when you click OK, it feeds the values in the input fields to a script.
I already have scripts to that open the file and folder dialogs, but what I can't figure out how to do is to start and run a script from a button press, in this case, when the OK button is pressed. It is probably an onClick, but I haven't been able to find any examples of what the syntax would be.
The closest I have found is in the Beginning ScriptUI document that was on Jongware's site, in the section on Communication between windows. But that opens each of the windows with a different script and not using a button press to call a script.
As always, any point in the right direction is very much appreciated. thanks.Thanks Gotterman, but the issue I was having was that the dialogs I was opening were not being created by me. They were more like OS generated windows. So I am not able to give the window a name, or the input field a name in order to reference it.
Peters response was actually correct, although I did have to open the folder dialog a bit differently to get it to work. I had to use a style that I got from Jongware in a previous thread, but the concept that Peter showed in the last post pointed me in the right direction.
I just have one more piece to figure out, how I am going to pass the variables to another script, but I think that is something i will have to work out on my own.
For anyone who is curious, here is the code I came up, modifying and combining some of Peters examples from the book plus the help he gave me in this thread. The alert after closing the dialog is just for testing to show that the values are being held by the variables so I can use them else where.
function mySnippet(){
//<fragment>
#target indesign;
#targetengine "session";
var w2 = new Window("palette", "Window 2", undefined, {resizeable: true});
var e2 = w2.add ("edittext"); e2.characters = 30;
var e3 = w2.add ("edittext"); e3.characters = 30;
var f2 = w2.add ("button", undefined,"Browse XML");
var f3 = w2.add ("button", undefined,"Browse Folder");
var f4 = w2.add ("button",undefined,"SAVE AND RUN");
var tf
var tfo
f2.onClick = function() {
tf = File.openDialog("Select your XML File","*.xml");
if (tf != null)
e2.text = tf;
f3.onClick = function() {
var tfol = new Folder("~/My Documents")
tfo = tfol.selectDlg("Get Folder");
if (tfo != null)
e3.text = tfo;
f4.onClick = function()
w2.close();
alert ("xml value: " + tf + "\nfolder value: " + tfo);
w2.show();
//</fragment> -
Open/Save Dialog Box Freeze
Hello,
Since updating to 10.4.7, the open/save dialog box freezes (beachball) after selecting a folder. Can anyone please point me in the right direction in solving my issue.
I used the ComboPPC updater and then ran Cocktail to repair permissions, cron scripts, clear caches etc.
I recently posted about the Finder freezing instead I should have mentioned that it was the Open/Save dialog box.
Regards,
DavidHi,
I am using model dialog box.
on page header i have copy The code as given in this http://jqueryui.com/dialog/#modal-message link
// page header code
<!doctype html> <html lang="en"><head> <meta charset="utf-8" /> <title>jQuery UI Dialog - Modal message</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(function() { $( "#dialog-message" ).dialog({ modal: true, buttons: { Ok: function() { $( this ).dialog( "close" ); } } }); }); </script></head><body> <div id="dialog-message" title="Download complete"> <p> <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span> Your files have downloaded successfully into the My Downloads folder. </p> <p> Currently using <b>36% of your storage space</b>. </p></div> <p>Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p> </body></html> My Button name is "DOWNLOAD" and on button actions "REDIRECT TO URL"
on URL TARGET value is ==javascript: myFunction();
where i have to write this code to bind my apex buttons with dialog box.
apex.submit(myRequest);the steps i have written above, am doing right or not? Please help to place the code in apex with a right way.
Thanks & Regards
Vedant
Edited by: Vedant on Jan 28, 2013 12:53 AM -
Item not being saved when item is in a jquery modal dialog
Hi all,
I followed instructions found here :
http://shijesh.wordpress.com/2010/04/10/jquery-modal-form-in-apex-4/
to create a jquery modal dialog, this is the code I added in html header :
<link rel="stylesheet" href = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/
redmond/jquery-ui.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"> </script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"> </script>
<script type="text/javascript">
$( function() {
$('#ModalForm').dialog(
modal : true ,
autoOpen : false ,
width : 425,
closeText : 'Close',
stack : false,
resizable : false,
buttons : {
Cancel : function() {
closeForm();
Save : function() {
updateMEMOVELD();
function openForm()
$('#ModalForm').dialog('open');
function closeForm()
//$('#ModalForm input[type="textarea"]').val('');
$('#ModalForm').dialog('close');
function updateMEMOVELD ()
var get = new htmldb_Get(null, &APP_ID.,
'APPLICATION_PROCESS=f_memo', 0);
get.add('P9_MEMOVELD',$v('P9_MEMOVELD'));
var gReturn= get.get();
//alert(gReturn);
//alert($v('P9_DATUM'));
$s('P9_MEMOVELD',gReturn);
alert($v('P9_MEMOVELD'));
$s('P9_MEMOVELD_COPY',$v('P9_MEMOVELD'));
$('#ModalForm').dialog('close');
</script>my situation is a little different, my modal does not have to perform an sql update, just change a field
the user will then save in the main form
for some reason the field never gets updated in the db
I even created a on demand application process called f_memo :
BEGIN
APEX_UTIL.SET_SESSION_STATE('P9_MEMOVELD',:P9_MEMOVELD);
htp.p(:P9_MEMOVELD);
END;why is my field not send to the db ?
it works when I delete this from the region header :
< d i v id="ModalForm" title="Add Person" style=" d isplay:n one " >but then of course I no longer have a modal dialog
what's wrong ?
I put the code online at apex.oracle.com
workspace XONIXRS
login/password demo/demorun the application
click on lijst facturen (invoices) (in the right sidebar region)
then click on the zoeken (search) button
a report appears, click on edit on the first line (200900017)
now a form appears, click on the outright button memo
now the modal shows up, change the field and click on save
click on ok (for the alert) and then click on Save invoice
you will remain on the same page
now click on annuleren
and then click on edit on the first line (200900017) again
then click on memo again, you will see the memo has not been changed
how comes ?
Kr
MartinThe issue is that creating a modal of a region lifts that region from the HTML. Just have a look at the DOM when you run your page and not the source html, because that does not reflect changes to the dom made on page load. This means that your memo-field is removed from the FORM-tags, and effectively won't submit to session state. The item is not processed when you submit the page! You can track that through debugging your page. Memo is not saved and not processed.
Trying to save the value to session state is not enough, it doesn't really matter in this case. The moment you submit the page, the session state will get overwritten by the submitted values of the items.
So what i did:
<ul>
<li>move P9_MEMOVELD to region FACTUUR, together with all the other db fields</li>
<li>change the type to hidden</li>
<li>set value protected to NO</li>
<li>in the modal region create a new page item P9_MEMOVELD_POP, type textfield</li>
<li>set the source to always use a page item as source, with source P9_MEMOVELD</li>
<li>changed function updatememoveld:
function updateMEMOVELD ()
var get = new htmldb_Get(null, &APP_ID.,
'APPLICATION_PROCESS=f_memo', 0);
get.add('P9_MEMOVELD',$v('P9_MEMOVELD'));
var gReturn= get.get();
//alert(gReturn);
//alert($v('P9_DATUM'));
$s('P9_MEMOVELD',gReturn);
alert($v('P9_MEMOVELD'));
$s('P9_MEMOVELD_COPY',$v('P9_MEMOVELD'));
$s('P9_MEMOVELD',$v('P9_MEMOVELD_POP'));
$('#ModalForm').dialog('close');
}Whether you want or need the session state set is up to you, it depends on if you use this somewhere else dynamically on the page and thus would influence results there, but i don't think it will (it's a memo field...)</li>
</ul>
Extra remarks:
<ul>
<li>be careful with including jquery libraries! The standard libraries are included, yet you add previous versions too! (1.4.2) This might lead to issues...</li>
<li>use your templates better. Why would you wrap a region in div tags? Change or add a region template to be div tags. You can then easily assign a static id to this region, and target it. This will save you from wrapping wrapped wrappers (cause that is what the generated code looks like in the end).</li>
</ul> -
IFrame in jQuery Dialog - submit iFrame using dialog button
Hi Everyone,
I know a lot of us are using JQuery modal dialog feature and some of us using iframe strategy to display form or page inside of modal dialog popup. Personally, I am using these features a lot in my app but there is a step where I am a bit stuck.
Here is my situation ( I am sure most of us will be interested in this to be resolved if not yet):
I have a regular page (will call it parent page), on this page I have a button and by clicking on this button I am getting a jquery modal window popup. The button itself is pointed to url: javascript:LinkAssets(); and the script to call modal popup with iFrame in HTML Header of parent page is:
<script type="text/javascript">
// Link Assets - Modal PopUp
function LinkAssets(){
var apexSession = $v('pInstance');
var apexAppId = $v('pFlowId');
var assetNumber = $v('P17_ORDER_ID');
$(function(){vRuleBox = '<div id="LinkAssetsBox" title="Link Assets to the Order">
<iframe src="f?p='+apexAppId+':55:'+apexSession+'::NO:55:P55_ORDER_NUMBER:'+assetNumber+'"
width="680" height="320" title="Link Assets to the Order" frameborder="no">
</iframe>
</div>'
$(document.body).append(vRuleBox);
$("#LinkAssetsBox").dialog({buttons:{"Close":function(){$(this).dialog("close");}},
stack:true,
modal:true,
width:700,
height:340,
resizable:true,
autoResize:true,
draggable:true,
close: function(){$("#LinkAssetsBox").remove();
location.reload(true);}
</script> As you see I am calling page 55 from jquery script into iFarme which will be displayed in modal dialog. All described above is working fine, no problems and most of us use it.
My problem is here: my JQuery modal dialog has a "CLOSE" button which allows me to close a modal dialog without any changes and go back to my parent page - which is normal behavior. In my iFarme page (page 55) i have an "apply changes" button, and this button calls a process on page 55 by submitting a value and than it closes the modal dialog. "APPLY Changes" button has pointed to the url: javascript:UpdateRecord(); and page 55 has a script in HTML Header to submit value and close modal dialog:
<script type="text/javascript">
// -- Function to apply changes and close Modal Dialog--
function closePopup(){
$(function(){parent.$('*').dialog('close');});}
function UpdateRecord(){doSubmit('APPLY_CHANGES');closePopup();}
</script> So, what I want is not to have this "Apply Changes" button in my page 55 which is iFrame page, I want this button to be next to my jQuery modal dialog "CLOSE" button which means I have to change my modal dialog popup script to include "APPLY CHANGES" button where this button will submit value to iFrame page and close my dialog.
I hope whatever is above is readable and understandable.
Thankssince my previous solution didn't work I did try another way. I did try to create a hidden item in my iFrame page -> pass a values "APPLY_CHANGES" to this item from my "ADD" button in parent dialog window and make my DML process in my iFrame (page 55) to fire conditionally when hidden item in iFrame page has "APPLY_CHANGES" value. So, I did change my dialog window script with iframe again to include this:
$(document.body).append(vRuleBox);
$("#LinkAssetsBox").dialog({
buttons:{"Close":function(){$(this).dialog("close");}
//from here ---------------
,Add:function(){location.href="f?p=&APP_ID.:55:&SESSION.::NO:55:P55_CREATE_REQUEST:APPLY_CHANGES"}
//to here -----------------
}, stack: true,
modal: true,
width: 950,
...and again....it passes the "APPLY_CHANGES" value to my iFrame page item ( i can see that in session view) but my process is not running or may be it is not getting values of my form items in iFrame page.
Any ideas...comments on this??? -
How to make a dialog box for a user to choose a file from disk
Hi there
Is it possible to make a dialog box, for a photoshop user, to choose a txt file, to be process by my javascript ?
I have a txt file with all the names and locations of psd files i want to process by photoshop. I have ex. 100 out of a folder with 250 images.
If anyone have a shot "code sample" how to select a file - i will be happy.
/THere is an example of selecting a text file...
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,500,220],"+
"testFile:EditText{bounds:[10,40,310,60] , text:'' ,properties:{multiline:false,noecho:false,readonly:false}},"+
"Browse:Button{bounds:[320,40,390,61] , text:'<<' },"+
"statictext0:StaticText{bounds:[10,10,240,27] , text:'Please select Text File' ,properties:{scrolling:undefined,multiline:undefined}},"+
"Process:Button{bounds:[10,80,190,101] , text:'Process' },"+
"button2:Button{bounds:[210,80,390,101] , text:'Cancel' }};"
var win = new Window(dlg,'test');
win.center();
win.testFile.enabled=false;
win.Browse.onClick = function() {
selectedFile = File.openDialog("Please select TEXT file.","TEXT File:*.txt");
if(selectedFile != null) win.testFile.text = decodeURI(selectedFile.fsName);
win.Process.onClick = function() {
if(win.testFile.text == '') {
alert("No text file has been selected!");
return;
win.close(1);
selectedFile.execute();
win.show(); -
Apple Script to Sort through the Address Book
Dear All,
I am quite new to Apple and just a learner on Apple-scripts. Its been quite a task to learn.. I would require some help on a few things..
The script will eventually use numbers to send email and get the user inputs and any yet to reach there..
After going through lots of scripts to sort through the address book and make a clean address book, i found they are quite slow in processing takes about 20~30 Minutes to get through 2000 Contacts..
Hence after reading posting of Mr. Koenig & Mr. Hiroto and specifically on deep copy. I have written the following code which does the following on 2000 records within 6~8Mins.
The Script work its way through all the contact is the address List.. and creates Groups
1. Duplicate Email Id's — List of Contacts with same email ID's including Contacts where the email Id is entered twice.. (Strange.. Address Book Issue, copy of the email Id under work & home)
2. Duplicate Phone — List of Contacts with same Phone Numbers including Contacts where the Phone Nos is entered twice.
3. Duplicate Name — List of Contacts with Same Names
4. Duplicate No Name — List of Contacts without the First Name and Last Name
it also sort the Contacts under the following Group which you can edit later with all the information's..
1. Only Email Ids — List of Contacts with Email ID and No Phone Numbers
2. Only Phone — List of Contacts with Phone Numbers and No Email Id's
3. No Email or Phone — List of Contacts with No Email Id's and No Phone numbers (some half completed contacts )
My Question to the forum is why is the following code still taking too much time..
set onlyDupEList to every person of group theGroupEmail
repeat with j from 1 to count of Dup_email
set tempdata to item j of Dup_email
if onlyDupEList does not contain {tempdata} then add tempdata to group theGroupEmail
end repeat
save application "Address Book"
and the scripts slows down when the items in the list is quite large (over 800 or so )..
Any help is appreciated and thanks in advance..
-- the code ---
global MsgTitle
on run
set MsgTitle to "Search for Duplicates in Address Book Contacts"
display dialog ¬
"This Script takes a while to finish" & return & "maybe 10 min or More..." & return & "Depending on the Address Book Contacts." & return & return & "Hence Allow it to run for the while" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
set question to display dialog "Select the Duplicate Search Parameter " with icon 1 with title MsgTitle ¬
buttons {"Contact Name", "Contacts on Phone & Email Id's", "Quit"} default button 3
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
if rtnValue is "Contact Name" then
-- tell application "Address Book" to quit
GetDup_byName("Duplicate Name")
end if
if rtnValue is "Contacts on Phone & Email Id's" then --Contacts on Phone & Email Id's
-- tell application "Address Book" to quit
Get_dup()
end if
end run
--- Search on Name Field ---
on GetDup_byName(theGroupName)
set question to display dialog "Do you want to search for duplicates based on Names? " with icon 0 with title MsgTitle ¬
buttons {"Continue", "Quit"} default button 1
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
tell application "Address Book"
activate
set biglist to {}
set NoNameList to {}
set theGroupNoName to "Duplicates No Names"
set theGroup to theGroupName
-- if not (exists (group "Dupilicate Entries")) then
if not (exists (group theGroup)) then
make new group with properties {name:theGroup}
save
end if
if not (exists (group theGroupNoName)) then
make new group with properties {name:theGroupNoName}
save
end if
set the_names to name of people
repeat with i from 1 to number of items in the_names
set theName to item i of the_names
-- return theName
if theName is not in biglist then
copy theName to end of biglist
else
set counter to (people whose name is theName)
if (count of counter) > 1 then
repeat with i from 1 to number of items in counter
set this_item to item i of counter
-- display dialog this_item
add this_item to group theGroup
end repeat
-- return counter as string
end if
end if
-- captures the Contacts without Name ---
if theName contains "@" then
-- display dialog theName
set counterList to (people whose name is theName)
repeat with i from 1 to number of items in counterList
set this_item to item i of counterList
-- display dialog this_item
add this_item to group theGroupNoName
end repeat
end if
-- save application "Address Book"
end repeat
save application "Address Book"
set peopleCount to (count every person)
-- set peopleCount to 50 -- only for testing --
repeat with i from 1 to peopleCount
set first_name to first name of person i as string
set Last_Name to last name of person i as string
if first_name is equal to "missing value" and Last_Name is equal to "missing value" then
-- display dialog first_name & " : " & Last_Name
set end of NoNameList to (id of person i)
end if
end repeat
repeat with j from 1 to the count of NoNameList
set tempdata to item j of NoNameList
-- set testdata to person id tempdata
-- if (name of groups of testdata does not contain theGroupNoEmail) then
add tempdata to group theGroupNoName
-- end if
end repeat
save application "Address Book"*)
display dialog ¬
"This Script Finished Processing Address Book Contacts the Duplicates are in the group" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
end tell
end GetDup_byName
on Get_dup()
set question to display dialog "Do you want to search for duplicates based on Names? " with icon 0 with title MsgTitle ¬
buttons {"Continue", "Quit"} default button 1
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
tell application "Address Book"
activate
set theGroupEmail to "Duplicate Email Id's"
set theGroupPhone to "Duplicate Phone"
set theGroupNoEmail to "Only Phone Numbers"
set thegroupNoPhone to "Only Email Id's"
set theGroupNoData to "No Email or Phone"
-- set theGroup to theGroupName
if not (exists (group theGroupEmail)) then
make new group with properties {name:theGroupEmail}
save "Address Book"
end if
if not (exists (group theGroupPhone)) then
make new group with properties {name:theGroupPhone}
save "Address Book"
end if
if not (exists (group theGroupNoEmail)) then
make new group with properties {name:theGroupNoEmail}
save "Address Book"
end if
if not (exists (group thegroupNoPhone)) then
make new group with properties {name:thegroupNoPhone}
save "Address Book"
end if
if not (exists (group theGroupNoData)) then
make new group with properties {name:theGroupNoData}
save "Address Book"
end if
set ListofPeople to people --the_ID
set ListofEmailID to value of emails of people --the_emails
-- return ListofEmailID
set ListofPhones to value of phone of people -- the_phones
-- return ListofPhones
set biglist to {}
set ListEmail_Uniq to {}
set ListEmail_Dup to {}
set No_PhoneList to {}
set No_EmailList to {}
set No_dataList to {}
set FlagEmail to false
set FlagPhone to false
-- repeat with i from 1 to number of items in the_emails
repeat with i from 1 to count of ListofEmailID
set thePersonID to item i of ListofPeople
set theEmails to item i of ListofEmailID
if theEmails is equal to {} then
set end of No_EmailList to thePersonID
else
-- set FlagEmail to true
repeat with j from 1 to count of theEmails
set tmpdata to item j of theEmails
-- return tmpdata
if tmpdata is not in biglist then
set end of biglist to tmpdata
set end of ListEmail_Uniq to {tmpdata} & {thePersonID}
else
set end of ListEmail_Dup to {tmpdata} & {thePersonID}
end if
end repeat
end if
end repeat
-- return ListEmail_Uniq
-- return ListEmail_Dup
-- save application "Address Book"
set biglist to {}
set ListPhone_Uniq to {}
set ListPhone_Dup to {}
-- repeat with i from 1 to number of items in the_emails
repeat with i from 1 to count of ListofPhones
set thePersonID to item i of ListofPeople
set thePhones to item i of ListofPhones
if thePhones is equal to {} then
set end of No_PhoneList to thePersonID
else
-- set FlagPhone to true
repeat with j from 1 to count of thePhones
set tmpdata to item j of thePhones
-- return tmpdata
if tmpdata is not in biglist then
set end of biglist to tmpdata
set end of ListPhone_Uniq to {tmpdata} & {thePersonID}
else
set end of ListPhone_Dup to {tmpdata} & {thePersonID}
end if
end repeat
end if
end repeat
-- return ListPhone_Uniq
-- return ListPhone_Dup
set the Dup_email to {}
-- Find the Duplicates from the sorted list --
repeat with i from 1 to the count of ListEmail_Dup
set tempdata to item i of ListEmail_Dup
set dataEmailDup to item 1 of tempdata
set dataPersonDup to item 2 of tempdata
repeat with j from 1 to the count of ListEmail_Uniq
set tempdata to item j of ListEmail_Uniq
set dataEmailUniq to item 1 of tempdata
set dataPersonUniq to item 2 of tempdata
-- display dialog mainEmail1 & "=" & mainEmail2 & " " & mainID1 & "=" & mainID2
if dataEmailDup is equal to dataEmailUniq then
set end of Dup_email to dataPersonDup -- & "," & dataPersonUniq
set end of Dup_email to dataPersonUniq
end if
(* -- the code takes lot more time if add to group was used --
if dataEmailDup is equal to dataEmailUniq then
set testdata to person id dataPersonDup
add testdata to group theGroup
set testdata to person id dataPersonUniq
add testdata to group theGroup
end if
end repeat
end repeat
-- return Dup_email
set the Dup_Phone to {}
-- Find the Duplicates from the sorted list --
repeat with i from 1 to the count of ListPhone_Dup
set tempdata to item i of ListPhone_Dup
set dataPhoneDup to item 1 of tempdata
set dataPersonDup to item 2 of tempdata
repeat with j from 1 to the count of ListPhone_Uniq
set tempdata to item j of ListPhone_Uniq
set dataPhoneUniq to item 1 of tempdata
set dataPersonUniq to item 2 of tempdata
-- display dialog mainEmail1 & "=" & mainEmail2 & " " & mainID1 & "=" & mainID2
if dataPhoneDup is equal to dataPhoneUniq then
set end of Dup_Phone to dataPersonDup -- & "," & dataPersonUniq
set end of Dup_Phone to dataPersonUniq
end if
(*if dataPhoneDup is equal to dataPhoneUniq then
set testdata to person id dataPersonDup
add testdata to group theGroup
set testdata to person id dataPersonUniq
add testdata to group theGroup
-- save
end if*)
end repeat
end repeat
-- return Dup_Phone
set onlyDupEList to every person of group theGroupEmail
repeat with j from 1 to count of Dup_email
set tempdata to item j of Dup_email
if onlyDupEList does not contain {tempdata} then add tempdata to group theGroupEmail
end repeat
save application "Address Book"
set onlyDupPList to every person of group theGroupPhone
repeat with j from 1 to count of Dup_Phone
set tempdata to item j of Dup_Phone
if onlyDupPList does not contain {tempdata} then add tempdata to group theGroupPhone
end repeat
save application "Address Book"
set onlyPhoneList to every person of group theGroupNoEmail
repeat with j from 1 to the count of No_EmailList
set tempdata1 to item j of No_EmailList
if No_PhoneList does not contain {tempdata1} then
if onlyPhoneList does not contain {tempdata1} then add tempdata1 to group theGroupNoEmail
end if
(*set flagE to false
repeat with i from 1 to the count of No_PhoneList
set tempdata2 to item i of No_PhoneList
if tempdata1 is equal to tempdata2 then
set flagE to true
exit repeat
end if
end repeat
if flagE is false then add tempdata1 to group theGroupNoEmail*)
end repeat
save application "Address Book"
set onlyEmailList to every person of group thegroupNoPhone
repeat with j from 1 to the count of No_PhoneList
set tempdata1 to item j of No_PhoneList
if No_EmailList does not contain {tempdata1} then
if onlyEmailList does not contain {tempdata1} then add tempdata1 to group thegroupNoPhone
end if
end repeat
save application "Address Book"
set onlyList to every person of group theGroupNoData
repeat with i from 1 to count of ListofPeople
if (item i of ListofEmailID is equal to {}) and (item i of ListofPhones is equal to {}) then
set tempdata to item i of ListofPeople
if onlyList does not contain {tempdata} then add tempdata to group theGroupNoData
end if
end repeat
save application "Address Book"
display dialog ¬
"This Script Finished Processing Address Book Contacts the Duplicates are in the group" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
end tell
end Get_dup
on quit
--set MsgTitle to "Change Email ID's Domain Name"
save application "Address Book"
display dialog "Contact Srikanth Kamath at [email protected] for any Help" with title MsgTitle with icon 1 buttons "OK"
continue quit
end quitHello Srikanth Kamath,
I'm not sure you're still following this thread, but anyway here's sample code I said I'd post later.
--SCRIPT2
main()
on main()
script o
-- input data
property xx : {1, 2, 3, 4, 5} -- list of parents
property yy : {{"g", "h"}, {"a", "b"}, {"b", "e", "f"}, {"e"}, {"c", "d"}} -- list of children per parent
-- work list
property pp : {} -- list of children tagged by parent; i.e, lits of {child, parent}
property qq : {}
property rr : {}
-- (1) build list of children tagged by parent
repeat with i from 1 to count my xx
set x to my xx's item i
set y to my yy's item i
repeat with p in y
set end of my pp to {p's contents, x}
end repeat
end repeat
--return pp -- {{"g", 1}, {"h", 1}, {"a", 2}, {"b", 2}, {"b", 3}, {"e", 3}, {"f", 3}, {"e", 4}, {"c", 5}, {"d", 5}}
-- (2) sort tagged list by child as key
msort(my by_key1, my pp)
--return pp -- {{"a", 2}, {"b", 2}, {"b", 3}, {"c", 5}, {"d", 5}, {"e", 3}, {"e", 4}, {"f", 3}, {"g", 1}, {"h", 1}}
-- (3) retrieve parents with duplicate child
(* retrieve list of {child, parent} for duplicate child *)
set my qq to uniq(my eq_key1, my pp, {_dup:true})
--return qq -- {{"b", 2}, {"b", 3}, {"e", 3}, {"e", 4}}
(* retrieve list of parent *)
repeat with q in my qq
set r to q's item 2
if r is not in my rr then set end of my rr to r
end repeat
return rr -- {2, 3, 4}
end script
tell o to run
end main
on by_key1(x, y)
msort's comparator for list of lists
key = item 1, ascending
returns true iff x and y are out of order
return x's item 1 > y's item 1
end by_key1
on eq_key1(x, y)
uniq's comparator for list of lists
key = item 1
returns true iff x and y are considered equal
return x's item 1 = y's item 1
end eq_key1
on msort(cmp_, aa) -- v1.2f2
Basic recursive merge sort handler having list sorted in place.
handler cmp_ : comparator
* cmp_(x, y) must return true iff list element x and y are out of order.
list aa : list to be sorted in place
script o
property parent : {} -- limit closure to minimum
property xx : aa -- to be sorted in place
property xxl : count my xx
property yy : {}
property cmp : cmp_
on merge(p, q, r)
property xx: source list
integer p, q, r : absolute indices to specify range to be merged such that
xx's items p thru r is the target range,
xx's items p thru (q-1) is the first sublist,
xx's items q thru r is the second sublist.
(p < q <= r)
local i, j, k, xp, xr, yi, yj, ix, jx
if r - p = 1 then
set xp to my xx's item p
set xr to my xx's item r
if my cmp(xp, xr) then
set my xx's item p to xr
set my xx's item r to xp
end if
return -- exit
else
if p < q - 1 then merge(p, (p + q) div 2, q - 1)
merge(q, (q + r + 1) div 2, r)
end if
At this point, sublits xx[p, q-1] and xx[q, r] have been already sorted (p < q <= r)
if my cmp(my xx's item (q - 1), my xx's item q) then
else -- xx[p, q-1] & xx[q, r] are already sorted
return
end if
set yy to my xx's items p thru r -- working copy for comparison
set ix to q - p
set jx to r - p + 1
set i to 1
set j to q - p + 1
set k to p
set yi to my yy's item i
set yj to my yy's item j
repeat
if my cmp(yi, yj) then
set my xx's item k to yj
set j to j + 1
set k to k + 1
if j > jx then
set my xx's item k to yi
set i to i + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item i
set i to i + 1
set k to k + 1
end repeat
return
end if
set yj to my yy's item j
else
set my xx's item k to yi
set i to i + 1
set k to k + 1
if i > ix then
set my xx's item k to yj
set j to j + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item j
set j to j + 1
set k to k + 1
end repeat
return
end if
set yi to my yy's item i
end if
end repeat
end merge
on cmp(x, y)
(* primary comparator *)
return x > y
end cmp
local d, i, j
if xxl ≤ 1 then return
if cmp_ = {} then set my cmp to cmp -- comparator fallback
my merge(1, (xxl + 1) div 2, xxl)
end script
tell o to run
end msort
on uniq(eq_, aa, {dup:dup}) -- v0.21
handler eq_ : comparator eq_(x, y) that returns true iff x and y are considered equal
list aa : pre-sorted list
(precisely, a list organized such that any duplicate items are adjacent to each other)
boolean _dup : option whether return unique items or duplicate items
return duplicate if true, unique otherwise.
script o
property parent : {} -- limit closure to minimum
property xx : aa
property yy : {}
property eq : eq_
on eq(x, y)
(* primitive comparator *)
x = y
end eq
if eq_ = {} then set my eq to my eq -- comparator fallback
local t, x, _on
if (count my xx) < 2 then return my xx's contents
if _dup then
set _on to false
set t to my xx's item 1
repeat with i from 2 to count my xx
set x to my xx's item i
if eq(x, t) then
set end of my yy to t
set _on to true
else if _on then
set end of my yy to t
set _on to false
end if
set t to x
end repeat
if _on then set end of my yy to x
return my yy's contents -- return duplicate elements
else
set t to my xx's item 1
set end of my yy to t
repeat with i from 2 to count my xx
set x to my xx's item i
if eq(x, t) then
else
set end of my yy to x
set t to x
end if
end repeat
return my yy's contents -- return uinque elements
end if
end script
tell o to run
end uniq
--END OF SCRIPT2
In order to apply it to your current Address Book problem, replace the main() handler with something like the following one.
--SCRIPT2a (part)
on main()
script o
-- input data
property xx : {} -- list of parent; given later
property yy : {} -- list of children per parent; given later
-- work list
property pp : {} -- list of children tagged by parent; i.e, lits of {child, parent}
property qq : {}
property rr : {}
-- (0) get input data from AB
tell application "Address Book"
tell people
set xx to its id
set yy to its every email's value
end tell
end tell
-- (1) build list of children tagged by parent *)
(* omitted (same as the previous) *)
-- (2) sort tagged list by child as key
(* omitted (same as the previous) *)
-- (3) retrieve parents with duplicate child
(* omitted (same as the previous) *)
-- (4) group the retrieved people in AB
tell application "Address Book"
repeat with r in my rr
add person id r to group "duplicate email"
end repeat
end tell
end script
tell o to run
end main
--END OF SCRIPT2a
Good luck,
Hiroto
Message was edited by: Hiroto -
Modal dialog issue - very urgent
Hi everyone,
i'm working with indesign application under asp.net. I'm using Interop.InDesign.dll. I'm able to open Indesign, but when i try to change UserInteractionLevel, then application returns error "Cannot handle the request because a modal dialog or alert is active." I can't see what modal dialog is opened because, i can't see Indesign window. It is runing in asp.net context.
When i'm opening manually Indesign then none of the modal dialogs is active.
My code:
Type indAppType = Type.GetTypeFromProgID("InDesign.Application");
objInDesign = (InDesign.Application)Activator.CreateInstance(indAppType, true);
objInDesign.ScriptPreferences.UserInteractionLevel = idUserInteractionLevels.idNeverInteract;
Do you have any solutuion for it ?
Thanks.
RegardsI have similar issues.
Initially this was caused by the splash dialog that appears the first time a user launches InDesign. Logging in with the credientals used to launch InDesign, and checking the "Dont show again" checkbox cleared it up for me.
Later, I ran into the problem again when InDesign was trying to recover some autosaved files.
This was cleared up by deleting the recovered file information from the accounts AppData folder.
I'm now getting this error again, but so far I dont know why. I have no Idea what modal dialog InDesign is trying to display. How can I tell?
I've got to say, I'm very disapointed with this behavior.
If a programmer sets ScriptPreferences.UserInteractionLevel to InDesign.idUserInteractionLevels.idNeverInteract; this should inform InDesign that its launch is part of an automated process; there is no user available to press anything, and there is likely not a desktop to display anything.
It is far more important for InDesign to respect the ScriptPreferences.UserInteractionLevel than to try and recover documents or display a welcome dialog.
But since we are stuck with this exception, I have the following questions:
Is there a way to programmatically dismiss the splash "Welcome" dialog via script command?
Is there a way to programmatically respond to the dialog that is displayed when InDesign has recovered documents?
Is there a way to programmatically determine what modal dialog is causing the exception? (app.Dialogs is empty)
Thanks!
Maybe you are looking for
-
After a download update 4.0, I cannot launch. Message says I need to reboot to complete a previous update. I rebooted 5 times to no avail.I have tried searching for xpicleanup.dat to no avail as suggested. What now?
-
Problem with creating BDC program
Hi All, I was trying to create a BDC program for transaction SE63 (language translation). I am doing it for text modules translation. For this, screen contains two fields, one is source language and another is target language and both are input disab
-
How do you white list messages in apple mail
What is the procedure to whitelist messages in Apple Mail?
-
Deploying ABAP Web Dyn Pro application in a portal iView
Hello, Our goal is to Deploy Web Dyn Pro application to public internet user and at the same time we want to keep the ABAP Web Application server that host Web ABAP Dyn Pro application behind the firewall so that no one can directly access the ABAP
-
Connecting Mac Pro to two (2) PCs for a print server
I would like to be able to use a PC with windows xp on it as a print server. I can get the mac's print to flash on the print server's screen, but as soon as that happens the printer dialog is stopped. What am I missing?