Refreshing script window (or just pulldown list)
I have a dropdown list that is populated with the user's selection. If the user changes their selection I would like to provide a way for them to update the dropdown list to reflect that change.
In my script I currently have a button that will close the window and then rebuild it. This causes the dropdown list to be recreated with the updated selection. It's not an elegant solution but works in CS6 however when I try it in CC the entire application freezes. Any thoughts and advice on how to do this in a better way or to fix my code would be appreciated.
Here is the entire script.
var uiPal;
//my variables
var allLayers = app.project.activeItem.layers;
var userSelection = app.project.activeItem.selectedLayers;
var selectionNames = [];
var dimension = 0;
var axisDir = 0;
for (var j=0; j<userSelection.length; j++) selectionNames[j] = userSelection[j].index + "
" + userSelection[j].name;
selectionNames.push("Average");
var userCollection = new Array();
var num3d = 0;
var tempPos = [];
for (var i=0; i<userSelection.length; i++)
userCollection.push(userSelection[i].position.value[dimension]);
app.endUndoGroup();
function buildPal(theObj){
function buildUI(theObj){
var myPal = (theObj instanceof Panel) ? theObj : new Window("palette", "KeyFrame Ease", undefined, {resizeable:true});
if (myPal != null){
var myResource = "group{orientation:'column',\
groupOne: Group{orientation: 'row',\
myPanelOne: Panel{text:'AXIS', orientation:'row', \
myRadioButtonX: RadioButton{text: 'X', value: true},\
myRadioButtonY: RadioButton{text: 'Y', value: false},\
myRadioButtonZ: RadioButton{text: 'Z', value: false},\
myPanelTwo: Panel{text:'AXIS direction:', orientation:'row', \
myRadioButtonNeg: RadioButton{text: '-', value: false},\
myRadioButtonAnch: RadioButton{text: '', value: true},\
myRadioButtonPos: RadioButton{text: '+', value: false},\
myPanelThree: Panel{text:'Align To:', orientation:'row', \
myDropDownList:DropDownList{properties:{items:" + selectionNames.toSource() + "}}\
myImage: Image{text:'Image', Image:'`/Desktop/skullIcon.jpg'},\
groupTwo: Group{orientation:'row',\
myButton: Button{text:'Apply', preferredSize: [50,25]},\
myButton2: Button{text:'Refresh Selection', preferredSize: [120,25]},\
myButton3: Button{text:'Help', preferredSize: [45,25]},\
myPal.grp = myPal.add(myResource);
myPal.grp.groupOne.myPanelThree.myDropDownList.selection = selectionNames.length -1;
return myPal;
uiPal = buildUI(theObj);
// Event listener for the Axis radio buttons. myRadioButtonAllerts user if not all items selected
uiPal.grp.groupOne.myPanelOne.myRadioButtonX.onClick = uiPal.grp.groupOne.myPanelOne.myRadioButtonY.onClick = uiPal.grp.groupOne.myPanelOne.myRadioButtonZ.onClick = function () {
if(uiPal.grp.groupOne.myPanelOne.myRadioButtonX.value) {
dimension = 0;
else if(uiPal.grp.groupOne.myPanelOne.myRadioButtonY.value) {
dimension = 1;
else if(uiPal.grp.groupOne.myPanelOne.myRadioButtonZ.value) {
for (var j=0; j<userSelection.length; j++)
if (userSelection[j].threeDLayer) num3d++;
if (num3d != userSelection.length){
alert ("Not all selected layers are 3D! Please select only 3d layers for use with Z - Axis.");
uiPal.grp.groupOne.myPanelOne.myRadioButtonX.value = true;
}else{
dimension = 2;
return num3d = 0;
uiPal.grp.groupOne.myPanelTwo.myRadioButtonPos.onClick = uiPal.grp.groupOne.myPanelTwo.myRadioButtonAnch.onClick = uiPal.grp.groupOne.myPanelTwo.myRadioButtonNeg.onClick = function () {
if(uiPal.grp.groupOne.myPanelTwo.myRadioButtonPos.value) {
axisDir = 2;
else if(uiPal.grp.groupOne.myPanelTwo.myRadioButtonAnch.value) {
axisDir = 0;
else if(uiPal.grp.groupOne.myPanelTwo.myRadioButtonNeg.value) {
axisDir = 1;
//change selection dropdown variable after user selection li
var ddListSelection = "Average"
uiPal.grp.groupOne.myPanelThree.myDropDownList.onChange = function () {
ddListSelection = uiPal.grp.groupOne.myPanelThree.myDropDownList.selection
return ddListSelection
//alert (userSelection[ddListSelection.index].position.value[dimension]);
//num = userSelection[ddListSelection.index].position.value[dimension]
//apply alignment
uiPal.grp.groupTwo.myButton.onClick = function() {
app.beginUndoGroup("bt_3d_Align");
//convert dropdown object to text - contains index of selected layer
var ddIndex = ddListSelection.text
if (ddListSelection == "Average" || ddListSelection.text == "Average") {
//create alignToAvg variable and set to average of all numbers
var alignToAvg = 0
for (var i=0; i<userCollection.length; i++)
alignToAvg = alignToAvg + userCollection[i]
alignToAvg = alignToAvg / userCollection.length
for (i=0;i<userSelection.length;i++) {
tempPos = userSelection[i].position.value;
tempPos[dimension] = alignToAvg;
if (userSelection[i].position.isTimeVarying == true) {
userSelection[i].position.setValueAtTime(userSelection[i].time, tempPos);
else {
userSelection[i].position.setValue(tempPos);
else {
var fixPos = allLayers[ddIndex.charAt(0)].position.value[dimension];
for (i=0;i<userSelection.length;i++) {
//create array to hold position value so that it may be changed
var tempPos = userSelection[i].position.value;
//place value of selected layer and dimension in to tempPos array
//if else statments adjusts alignment aka axis direction
if (userSelection[i].nullLayer || userSelection[i].aperture) {
tempPos[dimension] = fixPos
else {
if (dimension == 0 && axisDir == 2) {
tempPos[dimension] = fixPos + ((userSelection[i].sourceRectAtTime(0,true).width / 2) - (allLayers[ddIndex.charAt(0)].sourceRectAtTime(0,true).width / 2));
else if (dimension == 0 && axisDir == 1) {
tempPos[dimension] = fixPos - ((userSelection[i].sourceRectAtTime(0,true).width / 2) - (allLayers[ddIndex.charAt(0)].sourceRectAtTime(0,true).width / 2));
else if (dimension == 1 && axisDir == 2) {
tempPos[dimension] = fixPos + (userSelection[i].sourceRectAtTime(0,true).height / 2 - (allLayers[ddIndex.charAt(0)].sourceRectAtTime(0,true).height / 2));
else if (dimension == 1 && axisDir == 1) {
tempPos[dimension] = fixPos - (userSelection[i].sourceRectAtTime(0,true).height / 2 - (allLayers[ddIndex.charAt(0)].sourceRectAtTime(0,true).height / 2));
else {
tempPos[dimension] = fixPos
//if else to determin if layer has keyframes
if (userSelection[i].position.isTimeVarying == true) {
userSelection[i].position.setValueAtTime(userSelection[i].time, tempPos);
//userSelection[i].position.setValueAtTime(userSelection[i].time, tempPos);
else {
userSelection[i].position.setValue(tempPos);
//adjust position based on
//uiPal.close();
app.endUndoGroup();
uiPal.grp.groupTwo.myButton3.onClick = function() {
w = new Window ("palette", undefined, undefined,);
myPanel = w.add ("panel");
myStaticText = myPanel.add ("statictext", undefined, undefined, {multiline: true});
myStaticText.size = [800, 400];
myStaticText.text = "How to use this script:\n\n1. Before running script make sure that you have a comp open and selected in the timeline. If you do not the script will warn you and you must run the script again.\n\n2. The script populates its dropdown list when first run. If you wish to change the selection of the layers you will be aligning you must press Refresh Selection.\
\n\n3. AXIS - defines the position value you will be aligning your layer items too. That is, will all layers be aligned to the same x, y, or z position.\
\n\n4. AXIS direction defines the which direction the layer will be aligned relative to the reference layer selected in the Align To: drop down. This is analagous to Left/Right justification in print or 2D AE layers.\
\n\n5. Align To: picks which layer will be used as the reference point. ie. If you wish all your selection items to have the same x position as 1_greenSolid then you would set 1_greenSolid as your reference layer.\
\n\n6. Apply runs the alignment.\
\n\n7. If you wish to change the layers that you are aligning then you must push Refresh Selection.\
\n\n8. The Average item in the Align To: dropdown takes all the position values of you selected AXIS and averages them out";
w.show ();
uiPal.grp.groupTwo.myButton2.onClick = function() {
uiPal.close();
allLayers = app.project.activeItem.layers;
userSelection = app.project.activeItem.selectedLayers;
selectionNames = [];
dimension = 0;
axisDir = 0;
for (var j=0; j<userSelection.length; j++) selectionNames[j] = userSelection[j].index + "
" + userSelection[j].name;
selectionNames.push("Average");
userCollection = new Array();
num3d = 0;
tempPos = [];
buildPal(theObj);
if (uiPal != null){
if (uiPal instanceof Window){
// show the palette
uiPal.center();
uiPal.show();
}else{
uiPal.layout.layout(true);
buildPal(this);
Hi, i rewrote your script, trying to keep the same variable names but not everywhere.
It does refresh.
You should remove the first entry of your help, a dockable script shouldnt work that way...
Xavier
(function(theObj){
// "globals"
var uiPal, helpPal, state;
// current state
state = {
dimension : 0,
axisDir : 0,
// userSelection: the last user selection (array of layer objects)
userSelection : [],
// refIndex : the selection index in the dropdown
// if refIndex>= userSelection.length : average
// else the reference layer is userSelection[refIndex]
refIndex : 0,
// UI : help palette;
helpPal = new Window ("palette", "KeyFrame Ease : Help", undefined, {resizeable: true});
helpPal.myPanel = helpPal.add("panel");
helpPal.myPanel.myStaticText = helpPal.myPanel.add("statictext", undefined, undefined, {multiline: true});
helpPal.myPanel.myStaticText.preferredSize = [800, 400];
helpPal.myPanel.myStaticText.text = "How to use this script:\n\n1. Before running script make sure that you have a comp open and selected in the timeline. If you do not the script will warn you and you must run the script again.\n\n2. The script populates its dropdown list when first run. If you wish to change the selection of the layers you will be aligning you must press Refresh Selection.\
\n\n3. AXIS - defines the position value you will be aligning your layer items too. That is, will all layers be aligned to the same x, y, or z position.\
\n\n4. AXIS direction defines the which direction the layer will be aligned relative to the reference layer selected in the Align To: drop down. This is analagous to Left/Right justification in print or 2D AE layers.\
\n\n5. Align To: picks which layer will be used as the reference point. ie. If you wish all your selection items to have the same x position as 1_greenSolid then you would set 1_greenSolid as your reference layer.\
\n\n6. Apply runs the alignment.\
\n\n7. If you wish to change the layers that you are aligning then you must push Refresh Selection.\
\n\n8. The Average item in the Align To: dropdown takes all the position values of you selected AXIS and averages them out";
helpPal.layout.layout(true);
// UI : main
uiPal = (theObj instanceof Panel) ? theObj : new Window("palette", "KeyFrame Ease", undefined, {resizeable:true});
uiPal.grp = uiPal.add("group{orientation:'column',\
groupOne: Group{orientation: 'row',\
myPanelOne: Panel{text:'AXIS', orientation:'row', \
myRadioButtonX: RadioButton{text: 'X', tag: 0, value: true},\
myRadioButtonY: RadioButton{text: 'Y', tag: 1, value: false},\
myRadioButtonZ: RadioButton{text: 'Z', tag: 2, value: false},\
myPanelTwo: Panel{text:'AXIS direction:', orientation:'row', \
myRadioButtonNeg: RadioButton{text: '-', tag: 0, value: false},\
myRadioButtonAnch: RadioButton{text: '', tag: 1, value: true},\
myRadioButtonPos: RadioButton{text: '+', tag: 2, value: false},\
myPanelThree: Panel{text:'Align To:', orientation:'row', \
myDropDownList:DropDownList{properties:{items: ['Average']}}\
myImage: Image{text:'Image', Image:'`/Desktop/skullIcon.jpg'},\
groupTwo: Group{orientation:'row',\
myButton: Button{text:'Apply', preferredSize: [50,25]},\
myButton2: Button{text:'Refresh Selection', preferredSize: [120,25]},\
myButton3: Button{text:'Help', preferredSize: [45,25]},\
// initially: no userSelection, ==> average
uiPal.grp.groupOne.myPanelThree.myDropDownList.selection = 0;
uiPal.grp.groupOne.addEventListener("click", onGroupOneClickEvent);
uiPal.grp.groupOne.myPanelThree.myDropDownList.onChange = onSelectionChange;
uiPal.grp.groupTwo.myButton.onClick = align;
uiPal.grp.groupTwo.myButton2.onClick = refresh;
uiPal.grp.groupTwo.myButton3.onClick = function showHelp(){helpPal.visible ? helpPal.hide() : helpPal.show();};
// update the userSelection straight away:
refresh();
// show the palette
helpPal.onResizing = uiPal.onResizing = function(){this.layout.resize();};
if (uiPal instanceof Window){
// show the palette
uiPal.center();
uiPal.show();
else{
uiPal.layout.layout(true);
//=================
// SCRIPT FUNCTIONS
//=================
// events
function onGroupOneClickEvent(ev){
var b = ev.target;
if (b instanceof RadioButton){
if (b.parent.text === "AXIS") state.dimension = b.tag
else state.axisDir = b.tag;
else if (b instanceof Image){
return;
function onSelectionChange(){
var n = this.selection.index;
state.refIndex = n;
if (n<this.items.length-1 && !Object.isValid(state.userSelection[n])) alert("The reference layer is no longer valid. Refresh !");
return;
// other functions
function refresh(){
var
comp = app.project.activeItem,
dd = uiPal.grp.groupOne.myPanelThree.myDropDownList,
oldIndex = dd.selection.index,
oldText = dd.selection.text,
doAverage = oldIndex===dd.items.legnth-1,
n, N;
if (!(comp instanceof CompItem)) return; // ignore, or display some alert...
state.userSelection = comp.selectedLayers.slice(0).sort(function(a,b){return a.index-b.index;});
N = state.userSelection.length;
// update the dropdownmenu accordingly
// remove items
while (dd.children.length) dd.remove(dd.items[0]);
// add new
for (n=0; n<N; n++) dd.add("item", state.userSelection[n].name);
if (N>0) dd.add("separator");
dd.add("item", "Average");
// restore selection (default = average)
if (doAverage) dd.selection = dd.items.length-1
else{
for (n=0; n<N; n++) if (dd.items[n].text === oldText) {dd.selection = n; break;};
if (n===N) dd.selection = dd.items.length-1;
return;
function checkValidity(){
// subroutine for "align"
// see if the script can align layers
var userSelection = state.userSelection, n, layer;
// no layers
if (userSelection.length<1) return false;
// invalid layers
for (n=0; n<userSelection.length; n++) if (!Object.isValid(userSelection[n])){
alert("Some layers are no longer valid, press refresh !");
return false;
// non 3D layers
if (state.dimension === 2){
for (n=0; n<userSelection.length; n++){
layer = userSelection[n];
if (layer.threeDLayer || layer instanceof CameraLayer || (layer instanceof LightLayer && layer.lightType !== LightType.AMBIENT)){}
else{
alert( layer.lightType === LightType.AMBIENT ? "Can't align ambient lights" : "To align in the Z-direction, all layers should be 3D. Can't continue.");
return false;
// targetting a comp that is not active:
if (comp != app.project.activeItem) return confirm("The script layers belong to a comp that is not active. Continue ?");
return true;
function align(){
// unfold the state object
var
dimension = state.dimension,
axisDir = state.axisDir,
userSelection = state.userSelection,
refIndex = state.refIndex,
doAverage = refIndex>=userSelection.length,
refLayer;
// CHECK VALIDITY: cases of premature exit
if (!checkValidity()) return;
// THE SCRIPT CAN RUN :
app.beginUndoGroup("bt_3d_Align");
// align code there
if (doAverage){
// more code
else{
refLayer = userSelection[refIndex];
// more code
app.endUndoGroup();
return;
return;
})(this);
Similar Messages
-
Migration from windows xp to windows 7 and refresh (reinstall windows 7)
i have created windows xp to windows 7 migration task sequence but not working as expected plaese assit me migration from windows xp to windows 7 and refresh (reinstall windows 7 just reinstall windows 7 with out format so that i can retrieve my documents,
desktop, profiles and Complete C drive with installation application)This question is way too general, sccm ghost. Why is it not working? What is (not) happening? What does smsts.log tell? How are you trying to migrate data?
Torsten Meringer | http://www.mssccmfaq.de -
Since updating to 3.6.1 I don’t get an empty browser window in my tool bar when it opens --- just a list of search engines. I can’t find anything in “Help” or the FAQ’s that seem to address this.
My only choice seems to go back to Safari.I am not sure what your problem is, can you give more details.
One possibility is you may be in full screen mode, for details on fixing that see the [[menu bar is missing]] article.
If you are missing various toolbar items, see the [[back and forward or other toolbar items are missing]] article.
If your problem is something else please give more details. -
Please assist with modifying this script to read in a list of servers and output results to excel
Hello,
I have an excellent script written by Brian Wilhite to gather the last logged in user using Powershell.
http://gallery.technet.microsoft.com/scriptcenter/Get-LastLogon-Determining-283f98ae/view/Discussions#content
My Powershell Fu is stumbling to modify this script to the following requirements:
Currently the script must be loaded first into Powershell, then it can be executed. I would rather edit the script in my Powershell ISE, add the .txt file to the script itself that gives a list of the servers I need to scan. Then when I
press Run Script in my ISE it executes.
I would also like to output the results of the file to excel (.xls or .csv will do). Currently the results look as follows:
Computer : SVR01
User : WILHITE\BRIAN
SID : S-1-5-21-012345678-0123456789-012345678-012345
Time : 9/20/2012 1:07:58 PM
CurrentlyLoggedOn : False
I would prefer it shows up like so:
Computer User SID Time Currently LoggedOn
SVR01 WILHITE\BRIAN S-1xxx 9/20/2012 1:07:58 PM FalseSRV02 WILHITE\BRIAN S-2xxx 9/26/2014 10:00:00 AM True
Any help you can provide would be greatly appreciated. I'll add the full script to the end of this post.
Thank you.
Function Get-LastLogon
<#
.SYNOPSIS
This function will list the last user logged on or logged in.
.DESCRIPTION
This function will list the last user logged on or logged in. It will detect if the user is currently logged on
via WMI or the Registry, depending on what version of Windows is running on the target. There is some "guess" work
to determine what Domain the user truly belongs to if run against Vista NON SP1 and below, since the function
is using the profile name initially to detect the user name. It then compares the profile name and the Security
Entries (ACE-SDDL) to see if they are equal to determine Domain and if the profile is loaded via the Registry.
.PARAMETER ComputerName
A single Computer or an array of computer names. The default is localhost ($env:COMPUTERNAME).
.PARAMETER FilterSID
Filters a single SID from the results. For use if there is a service account commonly used.
.PARAMETER WQLFilter
Default WQLFilter defined for the Win32_UserProfile query, it is best to leave this alone, unless you know what
you are doing.
Default Value = "NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
.EXAMPLE
$Servers = Get-Content "C:\ServerList.txt"
Get-LastLogon -ComputerName $Servers
This example will return the last logon information from all the servers in the C:\ServerList.txt file.
Computer : SVR01
User : WILHITE\BRIAN
SID : S-1-5-21-012345678-0123456789-012345678-012345
Time : 9/20/2012 1:07:58 PM
CurrentlyLoggedOn : False
Computer : SVR02
User : WILIHTE\BRIAN
SID : S-1-5-21-012345678-0123456789-012345678-012345
Time : 9/20/2012 12:46:48 PM
CurrentlyLoggedOn : True
.EXAMPLE
Get-LastLogon -ComputerName svr01, svr02 -FilterSID S-1-5-21-012345678-0123456789-012345678-012345
This example will return the last logon information from all the servers in the C:\ServerList.txt file.
Computer : SVR01
User : WILHITE\ADMIN
SID : S-1-5-21-012345678-0123456789-012345678-543210
Time : 9/20/2012 1:07:58 PM
CurrentlyLoggedOn : False
Computer : SVR02
User : WILIHTE\ADMIN
SID : S-1-5-21-012345678-0123456789-012345678-543210
Time : 9/20/2012 12:46:48 PM
CurrentlyLoggedOn : True
.LINK
http://msdn.microsoft.com/en-us/library/windows/desktop/ee886409(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/system.security.principal.securityidentifier.aspx
.NOTES
Author: Brian C. Wilhite
Email: [email protected]
Date: "09/20/2012"
Updates: Added FilterSID Parameter
Cleaned Up Code, defined fewer variables when creating PSObjects
ToDo: Clean up the UserSID Translation, to continue even if the SID is local
#>
[CmdletBinding()]
param(
[Parameter(Position=0,ValueFromPipeline=$true)]
[Alias("CN","Computer")]
[String[]]$ComputerName="$env:COMPUTERNAME",
[String]$FilterSID,
[String]$WQLFilter="NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
Begin
#Adjusting ErrorActionPreference to stop on all errors
$TempErrAct = $ErrorActionPreference
$ErrorActionPreference = "Stop"
#Exclude Local System, Local Service & Network Service
}#End Begin Script Block
Process
Foreach ($Computer in $ComputerName)
$Computer = $Computer.ToUpper().Trim()
Try
#Querying Windows version to determine how to proceed.
$Win32OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer
$Build = $Win32OS.BuildNumber
#Win32_UserProfile exist on Windows Vista and above
If ($Build -ge 6001)
If ($FilterSID)
$WQLFilter = $WQLFilter + " AND NOT SID = `'$FilterSID`'"
}#End If ($FilterSID)
$Win32User = Get-WmiObject -Class Win32_UserProfile -Filter $WQLFilter -ComputerName $Computer
$LastUser = $Win32User | Sort-Object -Property LastUseTime -Descending | Select-Object -First 1
$Loaded = $LastUser.Loaded
$Script:Time = ([WMI]'').ConvertToDateTime($LastUser.LastUseTime)
#Convert SID to Account for friendly display
$Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($LastUser.SID)
$User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
}#End If ($Build -ge 6001)
If ($Build -le 6000)
If ($Build -eq 2195)
$SysDrv = $Win32OS.SystemDirectory.ToCharArray()[0] + ":"
}#End If ($Build -eq 2195)
Else
$SysDrv = $Win32OS.SystemDrive
}#End Else
$SysDrv = $SysDrv.Replace(":","$")
$Script:ProfLoc = "\\$Computer\$SysDrv\Documents and Settings"
$Profiles = Get-ChildItem -Path $Script:ProfLoc
$Script:NTUserDatLog = $Profiles | ForEach-Object -Process {$_.GetFiles("ntuser.dat.LOG")}
#Function to grab last profile data, used for allowing -FilterSID to function properly.
function GetLastProfData ($InstanceNumber)
$Script:LastProf = ($Script:NTUserDatLog | Sort-Object -Property LastWriteTime -Descending)[$InstanceNumber]
$Script:UserName = $Script:LastProf.DirectoryName.Replace("$Script:ProfLoc","").Trim("\").ToUpper()
$Script:Time = $Script:LastProf.LastAccessTime
#Getting the SID of the user from the file ACE to compare
$Script:Sddl = $Script:LastProf.GetAccessControl().Sddl
$Script:Sddl = $Script:Sddl.split("(") | Select-String -Pattern "[0-9]\)$" | Select-Object -First 1
#Formatting SID, assuming the 6th entry will be the users SID.
$Script:Sddl = $Script:Sddl.ToString().Split(";")[5].Trim(")")
#Convert Account to SID to detect if profile is loaded via the remote registry
$Script:TranSID = New-Object System.Security.Principal.NTAccount($Script:UserName)
$Script:UserSID = $Script:TranSID.Translate([System.Security.Principal.SecurityIdentifier])
}#End function GetLastProfData
GetLastProfData -InstanceNumber 0
#If the FilterSID equals the UserSID, rerun GetLastProfData and select the next instance
If ($Script:UserSID -eq $FilterSID)
GetLastProfData -InstanceNumber 1
}#End If ($Script:UserSID -eq $FilterSID)
#If the detected SID via Sddl matches the UserSID, then connect to the registry to detect currently loggedon.
If ($Script:Sddl -eq $Script:UserSID)
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"Users",$Computer)
$Loaded = $Reg.GetSubKeyNames() -contains $Script:UserSID.Value
#Convert SID to Account for friendly display
$Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($Script:UserSID)
$User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
}#End If ($Script:Sddl -eq $Script:UserSID)
Else
$User = $Script:UserName
$Loaded = "Unknown"
}#End Else
}#End If ($Build -le 6000)
#Creating Custom PSObject For Output
New-Object -TypeName PSObject -Property @{
Computer=$Computer
User=$User
SID=$Script:UserSID
Time=$Script:Time
CurrentlyLoggedOn=$Loaded
} | Select-Object Computer, User, SID, Time, CurrentlyLoggedOn
}#End Try
Catch
If ($_.Exception.Message -Like "*Some or all identity references could not be translated*")
Write-Warning "Unable to Translate $Script:UserSID, try filtering the SID `nby using the -FilterSID parameter."
Write-Warning "It may be that $Script:UserSID is local to $Computer, Unable to translate remote SID"
Else
Write-Warning $_
}#End Catch
}#End Foreach ($Computer in $ComputerName)
}#End Process
End
#Resetting ErrorActionPref
$ErrorActionPreference = $TempErrAct
}#End End
}# End Function Get-LastLogonThis should work:
Get-LastLogon -Computername (Get-content .\Servers.txt) | Export-CSV .\Output.csv -NoTypeInformation
I just tested it on my test domain and it did the trick. -
How to create a pulldown list in numbers
how to create a pulldown list in numbers
Here is it:
Open Applescript editor
Copy the entire script and paste it into Applescript Editor
Compile it
Read the instructions at the top of the script
Run the script, following the instructions.
You can save the script and it will be available in the Scripts menu (on the right side of the menu bar where Time Machine , Airport, and all those icons are).
Copy and paste all of what is below:
-- Script to populate a Numbers pop-up list.
-- Instructions:
-- GUI scripting must be on in System Preferences
-- Create a list of items. Must be a contiguous range of cells in a table.
-- Select the range of cells to use as items in the popup.
-- Run the script.
-- A dialog box will appear asking you to select which cells you want to turn into pop-ups
-- Select the cells then click OK on the dialog box
set tValues to my doThis(1) -- get values of the selection
if tValues is not "" then
activate
display dialog "Select the cells where you want to create the PopUp." & return & "After that, click on the 'OK' button."
my doThis(tValues) -- set the cell format of the new selection to "PopUp Menu" and set the values of the each menu item
tell application "Numbers" to display dialog "Done"
else
tell application "Numbers" to display dialog "You must select the cells in a table before running this script."
end if
on doThis(n)
tell application "Numbers"
set tTables to (tables of sheets of front document whose its selection range is not missing value)
repeat with t in tTables -- t is a list of tables of a sheet
if contents of t is not {} then -- this list is not empty, it's the selected sheet
set activeTable to (get item 1 of t)
if n = 1 then return value of cells of selection range of activeTable -- return values of the selection
set format of (cells of selection range of activeTable) to pop up menu -- set the format to pop up menu
return my setValuePopUp(n) -- set value of each menu item
end if
end repeat
end tell
return ""
end doThis
on setValuePopUp(L)
tell application "System Events"
tell process "Numbers"
set frontmost to true
delay 0.3
set inspectorWindow to missing value
set tWindows to windows whose subrole is "AXFloatingWindow"
repeat with i in tWindows
if exists radio group 1 of i then
set inspectorWindow to i
exit repeat
end if
end repeat
if inspectorWindow is missing value then
keystroke "i" using {option down, command down} -- Show Inspector
else
perform action "AXRaise" of inspectorWindow -- raise the Inspector window to the front
end if
delay 0.3
tell window 1
click radio button 4 of radio group 1 -- the "cell format" tab
delay 0.3
tell group 2 of group 1
set tTable to table 1 of scroll area 1
set tc to count rows of tTable
set lenL to (count L)
if tc < lenL then -- ** add menu items **
repeat until (count rows of tTable) = lenL
click button 1 -- button [+]
end repeat
keystroke return -- validate the default name of the last menu item
else if tc > lenL then -- ** remove menu items **
repeat while exists row (lenL + 1) of tTable
select row (lenL + 1) of tTable
click button 2 -- button [-]
end repeat
end if
tell tTable to repeat with i from 1 to lenL -- ** change value of each menu item **
set value of text field 1 of row i to item i of L
end repeat
end tell
end tell
end tell
end tell
end setValuePopUp -
How to show refreshed modal window(2nd report region window) - reposting
Hi,
I have a requirement where i scroll thru different rows in grid region.
Moment I tab out from first row, I pop up 2nd report, where I show related detailed data lines for the tabed out line of first grid.
So my 2nd window is a report region query, whose 'where' clause contains the primary key from the row of first grid window.
On tab out of a row of first window, I have a javascript function, which shows 2nd report region using:
var mywindow =
window.showModalDialog
('http://MY-URL-/ebus/apexQA111/f?p=&APP_ID.:25:&SESSION.',myObject,'dialogWidth=800px;dialogHeight=300px;dialogLeft:50;dialogTop:50');
Problem:
On First tab out, I get the correct data display on 2nd window, which is related to current tabbed out row.
However, If I tab out from next record, modal window pops up and it still shows my detailed data of first tabbed out row.
Somehow the 2nd window is not getting refreshed/recalculated based on my new tabbed out row. I only have showmodaldialog in my JS function.
Anyway to refresh the window based on new values of the where clause variable? and then showing the window?
Please help!!
Regards,
Ravi.
Edited by: Rave on Nov 26, 2009 6:15 AMHi Rave,
You can refresh any window with the java script below, just make it conditional on the value of an item within your page so that it dose not run every time the page is loaded.
if ($v('P1_MY_ITEM') === 'foo' ) {
window.location.href = document.location.href;
} -
Help please: Refreshing a window
Hello,
I would like to refresh a window so I have
try
tell application "Finder" to update folder "My folder" of desktop
end try
It compiles but does not work, I have to do this:
try
tell application "Finder" to close folder "My folder" of desktop
tell application "Finder" to open folder "My folder" of desktop
end try
That compiles and works, but the opening and closing of "My folder" is obvious to the user.
How could I improve that?
Thanks.
LennoxLennox, you could try using this free shell utility. It has worked just fine for me. Here is the link:
http://osxutils.sourceforge.net/
The man page you want is "/usr/local/bin/wsupdate" if you don't specify a file then the finder windows should be updated. Here is a example of using this shell command.
set Icon_From to choose file with prompt "Choose the file you want to copy the icon from?" without invisibles
set Icon_To to choose file with prompt "Choose the file you want to copy the icon to?" without invisibles
my ReplaceIcon(IconFrom, Icon_To)
on ReplaceIcon(FromFile, To_File)
try
do shell script "/usr/local/bin/seticon" & space & (quoted form of (POSIX path of From_File)) & space & (quoted form of (POSIX path of To_File))
try
do shell script "/usr/local/bin/wsupdate" & space & (quoted form of (POSIX path of To_File))
on error Error_Message
display dialog Error_Message giving up after 2
return false
end try
on error Error_Message
display dialog "Requires osxutils from http://osxutils.sourceforge.net/" giving up after 3
return false
end try
end Replace_Icon -
Hi!
I apologize for how crazy my question sounds,, (& for everything that follows), but I'm at a loss as to the correct wording...I hope my explanation will clarify things, at least enough so that someone understands what I'm trying to say! Wish me luck!
I'm using Firefox 37.0.1 on Windows 8.1 & everything is up to date. The most important details for this problem will be my settings & addons for Firefox, so here goes:
I allow all cookies, but it's set to clear them when Firefox closes.
I do NOT save any history or passwords & I also have "Click & Clean" enabled, & I use it frequently, even though I don't save any history or anything else, just to add to my security/privacy, (guess I didn't use it often enough, huh?)
I have the box checked for "Do Not Track", (but I just learned the hard way that even so-called "nice" companies don't honor this request)
I have "Ghostery" as well as "Google Analytics Opt-out" enabled, (even though I don't use Google for my search engine, nor do I go to a Google site unless it's absolutely necessary, (I read about Google's penchant for following users everywhere in order to get their preferences, so I avoid them if at all possible).
In other words, I thought I was protected from tracking-related problems, but I need to know if these precautions are effective when using Firefox & having several tabs open...then opening another tab/window...are cookies & any other info "readable", (I don't know what word should be used here), from tab to tab in the same window, (which just happened to me), & is the cookie info readable from window to window? In other words, do I have to completely close out Firefox, delete cookies, then open a brand new window so that any session cookie info has been deleted to protect my browsing info from being accessed?
I know, I'm STILL not making much sense...here's what happened, (I won't divulge the site that did the 'cookie abuse', though.
I had several tabs open, as I usually do, because I was gathering info for research on a report I was working on. Suddenly, I remembered I had to order my hubby's birthday gift, so I opened another tab, (in the same window), to my favorite site & started searching for the items I wanted. I found what I was looking for & was getting ready to check out when I noticed something very odd...there were several "suggestions" listed for items I "might be interested in, based on my browsing", but the funny thing was, I didn't search for anything related to these suggested items! Instead, they were related to items in the other tabs I had open. Scary, underhanded stuff, if you ask me! I always knew not to have banking/financial sites open while surfing, but the tabs I had open were from sites where I was getting research info for my report, so no red flags went up when I went to the site to place my order.
So I guess the question I need answered is...is cookie info accessible only between tabs in the same browser window OR is it even accessible from window to window? Did I make sense yet? I sure hope so, because this incident has me absolutely flapping around like a fish that's just been pulled out of the water & is just left on the deck! This obvious assault on my privacy has hit me like a punch in the stomach, because I thought this site was one I could trust...especially since I had "Do Not Track", "Google Analytics Opt-out" & "Ghostery" enabled!
I just don't know how to deal with this, but obviously, I need to know the rules so this NEVER happens again. Luckily, there wasn't any finance-related breach, but my sense of trust has taken a BIG blow.
If this made sense to anyone, please advise me on the rules of 'cookie abuse' so I don't EVER let this happen again!
Also, is cookie info able to be shared between browsers, e.g. use Firefox for more personal/sensitive browsing & Opera for research activity?
Any & all advice is desperately needed & gratefully accepted! I sincerely hope this doesn't happen to anyone else because it really takes the wind out of your trust bubble. I've never been as surprised & disappointed at a company as I am about this. So sad.
Oh well, learn something new every day...too bad I learned not to trust. :(
Thanks in advance for your help.
Nuts4Mutts :(
P.S. If you need anything clarified, just askCookies are stored in a cookie jar and thus are shared among all open tabs and windows.
Only all Private Browsing mode tabs/windows use a separate cookie jar that is used for all PB mode tabs.
Note that session restore stores cookies of open tabs in the sessionstore.js file as part of stored session data.
* http://kb.mozillazine.org/browser.sessionstore.privacy_level -
Script needed to generate a list of paragraph and character styles from the Book Level
Hello,
I am using FrameMaker 11 in the Adobe Technical Communication Suite 4 and I need to find a script that will generate a list
of paragraph and character styles from the book level.
I am working with unstructured FrameMaker books, but will soon be looking at getting a conversion table developed
that will allow me to migrate all my data over to Dita (1.1 for now).
Any thoughts, ideas on this is very much appreciated.
Regards,
JimHi Jim,
I think the problem you are having with getting a response is that you are asking someone to write a script for you. Normally, you would have to pay someone for this, as it is something that folks do for a living.
Nonetheless, I had a few minutes to spare, so I worked up the following script that I believe does the job. It is very slow, clunky, and totally non-elegant, but I think it works. It leverages the book error log mechanism which is built in and accessible by scripts, but is spendidly unattractive. I hope this gives you a starting point. It could be made much more beautiful, of course, but such would take lots more time.
Russ
ListAllFormatsInBook()
function ListAllFormatsInBook()
var doc, path, fmt;
var book = app.ActiveBook;
if(!book.ObjectValid()) book = app.FirstOpenBook;
if(!book.ObjectValid())
alert("No book window is active. Cannot continue.");
return;
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
CallErrorLog(book, 0, 0, "** Book format report for:");
CallErrorLog(book, 0, 0, book.Name);
var comp = book.FirstComponentInBook;
while(comp.ObjectValid())
path = comp.Name;
doc = SimpleOpen (path, false);
if(doc.ObjectValid())
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
CallErrorLog(book, doc, 0, "");
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
CallErrorLog(book, 0, 0, "Paragraph formats:");
fmt = doc.FirstPgfFmtInDoc;
while(fmt.ObjectValid())
CallErrorLog(book, 0, 0, " - " + fmt.Name);
fmt = fmt.NextPgfFmtInDoc;
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
CallErrorLog(book, 0, 0, "Character formats:");
fmt = doc.FirstCharFmtInDoc;
while(fmt.ObjectValid())
CallErrorLog(book, 0, 0, " - " + fmt.Name);
fmt = fmt.NextCharFmtInDoc;
else
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
CallErrorLog(book, 0, 0, "!!! Could not open: " + comp.Name + " !!!");
CallErrorLog(book, 0, 0, "-----------------------------------------------------------");
comp = comp.NextComponentInBook;
function CallErrorLog(book, doc, object, text)
var arg;
arg = "log ";
if(book == null || book == 0 || !book.ObjectValid())
arg += "-b=0 ";
else arg += "-b=" + book.id + " ";
if(doc == null || doc == 0 || !doc.ObjectValid())
arg += "-d=0 ";
else arg += "-d=" + doc.id + " ";
if(object == null || object == 0 || !object.ObjectValid())
arg += "-O=0 ";
else arg += "-O=" + object.id + " ";
arg += "--" + text;
CallClient("BookErrorLog", arg); -
I need help reseting my itunes after I refreshed my windows 7 on my pc. I have my music on my external drive & my ipod. How do I set up again?
This question has to do with how to restore your computer drive if you backed up the computer to an external drive. Did you use backup software or did you just copy the data from the old computer to the new computer? If you just copied, then you need to just copy over the Music folder which should contain the iTunes folder.
-
Refresh classic report based on select list value selected
hello,
can anyone please help me out with this issue. I have a parameterized classic report based on a select list and I want to refresh this report whenever the select list value is changed. I am using oracle apex version 3.2. i just want to have a javascript function onchange event for the select list which refreshes my report whenever a value is selected.
My select list item is p1_datastore
select distinct datastore d,datastore r from my_table1 order by 1;
My classic report query is
select * from my_table2 where datastore = :p1_datastore order by last_updated_dt desc;
****************************************************thanks,
ortoncan anyone please help me out with this issue.
thanks,
orton -
Script for exporting the Delegated List from Exchange 2007
We are Planing to Migrate the Exchange 2007 Mailbox to O365 by Hybrid deployment.
So i would like to generate the List of delegated access rights on Mailboxes, could you help the script for genetating the delegated list.Hello,
Look into get-Help Get-MailboxPermission
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book:
Windows PowerShell 2.0 Bible
My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}}) -
DVDSP 4 - Script window does not appear!
Hi,
since the upgrade from DVDSP3 to DVDSP4 a script can only be created but not be edited: the "Script" window (where one once was able to define a script line) keeps empty. Doubleclick on the standart command "nop" does not have any effect!
DVDSP4 came with the latest Final Cut Studio HD package and is version 4.1.0
The same problem occures on different G5s.
Can anybody help?
thx!!Since the upgrade from DVDSP3 to DVDSP4 a script can only be created but not be edited: the "Script" window (where one once was able to define a script line) keeps empty. Doubleclick on the standart command "nop" does not have any effect!
See if this works
Press F3 Key (to make sure we are on the same screen layout)
Highlight the script in the outline
On the bottom where the track, story script taabs are, click on script tab
The script should have an NOP by default.
Click on the NOP to highlight
In Inspector (to the right) you should be able to use the pulldowns to change the NOPs
Does this work? -
I have a problem with my Scripts Window in Interactive Reporting Studio 9.3.1.0.0.248.
When dual screening I went to resize the window and it snapped to a thin line that is so narrow I can't click on the resize icon to fix it. Does anybody know how to reset the default window size?Have you tried to put IR back into the main monitor and opening the script editor there?
Also, here is an except from a post on ittoolbox
http://businessintelligence.ittoolbox.com/groups/technical-functional/brio-l/scipt-editor-not-opening-properly-874463
"You can fix it by going into the registry editor and modifying the
script editor top, left, bottom, and right values to something
"reasonable", or maybe just delete those values. By doing the latter,
defaults will be used the next time you open the window. The values are
at HKEY_CURRENT_USER\Software\Brio Software\brioqry\EIS."
Wayne Van Sluys
TopDown Consulting -
Scripts have vanished from Scripts window
At work I have CS 3. This morning, I opened the Scripts window to run a script & nothing was there, not even the samples. I opened the relevant folders, and yes, the scripts were there.
Rebooting didn't help.
Could the actual listing of the scripts window must be in some XML file that has been corrupted or deleted?
Thank you.Replace Your Preferences
Maybe you are looking for
-
I received an email from Apple about fifteen minutes ago saying that "per your request" I had downgraded to a free account for iCloud. But I had made no such request! In fact, I had expected Apple to charge me $20.00 for a full 15 GB of storage. A
-
Port_based address Allocation
hi, Can Port_based address Allocation is possible in cisco switch if possible kindly tell the switch model or any cisco / third party software reqiure. pls help......
-
Sending and collecting campaign data back from the third party...
We use a third party to distribute and carry out market research and give back general feedback. When creating marketing campaigns how do we set the communication between CRM and the third-party computer systems. Anyone. Jas
-
[Solved] Xfce : Want to disable save session
Hello everyone. New to Arch. Here's my problem. I want to disable save session feature of Xfce, but unable to do it. I also have tried, 1. Settings manager > Session and startup - Unticking "Automatically save session on logout" 2. Removing session c
-
my java i gone from my Powerbook G4 i only get java error,its an 2004 or 2005 modell.