Script : How to add a progress bar to XMP Writing script ?
Hi !
I have this script that works flawlessly but when i execute it on big video files ( > 1GB) bridge doesn't repaint and it looks like it's stuck. I would like to have a progress bar showing % remaining on the task and the name of the file being treated. Can someone point me into the right direction as my adobe scripting knowledge is not that great.
#target bridge
if( BridgeTalk.appName == "bridge" ) {
descToTitle = MenuElement.create("command", "Log Comment to Description", "at the end of Tools");
descToTitle.onSelect = function () {
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var thumb = app.document.selections;
for(var s in thumb){
if(thumb[s].hasMetadata){
var selectedFile = thumb[s].spec;
var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var myXmp = myXmpFile.getXMP();
var LogComment = myXmp.getProperty(XMPConst.NS_DM, "logComment");
myXmp.deleteProperty(XMPConst.NS_DC, "description");
myXmp.appendArrayItem(XMPConst.NS_DC, "description", LogComment, 0, XMPConst.ALIAS_TO_ALT_TEXT);
myXmp.setQualifier(XMPConst.NS_DC, "description[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
if (myXmpFile.canPutXMP(myXmp)) {
myXmpFile.putXMP(myXmp);
myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
} else {
xmpFile.closeFile();
Thx in advance for helping me !
I am using this progress bar on bridge. I don't remember who gave it to me time ago.
Anyway I have adapt it to your script:
#target bridge
if( BridgeTalk.appName == "bridge" ) {
descToTitle = MenuElement.create("command", "Log Comment to Description", "at the end of Tools");
descToTitle.onSelect = function () {
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var thumb = app.document.selections;
var progBar = new createProgressWindow("Work in Progress", "Please wait", false);
for (var s in thumb) {
if(thumb[s].hasMetadata) {
var selectedFile = thumb[s].spec;
var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var myXmp = myXmpFile.getXMP();
var LogComment = myXmp.getProperty(XMPConst.NS_DM, "logComment");
myXmp.deleteProperty(XMPConst.NS_DC, "description");
myXmp.appendArrayItem(XMPConst.NS_DC, "description", LogComment, 0, XMPConst.ALIAS_TO_ALT_TEXT);
myXmp.setQualifier(XMPConst.NS_DC, "description[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
progBar.updateProgress (Math.floor((Number(s)+1)*(100/thumb.length)), "Waiting, " + Math.floor((Number(s)+1)*(100/thumb.length)) + "% completed.");
if (myXmpFile.canPutXMP(myXmp)) {
myXmpFile.putXMP(myXmp);
myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
} else {
xmpFile.closeFile();
function createProgressWindow(title, message, hasCancelButton) {
var win;
if (title == null) title = "Work in progress";
if (message == null) message = "Please wait...";
if (hasCancelButton == null) hasCancelButton = false;
win = new Window("palette", "" + title, undefined);
win.bar = win.add("progressbar", {x: 20,y: 12,width: 300,height: 20}, 0, 100);
win.stMessage = win.add("statictext", {x: 10,y: 36,width: 320,height: 20}, "" + message);
win.stMessage.justify = 'center';
if (hasCancelButton) {
win.cancelButton = win.add('button', undefined, 'Cancel');
win.cancelButton.onClick = function() {
win.close();
throw new Error('User canceled the pre-processing!');
this.reset = function(message) {
win.bar.value = 0;
win.stMessage.text = message;
return win.update();
this.updateProgress = function(perc, message) {
if (perc != null) {
win.bar.value = perc;
if (message != null) {
win.stMessage.text = message;
return win.update();
this.close = function() {
return win.close();
win.center(win.parent);
return win.show();
Similar Messages
-
How can add a progress bar into script?
Hi,
I got a script for gen pdf
I want put a progress bar, and make it working
but I don't know where I can put the progress bar
and how
//=====================================================================
var doc = app.documents;
app.findTextPreferences = null;
app.findTextPreferences.underline = true;
for(var i=0;i<doc.length;i++)
var found = doc[i].findText();
var _pages = [];
for(var j=0;j<found.length;j++)
var txfms = found[j].texts[0].parentTextFrames;
for(var k=0;k<txfms.length;k++)
_pages.push(txfms[k].parentPage.name);
for(var j=0;j<_pages.length;j++)
if(_pages[j] === _pages[j-1])
_pages.splice(j,1);
if(_pages.length != 0)
app.pdfExportPreferences.pageRange = _pages.toString();
doc[i].exportFile(ExportFormat.PDF_TYPE, new File(doc[i].fullName.toString().replace(/\.indd$/i,".pdf")), false);
_pages = [];
//=================================================================== Can I put progress bar in here?
var counter = new Window("palette");
counter.prompt = counter.add("statictext",[0,0,80,20]);
counter.show();
var cells = app.activeDocument.allCellStyles;
for(var i = cells.length-1; i > 0; i--){
counter.prompt.text = String(i);
cells[i].verticalJustification = VerticalJustification.bottomAlign;
counter.close();
//===================================================================
app.findTextPreferences = null;
alert("Done.");
thanks
HarveyHi Harvey,
Try this,
var doc = app.documents;
app.findTextPreferences = null;
app.findTextPreferences.underline = true;
for(var i=0;i<doc.length;i++)
var found = doc[i].findText();
var _pages = [];
for(var j=0;j<found.length;j++)
var txfms = found[j].texts[0].parentTextFrames;
for(var k=0;k<txfms.length;k++)
_pages.push(txfms[k].parentPage.name);
for(var j=0;j<_pages.length;j++)
if(_pages[j] === _pages[j-1])
_pages.splice(j,1);
if(_pages.length != 0)
app.pdfExportPreferences.pageRange = _pages.toString();
doc[i].exportFile(ExportFormat.PDF_TYPE, new File(doc[i].fullName.toString().replace(/\.indd$/i,".pdf")), false);
_pages = [];
var counter = new Window("palette");
counter.prompt = counter.add("statictext",[0,0,80,20]);
counter.show();
var cells = app.activeDocument.allCellStyles;
var w = new Window('palette');
w.pbar = w.add('progressbar', undefined, 0, cells.length);
w.pbar.preferredSize.width = 300;
w.show();
w.pbar.value = 0;
for(var i = cells.length-1; i > 0; i--)
w.pbar.value += 1;
counter.prompt.text = String(i);
cells[i].verticalJustification = VerticalJustification.bottomAlign;
counter.close();
app.findTextPreferences = null;
alert("Done.");
Regards,
Chinna -
How can i use Progress bar in IR Report
Hi ,
I have created IR Report based on the View so, it's been taking 10-15 mins of time to execute the IR Report. Here user want to see the Progress bar while executing the IR Report. How can i use Progress bar in IR Report.
Anybody have idea on Progress bar please help me.
Regards
Narender BHi ,
Thanks for your information.
I am new to the APEX.*i need to show Progress bar while opening the each page* then user can know some process is happening from the backside and i don't know where i need to add and call the below function.could you please provide the steps for the progress bar.
In my application there are almost 100 pages are there so, i need to show progress bar on each page while opening .could you please provide Global function to call on each page.
function html_url_Progress(pThis){
$x_Show('AjaxLoading');
window.setTimeout('$s("AjaxLoading",$x("AjaxLoading").innerHTML)', 100);
//doSubmit('APPLY_CHANGES');
redirect(pUrl);
Regards
Narender B -
How to use a progress bar with java mail?
Hi, i'm new here.
I want if someone can recommend me how to show a progress bar with java mail.
Because, i send a message but the screen freeze, and the progress bar never appear, after the send progress finish.
ThanksSo why would the code we post be any different than the code in the tutorial? Why do you think our code would be easier to understand? The tutorial contains explanations about the code.
Did you download the code and execute it? Did it work? Then customize the code to suit your situation. We can't give you the code because we don't know exactly what you are attempting to do. We don't know how you have changed to demo code so that it no longer works. Its up to you to compare your code with the demo code to see what the difference is. -
how to add a scroll bar within a view window ?I want to display x and y axis outside the scoll window and keep those axis static and move the graph within scroll area
ananyaHey Ananya,
I believe what you want to do is possible, but it will not be
easy. If you want to add a scroll bar that will scroll the graph
back and forth but keep the axis set, you would want to add a
horizontal or vertical scrollbar. Then you would create an event
handler for the scroll event. You would have to manually plot
different data within this scroll event. Unfortunately, there is
not really a built in way to do this with the Measurement Studio plot
control.
Thanks,
Pat P.
Software Engineer
National Instruments -
How to add the scroll bar in the vertical photo gallery?
like this, how to add the scroll bar? http://www.flashvault.net/tutorial.asp?ID=288 Thanks,
I want to know how to add a vertical scroll bar in the photo gallery which I copied from the tutorial. And add the event to catch MouseEvent.CLICK for each photo. Please advise. Thanks,
-
How to add this spectrum bar in labview?
anyone knows how to add the spectrum bar ( see attached file, arrow6) in labview and make the plot displays different color when Y value falls to different range?
many thanks
Message Edited by lksusier on 11-12-2008 10:12 PM
Solved!
Go to Solution.
Attachments:
intensitygraphchart.png 68 KBTry this.
LabVIEW Champion . Do more with less code and in less time . -
How can I add a Progress bar to show the "render to JPG" progress?
Hi everyone, I have a button which renders my component to
JPG.
How can I attach a progress bar to show the progress of the
rendering?
<mx:Button label="render" click="renderasJPEG ()"/>
public function renderasJPEG( ):void
convertToImage( component001, new JPEGEncoder( 100));
private function convertToImage( object:IUICompon ent,
encoder:IImageEncod er):void
var base64string: String = ImageSnapshot. encodeImageAsBas
e64(
ImageSnapshot. captureImage( object, 72, encoder));
var variables:URLVariab les = new URLVariables( );
variables.encoded = base64string;
variables.type = "jpeg";
var request:URLRequest = new URLRequest(" script_saveasima
ge.php");
request.method = "POST";
request.data = variables;
navigateToURL( request, "_blank");
Thanks in advance.Hi,
I would have thrown a prompt to the user in the renderasJpeg
function and removed it in last line of convertToImage function.
Isn't this what you want?
Hope this helps. -
How can i add a progress bar to my UIwebview
i have a page in my application where i have a UIWebview what i want to do is have a progress bar somewhere on the screen to indicate the loading status on the page.
Go to your xib file or storyboard file, then you should see Progress view in the objects.
-
How to create/set progress bar for loading flash intro
Hi,
I am having a falsh intro for my website.
But its taking time to download and play the intro when we try to access it.
I have seen many sites with progress bar indicating the status on the downloading of flash items.
Can anybody please tell me how should I go about this?You can make a simple loader, it's a visual cue so your users wait for a moment.
Try this, get a GIF from one of these site: http://www.google.com/search?hl=en&client=safari&rls=en-us&q=loading+gif&btnG=Se arch
download it and name it as loader.gif
add it to you page, and add the following to the page using HTML Snippet:
<script type='text/javascript'>
var timerCount = 0;
var delayTimer = 5; // change this for the duration to show the loader.gif
var loaderName = 'loader.gif';
function stopLoader() {
_imgs = parent.document.getElementsByTagName('img');
for (ji = 0; ji< _imgs.length; ji++) {
if (_imgs[ji].src.indexOf(loaderName) != -1) {
loaderElement = _imgs[ji];
break;
if (timerCount == delayTimer) {
loaderElement.style.visibility = 'hidden';
clearInterval(_stopLoader);
timerCount++;
parent.iWLog(timerCount);
_stopLoader = setInterval('stopLoader()', 1000);
</script>
BTW, here is an example: http://hdl.50webs.com/Sample/Blank.html -
UI 6.7 How could I use Progress bar form?
Hi all,
some SAP Business One add-ons use a small form with a progress bar instead of using the progress bar in the status bar. Does anyone knows how to use this form?
BernhardHi,
I think that you have to create your own form.
In my Addon, I create a form with FormType = ft_FixedNoTitle, add several EditTexts (9) with the property Enabled = False and Visible = False, and the name beginnig with "oEditText" + Number Sequential.
After, when executing my code, I change the property Visible = True, to the next EditText.
That way I have a "progress form" like used in others Addons.
I use the following code to "progress" (after created the form)
Private Sub WriteProgressInstall(ByVal pMsg As String, ByVal pPosition As Integer)
Dim oForm As SAPbouiCOM.Form
Dim oStaticText As SAPbouiCOM.StaticText
Dim i As Integer
Try
If pMsg <> String.Empty Then
oForm = SBO_Application.Forms.Item("frmProgressForm")
'if we have a StaticText to show the progress message
oStaticText = oForm.Items.Item("oMSG").Specific
oStaticText.Caption = pMsg
End If
'Hide all "progress steps"
If pPosition = 0 Then
For i = 1 To 9
oForm.Items.Item("oEditText" + CStr(pPosition)).Visible = False
Next
End If
oForm.Items.Item("oEditText" + CStr(pPosition)).Visible = True
Catch er As Exception
MsgBox(er.Message)
End Try
End Sub
To move to next "progress step" is just call
WriteProgressInstall("Executing Step 1..", 1)
HTH,
Ribeiro Santos -
Customizing OI to add step progress bar
Hello custom RTOI experts! I am attempting to make a customization to the full-featured LabVIEW RTOI (for TestStand 3.0) in order to provide the seemingly simple feature of a step completion progress bar on the execution page of the tab control. Let me explain a little behind the concept I'm going for. There are some steps in my sequences that take a relatively long time (15 minutes or so). During this period, a requirement of mine is to have a progress bar that gets updates every so often such that by the time the step would ordinary complete, the progress bar is at 100%. Initial attempts involved a separate VI that managed the progress bars, but having yet another window is not the ideal UI design... Instead, I was hoping to integrate this functionality into the RTOI so that each time a new step begins executing, additional custom data (the expected step duration) is (optionally) sent to the RTOI providing the progress update portion of the RTOI code the necessary data.
Is there any sample code out there that performs some similar task so that I can get a better feel for how the pieces fit together? In particular, there are a few things that are befuddling me:
1) What is a good way to store this custom information (step duration) in the sequence file? Should I modify the basic step types to add a new duration field which can be optionally set to something greater than the default, 0?
2) How should the step duration get passed to the RTOI? My current thought is to override the PreStep engine callback to send the custom duration field in a custom UIMessage, but that may be partly because I'm not familiar enough with the structure of the data is that is that is accessible via the sequence context...
3) How do I link the progress bar data to the actual execution page that is currently being viewed. Up to 4 executions can be running using the parallel model or the batch model in my sequences, so something would clearly need to be done so that when execution 1 is visible, the associated progress bar is shown, etc... I'm assuming I can trap on some event when the user clicks on an execution in the list bar, but there is no similar code in the out-of-box RTOI - all that appears to be managed automatically by linking the controls to the execution manager.
Thanks for any pointers or code samples (or even suggested reading) that anyone can give.Thanks for the response.
I may indeed want to use the ProgressPercent message, but I'm not so sure just yet. I did not want to leave the responsibility of sending UIMessages up to the VIs and other code modules called by the sequence - I was hoping for a simple solution to provide a new field (ExpectedDuration) that can be set for any given step. In this way, the RTOI can manage updating the progress simply by counting seconds. Perhaps there is some timer callback that can be leveraged to perform this function?
What I have so far is as follows: I have a new step type called PassFailTestWithDuration. It is a copy of the PassFailTest step type with the addition of a ExpectedDuration property and a new PreStep which calls the PostUIMessageEx with a custom event (10001). The expected duration and the RunState.TestSockets.MyIndex both get passed as parameters. Inside the RTOI, I have added a UserMessage callback VI which stores the data in the appropriate slot of a global (indexed by socket index). (The global array is implemented as what I've heard called an action engine - there are init, read, and write actions that it can perform on data stored in the VI, and it is set as non-reentrant so that race conditions cannot occur). Each entry in the global array has 2 fields - the expected duration, and the current elapsed time. My idea was to continually update the current elapsed time for all active executions and simply show a progress bar for the "active" execution by displaying its elapsed time/expected duration in each necessary event...
I think my main question now is - how do you determine the RunState.TestSocket.MyIndex of the active execution in the execution manager (or application manager)? It seems like such an obvious thing to want to know, but I don't see it anywhere.
Thanks again for any hints you can provide! -
Progress bar to update as script runs
Hi, I'd like to have a progress bar being displayed as my script runs. I created a simple progress bar as follows:
var win = new Window("palette", "SnpCreateProgressBar", [150, 150, 600, 260]);
win.pnl = win.add("panel", [10, 10, 440, 100], "Script Progress");
win.pnl.progBar = win.pnl.add("progressbar", [20, 35, 410, 60], 0, 100);
win.pnl.progBarLabel = win.pnl.add("statictext", [20, 20, 320, 35], "0%");
win.show();
while(win.pnl.progBar.value < win.pnl.progBar.maxvalue)
// this is what causes the progress bar increase its progress
win.pnl.progBar.value++;
win.pnl.progBarLabel.text = win.pnl.progBar.value+"%";
$.sleep(10);
alert('Done!');
win.close();
Now, if I target the ExtendScript Toolkit, I can see the "animation" of the bar progressing. But If I target illustrator, I only see when it's at 0% and then it jump to 100%. Is there a way to update the information visually as the script progresses?
Thanks!
I'm running CS6 on mac.Hi,
i was using the above code in my application but it is displaying the following message when i run it:
Can you please help me out.
Thanks
Harsh -
Form Button running Script that does not complete Progress Bar
Hello,
Currently I have created a form using the System.Reflection.Assembly which includes a textbox and button. The button calls a script with a progress bar using the write-progress method, but when the progress bar completes it does not go away.
Any assistance is appreciated. As the code is quite long and in several files I have posted some of the code below.
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$getVMware = Join-Path -path $ScriptPath -ChildPath "bin\get-vmhosts.ps1"
Add-PSSnapin VMware.VIMAutomation.Core -ErrorAction SilentlyContinue
$objForm = New-Object System.Windows.Forms.Form
$objForm.Text = "VMware Script - Created by Walter Beach"
$objForm.Size = New-Object System.Drawing.Size(650,390)
$objForm.StartPosition = "CenterScreen"
$AuditButton = New-Object System.Windows.Forms.Button
$AuditButton.Location = New-Object System.Drawing.Size(310,80)
$AuditButton.Size = New-Object System.Drawing.Size(75,23)
$AuditButton.Text = "Audit"
$AuditButton.Add_Click({ get-vmhosts | set-vmdnsservers -DNS $DNS })
$objForm.Controls.Add($AuditButton)
Function set-vmdnsservers
param
[Parameter(ValueFromPipelineByPropertyName=$true)]$Name,
[Parameter(Mandatory=$true,HelpMessage="Example: 192.168.1.1")]$DNS
$i = 0
$itemCount=$input.Count
write-host ""
Write-Host "Configuring DNS Server " -NoNewline
$Input | ForEach {
IF ($PSVersionTable.PSVersion.Major -ge 3) { Write-Progress -activity "Configuring DNS Servers" -status $_ -PercentComplete (($i++ / $itemCount) * 100) } Else { ticker }
$_ | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress $DNS | Out-Null
} # End For Each Loop
} # End of set-vmdnsservers
WalterYou need to put a final call to Write-Progress with the -Completed switch, probably right after your ForEach loop, in this case:
$Input | ForEach {
IF ($PSVersionTable.PSVersion.Major -ge 3) { Write-Progress -activity "Configuring DNS Servers" -status $_ -PercentComplete (($i++ / $itemCount) * 100) } Else { ticker }
$_ | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress $DNS | Out-Null
} # End For Each Loop
Write-Progress -Activity "Configuring DNS Servers" -Completed -
Hi all,
I want to keep a progress bar to my views on each action.How to keep that??
Can anyone plz help me out
Regards
Padma NHi,
A progress bar has 3 main properties namely
1) barcolor -which will decide color of progressbar.
create a context say ctx_barcolor of ProgressIndicatorBarColor type
which u can find in com.sap.ide.webdynpro.uielementdefinitions
2) percentvalue -This will decide the curent length of indicator.
This should be an integer say ctx_prcnt.
3) displayvalue -This will decide which value u want to display in ur progress bar.
This should be a String.For instance say ctx_dispval.
Now suppose I want to set my progress bar to 80% and say of green color.
Then first of all I will set percentvalue property.
wdContext.currentcontextelement.setCtx_prcnt(80);
Then I will set barcolor property.
wdContext.currentContextElement().setCtx_barcolor(WDProgressIndicatorBarColor.POSITIVE);
And finally I will set displayvalue property.
wdContext.currentContextElement().setCtx_dispval(wdContext.currentContextElement().getCtx_va_prcnt()+"%");
Collectivelly
wdContext.currentcontextelement.setCtx_prcnt(80);
wdContext.currentContextElement().setCtx_barcolor(WDProgressIndicatorBarColor.POSITIVE);
wdContext.currentContextElement().setCtx_dispval(wdContext.currentContextElement().getCtx_va_prcnt()+"%");
I hope this helps
Regards
Surender Dahiya
Maybe you are looking for
-
So I got my iPhone 6 on the day it came out and it has been the most frustrating experience I've ever had with apple. I've had to factory reset my phone twice, probably about to be three times once i get home from work. The first time was trying to
-
Safari stops responding arter using reading list.
I had a problem with my computer today. My iMac 2012 haven't been launching. After desctop shows of earlier everything have been shuting down and I could see the screen like Kernel Panic, but with the message "there was a problem...press a key or wai
-
Map in photobook; how to copy
When I make a photobook, I would like to use a geografical map twice. How can I copy a map.
-
IMessage show one of my contact old number
I am using a MacBook Pro and when i click on a contact it show old and actual number from a contact. I tried to delete this person from my contact and then add but it still shows old and actual number only on iMessage.
-
Can I free transform a shape?
I'm trying to free transform a rectangle drawn within InDesign. A pretty simple task, I thought. I want to be able to pull one corner point in a certain direction and distort it a bit. But selecting the shape with the direct selection tool doesn't al