CF scripts not consistently listing contents of folder

Hello.
I upload multiple types of files to the server. Sometimes
they are folders, word docs, ppts, pdfs or xls files. There is a
script that runs that is supposed to list everything that I have
uploaded into a directory. The problem is, it does not work
consistently. Sometimes it will display all files, subdirectories,
files within, sometimes it will say that nothing is there. I am not
sure why it will work with some files/folders, and won't with
others. Some folders work great, some don't. It may be a
permissions problem, I'm not sure...
Here's an example - I have a folder and a word document in
the "root" files directory. When viewing in the browser, it
displays "No Files Found". Then if I move a ppt back a directory -
to the root, all 3 items (word doc, folder and ppt) will then show
in the browser. For some reason the ppt triggers everything to
suddenly show. This "magical" ppt does not work for every directory
though. Some items just won't show no matter what.
Here's a sample script that lists the contents of the
directory:
<cfinclude template="../usercheck.cfm">
<cfparam name="URL.module" default="">
<cfparam name="URL.file" default="">
<cfparam name="URL.action" default="">
<HTML>
<HEAD>
<TITLE>Title</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
<link href="../links.css" rel="stylesheet"
type="text/css">
<!-- End Preload Script -->
<style type="text/css">
<!--
.style3 {color: #FFFFFF; font-weight: bold; }
.style6 {font-size: 10px}
-->
</style>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0
MARGINWIDTH=0 MARGINHEIGHT=0 ONLOAD="preloadImages();">
<a href="/index.html"><img src="/Images/graphic.gif"
width="169" height="84" border="0"></a>
<br>
<cfset pathn =
"#getDirectoryFromPath(cgi.PATH_TRANSLATED)#files">
<CFIF (URL.file IS NOT '')>
<CFDIRECTORY ACTION="LIST"
DIRECTORY="#pathn##urldecode(url.module)#"
NAME="FileCheck"
FILTER="#URL.file#">
<cfif URL.action eq "Delete">
<CFIF FileCheck.RecordCount GT 0>
<cffile file="#pathn##urldecode(url.module)##URL.file#"
action="delete">
<cflocation
url="module.cfm?module=#URLEncodedFormat(url.module)#">
</CFIF>
<cfelse>
<CFIF FileCheck.RecordCount GT 0>
<!--- <cfhttp
method="Get"
url="#getdirectoryfrompath(pathn)##URL.file#"
path="#pathn#"
file="#URL.file#"> --->
<CFHEADER
NAME="content-disposition"
VALUE="attachment; filename=#URL.file#">
<CFCONTENT type="application/unknown"
file="#pathn##URLdecode(url.module)##URL.file#"
DeleteFile="No"></CFCONTENT>
</CFIF>
</cfif>
<cfelse>
<CFDIRECTORY ACTION="LIST"
DIRECTORY="#pathn##urldecode(url.module)#"
NAME="dirlist">
<table width="487" border="0" align="center">
<tr bgcolor="#004B8D">
<td width="479" height="36"><span
class="style3"> Physician Modules
</span></td>
<td></td>
</tr>
<cfif #dirlist.recordcount# gt 2>
<CFOUTPUT QUERY="dirlist">
<CFIF type IS 'File'>
<tr bordercolor="##D5EBFF" bgcolor="##D5EBFF">
<td width="479" bordercolor="##D5EBFF" bgcolor="##F4FAFF"
class="links">
<span class="style6"><a
href="#cgi.SCRIPT_NAME#?module=#URLEncodedFormat(url.module)#&file=#name#"> #left(name,le n(name)-4)#</a></span>
</td>
<td width="50" bgcolor="##FFFFFF">
<cfswitch expression="#right(name,3)#">
<cfcase value="xls">
<cfset imagesrc="/Images/excel.gif">
</cfcase>
<cfcase value="pdf">
<cfset imagesrc="/Images/pdf.gif">
</cfcase>
<cfcase value="doc">
<cfset imagesrc="/Images/word.gif">
</cfcase>
<cfcase value="ppt">
<cfset imagesrc="/Images/powerpoint.gif">
</cfcase>
<cfdefaultcase>
<cfset imagesrc="/Images/unknown.gif">
</cfdefaultcase>
</cfswitch>
<div align="center"><img src="#imagesrc#" width="31"
height="27"></div>
</td>
</tr>
<cfelseif type eq 'Dir'>
<cfif ((name neq "." ) AND (name neq "..")) >
<cfset tempname = #url.module# & "" & #name#>
<tr bordercolor="##D5EBFF" bgcolor="##D5EBFF">
<td bordercolor="##D5EBFF" bgcolor="##F4FAFF"
class="links"><a
href="#CGI.SCRIPT_NAME#?module=#URLEncodedformat(tempname)#">#name#</a></td>
<td bgcolor="##FFFFFF"
class="links">Directory</td>
</tr>
</cfif>
</cfif>
</cfoutput>
<cfelse><!--- <cfif #dirlist.recordcount# lt
2> --->
<tr bordercolor="#D5EBFF" bgcolor="#D5EBFF">
<td bordercolor="#D5EBFF" bgcolor="#F4FAFF"
class="links">
<span class="style6">No Files
Found</a></span></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
</cfif>
</table>
</cfif>
<table width="100%" border="0" cellpadding="0"
cellspacing="0" class="links">
<tr>
<td height="50" align="center" valign="middle"
class="links">
<cfinclude template="../navmenu.cfm">
</td>
</tr>
</table>
</BODY>
</HTML>
Thanks for your help.

You are not able to do this with CF directly.  It would be a function of the web server.
You could move all documents other than .cfm into a folder outside of the web root, then use tags such as cfcontent to deliver those files programatically (as often happens when you download software off of a website now days).  However I suspect this isn't what you are looking for.  Just in case here is a quick example of how you may do the force download of document from outside root:  http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/force-file-download-27

Similar Messages

  • Can not add nodes (content and folder) into repositories

    Hi all,
    I have configured MS SQL database with WebLogic portal 10.2 without any error.
    Then i successfully created around 142 nodes under repository. But after that, when i try to create any new node
    server is throwing following exception:
    <Mar 26, 2009 8:07:32 PM GMT+05:30> <Error> <ContentManagement> <BEA-000000> <
    com.bea.content.RepositoryException: weblogic.jdbc.base.BaseBatchUpdateException: [BEA][SQLServer JDBC Driver][SQLServer]Violation of PRIMARY KEY constraint 'PK_CM_PROPERTY'. Cannot insert duplicate key in object 'dbo.CM_PROPERTY'.
    at com.bea.content.internal.server.common.dbaction.Batcher.processWithRetries(Batcher.java:132)
    at com.bea.content.internal.server.common.dbaction.Batcher.processAnyRemainingItems(Batcher.java:70)
    at com.bea.content.repo.internal.server.dao.PropertyDao.insert(PropertyDao.java:335)
    at com.bea.content.repo.internal.server.persister.JDBCNodePersister.createNode(JDBCNodePersister.java:121)
    at com.bea.content.repo.internal.server.logic.NodeOpsLogic.create(NodeOpsLogic.java:204)
    Truncated. see log file for complete stacktrace
    weblogic.jdbc.base.BaseBatchUpdateException: [BEA][SQLServer JDBC Driver][SQLServer]Violation of PRIMARY KEY constraint 'PK_CM_PROPERTY'. Cannot insert duplicate key in object 'dbo.CM_PROPERTY'.
    at weblogic.jdbc.sqlserver.SQLServerImplStatement.getBatchRowsAffectedCount(Unknown Source)
    at weblogic.jdbc.base.BasePreparedStatement.executeBatch(Unknown Source)
    at weblogic.jdbcx.base.BaseStatementWrapper.executeBatch(Unknown Source)
    at weblogic.jdbc.wrapper.PreparedStatement.executeBatch(PreparedStatement.java:154)
    at com.bea.content.internal.server.common.dbaction.Batcher.processWithRetries(Batcher.java:114)
    Truncated. see log file for complete stacktrace
    >
    Exception: com.bea.content.RepositoryException: weblogic.jdbc.base.BaseBatchUpdateException: [BEA][SQLServer JDBC Driver][SQLServer]Violation of PRIMARY KEY constraint 'PK_CM_PROPERTY'. Cannot insert duplicate key in object 'dbo.CM_PROPERTY'.
    But after cleaning CM_PROPERTY table from database, i could successfully create any new node.
    Why i am not able to create more than 142 nodes in repository?

    Here's some snippets of a valid SQL*Server config which shows some of the important transaction-related settings regarding how the <domain>/config/jdbc/*.xml scripts should be configured:
    - portalDataSourceNeverXA-jdbc.xml:
    <driver-name>weblogic.jdbc.sqlserver.SQLServerDriver</driver-name>
         <jdbc-data-source-params>
              <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
         </jdbc-data-source-params>
    - portalDataSource-jdbc.xml:
    <driver-name>weblogic.jdbc.sqlserver.SQLServerDriver</driver-name>
         <jdbc-data-source-params>
              <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
         </jdbc-data-source-params>
    - portalDataSourceAlwaysXA-jdbc.xml
    <driver-name>weblogic.jdbcx.sqlserver.SQLServerDataSource</driver-name>
         <jdbc-data-source-params>
    <global-transactions-protocol>TwoPhaseCommit</global-transactions-protocol>
         </jdbc-data-source-params>
    - p13nDataSource-jdbc.xml
              <driver-name>weblogic.jdbc.sqlserver.SQLServerDriver</driver-name>
         <jdbc-data-source-params>
              <global-transactions-protocol>None</global-transactions-protocol>
         </jdbc-data-source-params>
    - cgDataSource-nonXA-jdbc.xml
    <driver-name>weblogic.jdbc.sqlserver.SQLServerDriver</driver-name>
    <jdbc-data-source-params>
    <global-transactions-protocol>None</global-transactions-protocol>
    </jdbc-data-source-params>
    - cgDataSource-jdbc.xml
    <driver-name>weblogic.jdbc.sqlserver.SQLServerDriver</driver-name>
    <jdbc-data-source-params>
    <global-transactions-protocol>EmulateTwoPhaseCommit</global-transactions-protocol>
    </jdbc-data-source-params>
    Also please take a look at the Database Administration guide at http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/db/index.html -- it describes the process for creating the tables in your SQL*Server schema (necessary unless you do that via the config wizard)
    -Steve

  • New Presets Do Not Consistently Go to Preset Folder

    I generated a new Preset using Camera Raw as a Filter in Photoshop. When I went to save, it pointed to the folder in which the image file is stored, not the Preset folder in ACR. This does not happen consistently. However, I do not make it a practice to save new presets using the filter version as it is a scaled down version for obvious reasons. If I make a new Preset when I am in ACR from a raw file or even tiff, it saves it properly. Is there a way to point to the ACR folder instead of the image folder  without going through the file tree to get there?
    Windows 7, CC2014
    BTW, the instructions I found to find the preset folder in Win 7 was way wrong. Talk about frustrating!

    Here's what I found on line vs what really works to access the Settings folder.
    http://help.adobe.com/en_US/creativesuite/cs/using/WSCA4C914B-B11F-46c6-ACE5-42F36ED1C7BC. html
    Incorrect: Stores the settings in a Camera Raw database file in the folder Document and Settings/[user name]/Application Data/Adobe/CameraRaw
    The AppData folder is locked out
    Correct: C>Users>(Name)>AppData>Roaming>Adobe>CameraRaw>Settings

  • I transferred itunes library from old PC to new PC. The content all shows when I launch iTunes on the new PC now. The previous content does not show in iTunes but folder still looks like it is on hard drive on new PC. Suggestions on how to properly merge?

    I transferred itunes library from old PC to new PC. The content all shows when I launch iTunes on the new PC now. The previous content does not show in iTunes but folder still looks like it is on hard drive on new PC. Suggestions on how to properly merge?

    Before you connect any device to a new library go to the Devices tab of the the preferences panel via Edit > Preferences (Windows) or iTunes > Preferences (Mac) and ensure the box next to Prevent iPods, iPhones, and iPads from syncing automatically is ticked. You can now safely connect the device to your computer without the danger of media being automatically deleted or overwritten.
    To get all your content off your connect your iPad to your new computer.
    Then use a 3rd party piece of software to transfer your content
    I have found Senuti useful but there are others listed in the article I linked to in a previous post.
    https://discussions.apple.com/docs/DOC-3991
    That will let you transfer your non purchased content
    For Purchased content log in to iTunes on the new computer
    In Itunes Store click on Purchased under the Quick Links section on the right.
    Download any music by clicking on the cloud button

  • Bookmark drag down list difficulty-folder contents overlay folder list

    Previous Firefox versions: Bookmark folders drag down in column list, contents of each folder appear in column to right of the folder list, similar to arrangement of an outline page with each subcategory tabbed over.
    New version: Contents of folders appear as I scroll down through the folder column, preventing me from seeing the next folder in column. E.G. As I scroll down past "Business" to get to my "Travel" folder, contents of business folder open on top of the main folder column preventing me from dragging down further to Travel.

    I do agree. Mine is not *perfectly* fixed neither. When the folder’s contents list is wide and contains subfolders, the cursor needs to go completely above or below those subfolder’s contents to be released from displaying it. I can readily imagine how yours is not practical.
    But mine is decent enough that I am going to live with it for now, hoping that the prior functionality (which is normal behavior IMO) is restored in an upcoming release.
    Trying to describe this gives me a newfound appreciation for those who practice the craft of technial writing.

  • Why is Script not listed in the flex documentation

    hello;
    when I go to: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/all-index-S.html ,'Script' is not listed.
    ideally I would like to see both the mx and the s versions so that I can compare them.
    when I search it does show the mxml-only fx version, but that is not consistent with the rest of the documentation ( or as much as I have seen so far ) where seemingly all classes are indexed.
    any thoughts,
    thanks,
    dsdsdsdsd

    The special MXML tags that don't simply 'new' up an instance of a class are:
    Binding
    Component
    Declarations
    Definition
    DesignLayer
    Library
    Metadata
    Model
    Private
    Reparent
    Script
    Style
    I found the following doc page:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mxml-tag-detail.html
    It also includes XML and XMLList, but I don't thing those are actually special.
    Gordon Smith
    Adobe Flex SDK Team

  • Not able to create new folder in list/library sharepoint 2013 foundation

    I am not able to create new folder in library and also not able to edit existing list item
    Below is the error:
    Getting Error Message for Exception 
              System.Web.HttpUnhandledException (0x80004005): Exception of type 
              'System.Web.HttpUnhandledException' was thrown. ---> 
              System.NullReferenceException: Object reference not set to an 
              instance of an object.     at 
              Microsoft.SharePoint.WebPartPages.ListFormWebPart.EnsureList()     
              at Microsoft.SharePoint.WebPartPages.ListFormWebPart.EnsureListAndFor
              m()     at 
              Microsoft.SharePoint.WebPartPages.ListFormWebPart.UseLegacyForm()    
               at Microsoft.SharePoint.WebPartPages.ListFormWebPart.CreateChildCont
              rols()     at System.Web.UI.Control.EnsureChildControls()     at 
              Microsoft.SharePoint.WebPartPages.WebPart.get_WebPartMenu()     at Mi
              crosoft.SharePoint.WebPartPages.ListFormWebPart.CreateWebPartMenu()  
                 at Microsoft.SharePoint.WebPartPages.ListFormWebPart.OnLoad(Ev...
    Please help.It happens only on few sub sites

    Hi V_K04,
    You said that it happened only on few sub sites, whether this issue occurred on some subsites, and some subsite worked well.
    Please check whether there are some differences between the subsites that worked well and the problematic subsites. 
    Whether this issue occurred on all libraries and lists on problematic subsites.
    Whether there are some customizations in these problematic libraries and lists.
    Please create a new library and a new list, test again, compare the result.
    BestRegards,
    Wendy
    Wendy Li
    TechNet Community Support

  • How can I list path of all muisc NOT stored in iTunes Muisc Folder?

    Hi
    I'm trying to help out a friend (using a Vista PC) with this...
    Is there a utility which will list the file path of all the music files in the iTunes Library _which are not in_ the iTunes Music Folder?
    We have discovered that there are many many tracks which have not been copied into the iTunes Music Folder. Its all in a bit of a muddle with numerous music tracks stored on different drives. So we want to tidy it all up and have all the music in the iTunes Library in residing in the iTunes Music Folder.
    After doing a google search I found a Mac utility called "Music Folder Files Not Added v1.0" which would be ideal but its MAC only. 8^(
    Thanks for your time and any info.
    Rob 8^)

    You really shouldn't need to know. If all the tracks are recognized by iTunes, just make sure that the setting for the location of the iTunes Music folder in the iTunes Advanced preferences is set to the iTunes Music folder in My Music -> iTunes, then use the Consolidate Library command (in iTunes 8, it's under the File -> Library menu) and iTunes should copy everything into the iTunes Music folder and update all the links so everything still works.
    Hope this helps.

  • "could not save list changes to the server" while creating a new form in SharePoint Designer - custom content type

    i am getting "could not save list changes to the server" while creating a new form in SharePoint Designer.
    Actually the list was created with a custom content type. When i try to create a new form from the custom content type, it fails.
    However, when i try to create a form using item content type, it creates a form successfully.
    Could you please let me know hte workaroud for this.
    Tnx

    Hello,
    This link may be help you to create custom form using content types:
    http://blog.splibrarian.com/2011/03/21/using-content-types-to-modify-the-newform-aspx-and-editform-aspx-pages/
    Hemendra:Yesterday is just a memory,Tomorrow we may never see&lt;br/&gt; Please remember to mark the replies as answers if they help and unmark them if they provide no help &lt;br/&gt;(On vacation from 16th Oct to 28th Oct 2014)

  • My jobs word is not working all contents in the folder are gone not able open pls help

    My jobs word didnt let me shutdown its not letting me open the folder and all the contents seems to have disappeared . How am i going to fix this problem?

    Hi PR.Perichiyappan,
    In order to better assist you with your issue please provide us with a screenshot. If you need help to create a screenshot, please see [[How do I create a screenshot of my problem?]]
    Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem.
    Thank you!

  • Deploying a Reusable Workflow to a List Content Type using PowerShell

    We have a situation where deployment of a reusable workflow for a site content type cannot be completed through the web interface due to the number of libraries where the content type is in use (time-out on deploy and update).
    It was hoped that this could be accomplished with PowerShell but the method of deploying to a list content type appears to be different than it is to a list (all content types).
    The below snippet works fine for a list / all content types:
    function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
    $site = Get-SPSite $SiteCollection
    [Guid]$wfTemplateId = New-Object Guid
    #Step through each web in site collection
    $site | Get-SPWeb -limit all | ForEach-Object {
    $web = $_
    $_.Lists | ForEach-Object{
    if($_.AllowContentTypes -eq $true)
    if($_.ContentTypes.Item("$ctName") -ne $null)
    write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
    $ct = $_.ContentTypes[$ctName]
    $culture = New-Object System.Globalization.CultureInfo("en-US")
    $template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
    if($template -ne $null)
    $tasklist = "Tasks"
    $historylist = "Workflow History"
    if(!$web.Lists[$historylist])
    $web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
    "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
    if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
    Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
    $wfHistory = $web.Lists[$historylist]
    $wfHistory.Hidden = $true
    $wfHistory.Update()
    if(!$web.Lists[$tasklist])
    $web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.AddWorkflowAssociation($association)
    $_.Update()
    else
    Write-Error "Workflow Template not found"
    AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
    However changing the association as follows causes the script to still execute without a problem but the workflow doesn't appear for the content and the associations collection is empty:
    function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
    $site = Get-SPSite $SiteCollection
    [Guid]$wfTemplateId = New-Object Guid
    #Step through each web in site collection
    $site | Get-SPWeb -limit all | ForEach-Object {
    $web = $_
    $_.Lists | ForEach-Object{
    if($_.AllowContentTypes -eq $true)
    if($_.ContentTypes.Item("$ctName") -ne $null)
    write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
    $ct = $_.ContentTypes[$ctName]
    $culture = New-Object System.Globalization.CultureInfo("en-US")
    $template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
    if($template -ne $null)
    $tasklist = "Tasks"
    $historylist = "Workflow History"
    if(!$web.Lists[$historylist])
    $web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
    "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
    if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
    Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
    $wfHistory = $web.Lists[$historylist]
    $wfHistory.Hidden = $true
    $wfHistory.Update()
    if(!$web.Lists[$tasklist])
    $web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.ContentTypes[$ctname].AddWorkflowAssociation($association)
    $_.ContentTypes[$ctname].Update()
    else
    Write-Error "Workflow Template not found"
    AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
    The only change is:
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.ContentTypes[$ctname].AddWorkflowAssociation($association)
    $_.ContentTypes[$ctname].Update()
    But unlike the list version, the association doesn't appear to be saved and no error is generated.
    Is anyone aware of what may cause this or have an example in C# that may explain something my script is missing?

    Hi Garry,
    After you associate the workflow to the content type, you should update the update the content type using
    $ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
     method.
    Here is the completed script:
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $site=Get-SPSite "http://serverName"
    $web=$site.OpenWeb()
    $list=$web.Lists["ListC"]
    $taskList=$web.Lists["Tasks"]
    $historyList=$web.Lists["Workflow History"]
    $ct=$list.ContentTypes["Link"]
    $culture=New-Object System.Globalization.CultureInfo("en-US")
    $wfTemplate=$web.WorkflowTemplates.GetTemplateByName("Three-State",$culture)
    $associationWF=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($wfTemplate, "myThreeStateWF",$taskList,$historyList)
    $ct.WorkflowAssociations.Add($associationWF)
    $ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
    Here is a demo about how to update it using C#
    http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-associate-workflow-to-content-type-in-a-feature
    Wayne Fan
    TechNet Community Support

  • Metadata of Controller EMPTYVIEW Is Not Consistent.

    Hi,
    After upgrading NW04s from SP07 to SP11, one of my web dynpro for ABAP application gives the following error on execution.
    I am also getting a system dump. I have checked all the necessary services in SICF & most of the required services are active. Does any one have some idea of how I can resolve this error.
    Error when processing your request
    What has happened?
    The URL http://ustca644.kcc.com:8086/sap/bc/webdynpro/sap/zvmkc_tsvm_main/ was not called due to an error.
    Note
      The following error text was processed in the system PGW : Metadata of Controller >EMPTYVIEW< Is Not
    Consistent. "View Controller" Does Not Contain a "View"
      The error occurred on the application server ustca644_PGW_20 and in the work process 0 .
      The termination type was: RABAX_STATE
      The ABAP call stack was:
    Method: CONTROLLER_KIND_TO_TEXT of program CL_WDY_RG_META_SERVICE========CP
    Method: CONSTRUCTOR of program CL_WDY_RG_CONTROLLER==========CP
    Method: GET_CONTROLLER_PARTS of program SAPLWDR_RUNTIME_REPOSITORY
    Method: SAVE_COMPONENT of program SAPLWDR_RUNTIME_REPOSITORY
    Method: SAVE of program SAPLWDR_RUNTIME_REPOSITORY
    Function: WDR_SAVE_REPOSITORY of program SAPLWDR_RUNTIME_REPOSITORY
    Method: SAVE of program CL_WDR_RR_DB==================CP
    Function: WDY_WB_GENERATE_INTERNAL of program SAPLWDY_WB_ACTIVATION_SERVICES
    Function: WDY_WB_GENERATE of program SAPLWDY_WB_ACTIVATION_SERVICES
    Method: CONSTRUCTOR of program SAPLWDR_RUNTIME_REPOSITORY
    What can I do?
      If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system
    PGW in transaction ST22.
      If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on
    the application server ustca644_PGW_20 in transaction SM21.
      If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work
    process 0 in transaction ST11 on the application server ustca644_PGW_20 . In some situations, you may also need to analyze
    the trace files of other work processes.
      If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 400 -u: C14216 -l: E -s: PGW -i: ustca644_PGW_20 -w: 0 -d: 20070222 -t: 222514 -v: RABAX_STATE -e:
    UNCAUGHT_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    System Dump
    Runtime Errors         UNCAUGHT_EXCEPTION
    Exception              CX_WDY_RG_MD
    Date and Time          02/22/2007 22:25:14
    Short text
    An exception occurred that was not caught.
    What happened?
    The exception 'CX_WDY_RG_MD' was raised, but it was not caught anywhere along
    the call hierarchy.
    Since exceptions represent error situations and this error was not
    adequately responded to, the running ABAP program
    'CL_WDY_RG_META_SERVICE========CP' has to be
    terminated.
    What can you do?
    Note down which actions and inputs caused the error.
    To process the problem further, contact you SAP system
    administrator.
    Using Transaction ST22 for ABAP Dump Analysis, you can look
    at and manage termination messages, and you can also
    keep them for a long time.
    Error analysis
    An exception occurred which is explained in detail below.
    The exception, which is assigned to class 'CX_WDY_RG_MD', was not caught and
    therefore caused a runtime error.
    The reason for the exception is:
    Metadata of Controller >EMPTYVIEW< Is Not Consistent. "View Controller" Does
    Not Contain a "View"
    How to correct the error
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "UNCAUGHT_EXCEPTION" "CX_WDY_RG_MD"
    "CL_WDY_RG_META_SERVICE========CP" or "CL_WDY_RG_META_SERVICE========CM001"
    "CONTROLLER_KIND_TO_TEXT"
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
    To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    System environment
    SAP-Release 700
    Application server... "ustca644"
    Network address...... "165.28.85.39"
    Operating system..... "Windows NT"
    Release.............. "5.2"
    Hardware type........ "4x AMD64 Level"
    Character length.... 16 Bits
    Pointer length....... 64 Bits
    Work process number.. 0
    Shortdump setting.... "full"
    Database server... "PGWA"
    Database type..... "DB2"
    Database name..... "PGW"
    Database user ID.. "SAPR3"
    Char.set.... "C"
    SAP kernel....... 700
    created (date)... "Oct 30 2006 00:08:55"
    create on........ "NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00"
    Database version. "DB2CLI.DLL 08.02.0003 "
    Patch level. 83
    Patch text.. " "
    Database............. "DB2 for OS/390 7.1, DB2 for OS/390 8.1, DB2 for OS/390
    9.1"
    SAP database version. 700
    Operating system..... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2"
    Memory consumption
    Roll.... 16192
    EM...... 16759360
    Heap.... 0
    Page.... 0
    MM Used. 12837904
    MM Free. 3918160
    User and Transaction
    Client.............. 400
    User................ "C14216"
    Language Key........ "E"
    Transaction......... " "
    Program............. "CL_WDY_RG_META_SERVICE========CP"
    Screen.............. "SAPMHTTP 0010"
    Screen Line......... 2
    Information on Caller ofr "HTTP" Connection:
    Plug-in Type.......... "HTTP"
    Caller IP............. "165.28.239.30"
    Caller Port........... 8086
    Universal Resource Id. "/sap/bc/webdynpro/sap/zvmkc_tsvm_main/"
    Information on where terminated
    Termination occurred in the ABAP program "CL_WDY_RG_META_SERVICE========CP" -
    in "CONTROLLER_KIND_TO_TEXT".
    The main program was "SAPMHTTP ".
    In the source code you have the termination point in line 20
    of the (Include) program "CL_WDY_RG_META_SERVICE========CM001".
    Source Code Extract
    Line
    SourceCde
    1
    method CONTROLLER_KIND_TO_TEXT .
    2
    3
    data:
    4
    cref_View type ref to cl_wdy_md_view,
    5
    ctlr_Type type Wdy_Md_Controller_Type.
    6
    7
    ctlr_Type = controller->get_type( ).
    8
    9
    case ctlr_Type.
    10
    11
    when wdyn_ctlr_type_custom.
    12
    controller_type_as_text = 'CUSTOM'.
    13
    14
    when wdyn_ctlr_type_view.
    15
    controller_type_as_text = 'VIEW'.
    16
    if ( ABAP_FALSE eq Controller->Has_View( ) ).
    17
    " view controller must have a view
    18
    gi_Cx_Text =  Controller->Get_Name( ).
    19
    gi_Cx_Hint = '"View Controller" enthält keine "View"'(NVW).
    >>>>>
    raise exception type Cx_Wdy_Rg_Md
    21
    exporting
    22
    TextId =     Cx_Wdy_Rg_Md=>Controller_Data
    23
    Controller = gi_Cx_Text
    24
    Reason =     gi_Cx_Hint.
    25
    26
    else.
    27
    gi_Cx_Text =  Controller->Get_Name( ).
    28
    if ( gi_Cx_Text eq 'EMPTYVIEW' ).
    29
    return.
    30
    endif.
    31
    32
    " sanity check against illegal CL_WDY_MD_EMPTY_VIEW
    33
    try.
    34
    cref_View ?= Controller->Get_View( ).
    35
    if ( cref_View is initial ).
    36
    gi_Cx_Text =  Controller->Get_Name( ).
    37
    gi_Cx_Hint = '"View Controller" enthält keine "View"'(NVW).
    38
    raise exception type CX_Wdy_Rg_Md
    39
    exporting
    Contents of system fields
    Name
    Val.
    SY-SUBRC
    0
    SY-INDEX
    1
    SY-TABIX
    2
    SY-DBCNT
    0
    SY-FDPOS
    7
    SY-LSIND
    0
    SY-PAGNO
    0
    SY-LINNO
    1
    SY-COLNO
    1
    SY-PFKEY
    SY-UCOMM
    SY-TITLE
    HTTP Control
    SY-MSGTY
    SY-MSGID
    SY-MSGNO
    000
    SY-MSGV1
    SY-MSGV2
    SY-MSGV3
    SY-MSGV4
    SY-MODNO
    0
    SY-DATUM
    20070222
    SY-UZEIT
    222514
    SY-XPROG
    SY-XFORM
    Active Calls/Events
    No.   Ty.          Program                             Include                             Line
    Name
    22 METHOD       CL_WDY_RG_META_SERVICE========CP    CL_WDY_RG_META_SERVICE========CM001    20
    CL_WDY_RG_META_SERVICE=>CONTROLLER_KIND_TO_TEXT
    21 METHOD       CL_WDY_RG_CONTROLLER==========CP    CL_WDY_RG_CONTROLLER==========CM001    25
    CL_WDY_RG_CONTROLLER=>CONSTRUCTOR
    20 METHOD       SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYF11            684
    LCL_SAVE_REPOSITORY=>GET_CONTROLLER_PARTS
    19 METHOD       SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYF11             91
    LCL_SAVE_REPOSITORY=>SAVE_COMPONENT
    18 METHOD       SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYF11             29
    LCL_SAVE_REPOSITORY=>SAVE
    17 FUNCTION     SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYU02             27
    WDR_SAVE_REPOSITORY
    16 METHOD       CL_WDR_RR_DB==================CP    CL_WDR_RR_DB==================CM002     3
    CL_WDR_RR_DB=>SAVE
    15 FUNCTION     SAPLWDY_WB_ACTIVATION_SERVICES      LWDY_WB_ACTIVATION_SERVICESU04        279
    WDY_WB_GENERATE_INTERNAL
    14 FUNCTION     SAPLWDY_WB_ACTIVATION_SERVICES      LWDY_WB_ACTIVATION_SERVICESU01         84
    WDY_WB_GENERATE
    13 METHOD       SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYF12             77
    LCL_REPOSITORY=>CONSTRUCTOR
    12 METHOD       SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYF01             17
    LCL_COMPONENT=>CONSTRUCTOR
    11 METHOD       SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYF01            669
    LCL_COMPONENT=>IF_WDR_RR_COMPONENT~GET_USED_COMPONENT
    10 METHOD       SAPLWDR_RUNTIME_REPOSITORY          LWDR_RUNTIME_REPOSITORYF01            245
    LCL_COMPONENT=>IF_WDR_RR_COMPONENT~CREATE_COMPONENT_USAGE
    9 METHOD       CL_WDR_MESSAGE_WINDOW=========CP    CL_WDR_MESSAGE_WINDOW=========CM001    30
    CL_WDR_MESSAGE_WINDOW=>CONSTRUCTOR
    8 METHOD       CL_WDR_APPLICATION_WINDOW=====CP    CL_WDR_APPLICATION_WINDOW=====CM00K     6
    CL_WDR_APPLICATION_WINDOW=>INITIALIZE
    7 METHOD       CL_WDR_CLIENT_COMPONENT=======CP    CL_WDR_CLIENT_COMPONENT=======CM004    59
    CL_WDR_CLIENT_COMPONENT=>DISPLAY_TOPLEVEL_COMPONENT
    6 METHOD       CL_WDR_CLIENT_APPLICATION=====CP    CL_WDR_CLIENT_APPLICATION=====CM00L    30
    CL_WDR_CLIENT_APPLICATION=>INIT
    5 METHOD       CL_WDR_MAIN_TASK==============CP    CL_WDR_MAIN_TASK==============CM00I    40
    CL_WDR_MAIN_TASK=>EXECUTE
    4 METHOD       CL_WDR_MAIN_TASK==============CP    CL_WDR_MAIN_TASK==============CM00J    69
    CL_WDR_MAIN_TASK=>IF_HTTP_EXTENSION~HANDLE_REQUEST
    3 METHOD       CL_HTTP_SERVER================CP    CL_HTTP_SERVER================CM00I   524
    CL_HTTP_SERVER=>EXECUTE_REQUEST
    2 FUNCTION     SAPLHTTP_RUNTIME                    LHTTP_RUNTIMEU02                      929
    HTTP_DISPATCH_REQUEST
    1 MODULE (PBO) SAPMHTTP                            SAPMHTTP                               13
    %_HTTP_START

    Hi Kim,
    Please try the following:
    Try to reactivate the component
    If this does not help, please create an OSS ticket and the SAP colleagues will help you to fix the problem. Please add exact information about the component and open a connection to your system.
    Ciao, Regina

  • How to find files in your iTunes Library & NOT in Your iTunes Music folder AND visa versa.

    Finding Files in iTunes Music folder that are not Listed in iTunes
    Make  2 Smart Play Lists and 1 Static Playlist as follows:
    1. Make a smart playlist called “All Files” with this rule: “Artist” is not “123456789″ (or any nonsense name that won’t be in your library).
    2. Make a static playlist called “All Live Files”.
    3. Make a smart playlist called “Missing Files” with these rules: Match all of the following rules, Playlist is “All Files”, Playlist is not “All Live Files”
    Preform the following operations:
    4. Select all the files from “All Files” and drag them into “All Live Files”. The dead files marked  ! will not copy over.
    5. “Missing Files” will contain all of your dead files. Select all and delete (Option+Delete). Voila, a nice clean iTunes library.
    I keep these three playlists in their own folder. Whenever I gather more than a couple dead tracks for whatever reason, I delete all the tracks in “All Live Files” and repeat steps 4 and 5.
    Finding Files in iTunes Library Are Not Present in iTunes Music Folder
    Search on ‘Net for an Applescript called “Music Folder Files Not Added.” This will be at a site called Doug’s Applescripts and costs a mere $1.99. Install and follow instructions. This script also happens of clean up gremlins such as Podcasts that won’t go away, etc.
    <Edited by Host>

    From the top of the page where the scripts live...
    The general method of use is to download the script to a folder of your choice, e.g. your Desktop, Downloads folder or create a folder at ...\iTunes\Scripts. Select a playlist or highlight some tracks in iTunes and then double-click on the script to execute it. If no specific tracks are selected the script will try to work with all tracks in the current playlist. Some scripts offer a choice of track by track confirmation of changes or fully automatic processing of the selection. Many of the scripts can optionally display a progress bar while running.
    You are strongly advised to backup your entire library, or at the very least the iTunes Library.itl file, before use. Test the behaviour of your chosen script on a small group of files first to make sure it does what you want before applying it to large numbers of files.
    Most builds of Windows will execute *.vbs scripts when you double-click them. If that doesn't happen then you might need to visit the Add/Remove Programs or Programs & Features control panel to enable the Windows Scripting Host. I can track down details if you have issues.
    Backing up and restoring data is an area that is often glossed over. Most people don't try to learn much about it until they've lost something important. (Me too )
    If your iTunes library was in the usual layout then normally copying the whole iTunes folder from the User's Music folder in the old computer to the User's Music folder in the new one will usually work fine. Ideally this is done before iTunes is installed so that there is no empty library to replace, and all settings are picked up from the old library. This post contains more details.
    tt2

  • Powershell script to get list of softwares installed as shown in registry on all the remote systems in a txt file

    Hi
    I need to know the command for getting list of softwares installed on all the remote systems in network  which are existing in their respective registry like HKEY_LOCAL_MACHINE\SOFTWARE of all other systems

    Hey
    Sorry this isn't powershell but it should do the job if you want to use it. The problem with using the Win32_Product WMI Class to enumerate the installed software (especially on Windows 2000 & 2003 Servers) is that the WMI class is NOT installed by default. Here is a VBScript i wrote to read a list of hostnames from a text file named "ComputerNames.txt" from the scripts directory and attempt to remotely enumerate all subkeys within the following registry key
    HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
    For each subkey enumerated it will attempt to read the value of the "DisplayName" key and output the results to a csv file.
    (the results should be the same as what you would see when you open Add/Remove Programs)
    Hope that helps
    Cheers
    Matt :)
    'Script Name : CheckInstalledSoftware.vbs
    'Author : Matthew Beattie
    'Created : 01/03/10
    'Description : This script reads a list of hostnames from a text file name "ComputerNames.txt" in the scripts working
    ' : directory. For each hostName it requests an ICMP response and if successfull attempts a remote registry
    ' : connection to enumerate and read the registry values of installed software. All results are logged to the
    ' : scripts working directory in a log file per computer name.
    'Initialization Section
    Option Explicit
    Const ForReading = 1
    Const ForAppending = 8
    Dim objFSO, wshNetwork, wshShell, hostName
    Dim scriptBaseName, scriptPath, scriptLogPath
    On Error Resume Next
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set wshShell = CreateObject("WScript.Shell")
    Set wshNetwork = CreateObject("WScript.Network")
    scriptBaseName = objFSO.GetBaseName(Wscript.ScriptFullName)
    scriptPath = objFSO.GetFile(Wscript.ScriptFullName).ParentFolder.Path
    scriptLogPath = scriptPath & "\" & IsoDateString(Now)
    If Err.Number <> 0 Then
    Wscript.Quit
    End If
    On Error Goto 0
    'Main Processing Section
    On Error Resume Next
    PromptStart
    ProcessScript
    If Err.Number <> 0 Then
    Wscript.Quit
    End If
    PromptEnd
    On Error Goto 0
    'Functions Processing Section
    'Name : ProcessScript -> Primary Function that controls all other script processing.
    'Parameters : None ->
    'Return : None ->
    Function ProcessScript
    Dim fileSpec, hostNames, regKey, keyName, results, result
    keyName = "DisplayName"
    regKey = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall"
    fileSpec = scriptPath & "\ComputerNames.txt"
    'Ensure the "ComputerNames.txt" file exists within the scripts working directory.
    If Not objFSO.FileExists(fileSpec) Then
    MsgBox DQ(fileSpec) & " does not exist!", vbCritical, scriptBaseName
    Exit Function
    End If
    'Read the list of hostNames from the "ComputerNames.txt" text file within the scripts working directory.
    If Not GetScriptInput(hostNames, fileSpec) Then
    Exit Function
    End If
    'Attempt to read the registry from each hostname read from the list of hostnames.
    For Each hostName In hostNames
    Do
    'Ensure the system responds to an ICMP request.
    If Not CheckConnection(hostName) Then
    LogMessage 2, "Failed to respond to an ICMP Request"
    Exit Do
    End If
    'Enumerate and read the registry values.
    If Not GetRegValues(results, hostName, keyName, regKey) Then
    Exit Do
    End If
    'Log the registry values results.
    For Each result In results
    LogMessage 0, result
    Next
    Loop Until True
    Next
    End Function
    'Name : GetScriptInput -> Reads a text file to be used as Script input.
    'Parameters : items -> Output: An array of items in the script input file.
    ' : fileSpec -> The full folder Path, file Name and extention of the script input file.
    'Return : GetScriptInput -> Returns an array of items for script input and True or False.
    Function GetScriptInput(items, fileSpec)
    Dim scriptInputFile, itemsDict, item
    GetScriptInput = False
    Set itemsDict = NewDictionary
    If Not objFSO.FileExists(fileSpec) Then
    Exit Function
    End If
    On Error Resume Next
    Set scriptInputFile = objFSO.OpenTextFile(fileSpec, ForReading)
    If Err.Number <> 0 Then
    Exit Function
    End If
    On Error Goto 0
    Do Until scriptInputFile.AtEndOfStream
    item = scriptInputFile.ReadLine
    If item = "" Then
    Exit Function
    End If
    If Not itemsDict.Exists(item) Then
    itemsDict.Add item, ""
    End If
    Loop
    items = itemsDict.Keys
    GetScriptInput = True
    End Function
    'Name : CheckConnection -> Checks a remote host using WMI ping.
    'Parameters : hostName -> Hostname of computer system to verify network connectivity with.
    'Return : Boolean -> True if hostname replies. False otherwise.
    Function CheckConnection(hostName)
    Dim ping, response, replied
    Set ping = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
    ("select * from Win32_PingStatus where address = '" & hostName & "'")
    For each response in ping
    replied = Not IsNull(response.StatusCode) And response.StatusCode = 0
    Next
    CheckConnection = replied
    End Function
    'Name : GetRegValues -> Enumerates the subkeys in a registry key and the values of the keyName.
    'Parameters : hostName -> String containing the hostName of the system to enumerate the registry keys on.
    ' : keyName -> String containing the name of the registry key value to enumerate.
    ' : regKey -> Registry key to enumerate subkey names for.
    'Return : GetRegValues -> Returns True and an Array containing the registry key values otherwise False.
    Function GetRegValues(results, hostName, keyName, regKey)
    Dim objReg, regDict, rootKey, hive, keyValue, subKeys, i
    GetRegValues = False
    rootKey = regKey
    hive = GetRegistryHiveFromKey(rootKey)
    On Error Resume Next
    If hive <> 0 Then
    'Create a dictionary object to store the registry values in.
    Set regDict = NewDictionary
    If Err.Number <> 0 Then
    LogMessage 1, "Creating Dictionary Object"
    Exit Function
    End If
    'Connect to the remote registry.
    Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & hostName & "\root\default:StdRegProv")
    If Err.Number <> 0 Then
    LogMessage 1, "Creating StdRegProv Object"
    Exit Function
    End If
    'Enumerate the subkey names within the regKey paramater.
    objReg.EnumKey hive, rootKey, subKeys
    If Err.Number <> 0 Then
    LogMessage 1, "Enumerating Registry Keys"
    Exit Function
    End If
    'Ensure the results are an array.
    If Not IsArray(subKeys) Then
    subKeys = Array(subKeys)
    End If
    'Read the registry key value for each subkey. Add the results to the dictionary.
    For i = 0 to UBound(subKeys)
    objReg.GetStringValue hive, rootKey & "\" & subKeys(i), keyName, keyValue
    If Err.Number = 0 Then
    If Not IsNull(keyValue) Then
    regDict(regDict.Count) = keyValue
    End If
    Else
    Err.Clear
    End If
    Next
    End If
    On Error Goto 0
    results = regDict.Items
    GetRegValues = True
    End Function
    'Name : GetRegistryHiveFromKey -> Get the hive ID from a registry key name.
    'Parameters: Input/Output: key -> Registry key name. Hive name will be removed.
    'Return : GetRegistryHiveFromKey -> ID of hive of given key name (0 if invalid).
    ' : -> The hive name is removed from the input key name.
    Function GetRegistryHiveFromKey (key)
    Dim pos, hive
    pos = Instr (key, "\")
    If pos = 0 Then
    pos = Len(key) + 1
    End If
    hive = Left (UCase (Left (key, pos - 1)) & " ", 4)
    key = Mid (key, pos + 1)
    GetRegistryHiveFromKey = Array(0, &H80000000, &H80000001, &H80000002, &H80000003, &H80000005, &H80000006) _
    (Int ((Instr("HKCR,HKCU,HKLM,HKU ,HKCC,HKDD", hive) + 4) / 5))
    End Function
    'Name : NewDictionary -> Creates a new dictionary object.
    'Parameters : None ->
    'Return : NewDictionary -> Returns a dictionary object.
    Function NewDictionary
    Dim dict
    Set dict = CreateObject("scripting.Dictionary")
    dict.CompareMode = vbTextCompare
    Set NewDictionary = dict
    End Function
    'Name : DQ -> Place double quotes around a string and replace double quotes
    ' : -> within the string with pairs of double quotes.
    'Parameters : stringValue -> String value to be double quoted
    'Return : DQ -> Double quoted string.
    Function DQ (ByVal stringValue)
    If stringValue <> "" Then
    DQ = """" & Replace (stringValue, """", """""") & """"
    Else
    DQ = """"""
    End If
    End Function
    'Name : IsoDateTimeString -> Generate an ISO date and time string from a date/time value.
    'Parameters : dateValue -> Input date/time value.
    'Return : IsoDateTimeString -> Date and time parts of the input value in "yyyy-mm-dd hh:mm:ss" format.
    Function IsoDateTimeString(dateValue)
    IsoDateTimeString = IsoDateString (dateValue) & " " & IsoTimeString (dateValue)
    End Function
    'Name : IsoDateString -> Generate an ISO date string from a date/time value.
    'Parameters : dateValue -> Input date/time value.
    'Return : IsoDateString -> Date part of the input value in "yyyy-mm-dd" format.
    Function IsoDateString(dateValue)
    If IsDate(dateValue) Then
    IsoDateString = Right ("000" & Year (dateValue), 4) & "-" & _
    Right ( "0" & Month (dateValue), 2) & "-" & _
    Right ( "0" & Day (dateValue), 2)
    Else
    IsoDateString = "0000-00-00"
    End If
    End Function
    'Name : IsoTimeString -> Generate an ISO time string from a date/time value.
    'Parameters : dateValue -> Input date/time value.
    'Return : IsoTimeString -> Time part of the input value in "hh:mm:ss" format.
    Function IsoTimeString(dateValue)
    If IsDate(dateValue) Then
    IsoTimeString = Right ("0" & Hour (dateValue), 2) & ":" & _
    Right ("0" & Minute (dateValue), 2) & ":" & _
    Right ("0" & Second (dateValue), 2)
    Else
    IsoTimeString = "00:00:00"
    End If
    End Function
    'Name : LogMessage -> Parses a message to the log file based on the messageType.
    'Parameters : messageType -> Integer representing the messageType.
    ' : -> 0 = message (writes to a ".csv" file)
    ' : -> 1 = error, (writes to a ".err" file including information relating to the error object.)
    ' : -> 2 = error message (writes to a ".err" file without information relating to the error object.)
    ' : message -> String containing the message to write to the log file.
    'Return : None ->
    Function LogMessage(messageType, message)
    Dim prefix, logType
    prefix = hostName
    Select Case messageType
    Case 0
    logType = "csv"
    Case 1
    logType = "err"
    message = "Error " & Err.Number & " (Hex " & Hex(Err.Number) & ") " & message & ". " & Err.Description
    Case Else
    LogType = "err"
    End Select
    If Not LogToCentralFile(scriptLogPath & "." & logType, hostName & "," & message) Then
    Exit Function
    End If
    End Function
    'Name : LogToCentralFile -> Attempts to Appends information to a central file.
    'Parameters : logSpec -> Folder path, file name and extension of the central log file to append to.
    ' : message -> String to include in the central log file
    'Return : LogToCentralFile -> Returns True if Successfull otherwise False.
    Function LogToCentralFile(logSpec, message)
    Dim attempts, objLogFile
    LogToCentralFile = False
    'Attempt to append to the central log file up to 10 times, as it may be locked by some other system.
    attempts = 0
    On Error Resume Next
    Do
    Set objLogFile = objFSO.OpenTextFile(logSpec, ForAppending, True)
    If Err.Number = 0 Then
    objLogFile.WriteLine message
    objLogFile.Close
    LogToCentralFile = True
    Exit Function
    End If
    Randomize
    Wscript.sleep 1000 + Rnd * 100
    attempts = attempts + 1
    Loop Until attempts >= 10
    On Error Goto 0
    End Function
    'Name : PromptStart -> Prompt when script starts.
    'Parameters : None ->
    'Return : None ->
    Function PromptStart
    MsgBox "Now processing the " & DQ(Wscript.ScriptName) & " script.", vbInformation, scriptBaseName
    End Function
    'Name : PromptEnd -> Prompts when script has completed.
    'Parameters : None ->
    'Return : None ->
    Function PromptEnd
    MsgBox "The " & DQ(Wscript.ScriptName) & " script has completed successfully.", vbInformation, scriptBaseName
    End Function
    'Name : PromptError -> Prompts when an unexpected script error occurs.
    'Parameters : None ->
    'Return : None ->
    'Function PromptEnd
    ' MsgBox "Error " & Err.Number & " (Hex " & Hex(Err.Number) & "). " & Err.Description, vbCritical, scriptBaseName
    'End Function

  • Scripts not Appearing Under "Scripts" in Menu

    I have been going crazy trying to get my custom scripts to appear in the "Scripts" menu item under "File" in Illustrator CS4. I've tried placing them in Presets > Scripts, I've tried creating a folder under "Plug-Ins" called "Scripts" and placing them there, and several other places in an attempt to find anything that will work, but so far nothing has. I've also tried deleting the Illustrator Prefs but that didn't help. Has anybody encountered this problem before?

    I have exactly the same problem.
    For example, one of my scripts is called IA_tile_1.jsx.
    Under my scripting menu I have:
    ExportDocAsFlash
    Flex Skins
    LiveTrace
    SaveDocAsPDF
    SaveDocAsSVG
    Other Script
    After reading the comments here I tried coping it into C:\Program Files\Adobe\Adobe Illustrator CS4\Presets from C:\Program Files\Adobe\Adobe Illustrator CS4\Scripting, but this made no change.
    The other thing I find confusing is Usually when I open a script it defaults to C:\Program Files\Adobe\Adobe Illustrator CS4\Scripting. However sometimes it defaults to C:\Users\windowsdomainname\My Documents. As windows handles this as a library which is a top level windows container, not as a subdirectory of the directory c:\Users\windowsdomainname\ I can't just up two folders and start tracing my way back down the directory tree. I have to wait a while while all my network locations are enumaterated until I can finally select C:\, then navigate down from the root again. Thats kind of a gripe because, from the free scripts for Illustrator I have looked at, very few of them seem to genuinely save time for the user or even perform something that can't be easily done with more control via freehand. You would think with all of this stuffing around it would generally be quicker than just performing the job of the script by hand rather than trying to locate such a deeply nested folder than can't default consistently to the same folder. The only reason I'm perservering here is because Illustrator seems to lack a tool that I honestly thought was kind of the reason you would write a program like Illustrator: for the ability to array items and tile items like a grid. Maybe be able to specify by pixel the location of the object. Well, it turns out Illustrator can't be used like this at all unless you write a custom script to handle it, but then it seems to make you jump lots of hoops to get it to show up in the scripting menu or to get the "other scripts" to consistently default to the same folder.
    So what causes that default script folder to change. Sometimes in a matter of seconds between consequtive runs on a script?
    And how do we get our custom scripts to show up in the scripts menu so we don't have to click "Other Scripts" to begin with?

Maybe you are looking for

  • Adding org.w3c.dom.Node

    Hi, can someone please tell me if it is posible do read a org.w3c.dom.Node from one XML file, and than add it to another? Or is there a way to copy one org.w3c.dom.Node to another XML? Thanx, Alan.

  • Flash global memory keeps setting its self to 0

    flash global memory sets its self to zero for web pages i have visited.  the pages i have visited i want to have memory for them so they can have there flash cookies so the page displays properly and remembers my previous settings.  latest version of

  • Hello, I have an iPod touch, 3rd generation and it's having problems.

    I can only get my music to play in one ear bud, but it only plays in one earbud if it's pushed all the way in, if I pull it out some, it'll continue playing in both. I've tried several different headphones. It's quite frustrating because if I want to

  • Twin 23" monitors or 1 24'?

    I can buy twin 23" ips panel monitors for about $100 more than one 24" ips. Given your preference which would you chose to work with? The 24' is the HP ZR24w The 23" is the NEC EA 231WMi or maybe the Dell U2311H Any advantages to having two monitors

  • ROWID Use in PL/SQL

    Hi, I'm using oracle 9.2.0.3. I have procedures that being called by VB component. The first procedure select fields from table including the ROWID. Then, the component disconnect from the database use the information to process other things. When th