Please help me to acheive the following using VBScript
1.Messagebox with three tabs Copy,Update,Cancel and displaying "Welcome to the AVG
definition fies copier/updater module.Click on Copy to copy files or Update to update
definition files.
2.If copy selected,the drive letter from where the script is run(usb drive) stored as
variable,directory "(usb drive)Update" created if not exist,new and files not existing
in update folder copied to(eg=xcopy /d), from
"%allusersprofile%\applic~1\avg8\update\download"
3.If possible display message 'copying files, while copying.After completion of
copying display 'Files copied successfully'.
4.If update selected,tdirectory "c:\Update" created if not exist,new and files not
existing in "c:\Update" copied to, from (usb drive) update folder
5.If possible display message 'Updating files' while copying.After completion of
updating, display 'Files Updated successfully'.After clicking OK exit and start
"C:\progra~1\avg\avg8\avgui.exe"
Well, the way that I would do it is to make stand alone functions for each of the functional tasks that you have then wrap those functions inside an HTA to give you the interface layer that you want.
As I understand from your other question, you managed to find solutions to most of these tasks yourself. Here's a tip for your #2, which I haven't noticed implemented in that your script.
2.If copy selected,the drive letter from where the script is run(usb drive) stored as variable
You can retrieve the full path of the current script file using the WScript.ScriptFullName property and then use the FileSystemObject.GetDriveName method to extract the drive letter:
Set objFSO = CreateObject("Scripting.FileSystemObject")
strUSBDrive = objFSO.GetDriveName(WScript.ScriptFullName)
This will give you the drive letter followed by a colon (e.g. J:). You can then concatenate this value with the target folder name to get the full path, e.g.:
MsgBox strUSBDrive & "\Update"
Related
Every day, I get up to 25 real estate photoshoots from a photographer, edit them, and export them into their respective realtors' folder in Dropbox. I get each shoot from the photographer in a folder named with its respective address/location. Currently, after editing each shoot, I look at the foldername (the address/location), go to the Calendar app, find which event has that location, see who the respective realtor is, navigate to their personal folder or create it if it doesn't exist, and then export the photoshoot into their folder (the realtor's name). Every. Single. Time.
I'm trying to automate this process by simply exporting all the shoots into one folder, triggering an Automator Folder Action which sorts the shoots into their respective realtor's folder, based on the foldername.
The relationship between the source folders and destination folders is determined based on location data from a Calendar Event. I've already figured out how to pull the data from Calendar, but getting Automator to move the folders around using the data has me thoroughly stumped.
I've tried several things in Automator, and I'm sure there's a simple way using Applescript but I haven't learned enough about Applescript to make it work. I've tried copy/pasting bits of Applescript code from other posts but I've finally thrown my hands up and decided to ask the experts lol. Here are some screenshots to help illustrate the issue.
Folders full of pictures "Test"(Sources):
"Realtors" Folder (Destinations)
Here is the Automator Workflow I've created so far, which pulls the address (Source foldername) and realtor names (Destination foldername [with other junk to be removed]) from Calendar event data, and creates 2 txt files (shown in the screenshot after this one):
Text files created by above workflow:
It's possible that I'm overcomplicating this horribly, but the solution that comes to mind is this: The text files correlate based on line number, i.e. line 1 of "Today's Locations.txt" (Location: 326 Whiterock Dr) corresponds with line 1 of "Today's Shoots.txt" (Summary: Photos for Remy Locasio).
When I drop these folders into the trigger folder, "Test" in this case, Automator/Applescript could search the "Today's Locations.txt" file for "326 Whiterock Dr" and say, "Hey, that's on line 1. I'm gonna go into "Today's Shoots.txt",find line 1, parse out (Summary: Photos for ), take the realtor's name only (Remy Locasio) and move the input folder ("326 Whiterock Dr") into the realtor's folder with that name ("Remy Locasio"), then do it again for the next folder and it's corresponding documents' line, etc etc, until all the folders are moved.
Before the realtor's name is typically the word "for ". Whether it's Photos for , Photos and videos for , Photos and aerial photos for etc. so "for " could be a delimiter maybe?
Sometimes, after the realtor's name, there's a note, always separated by a " (", eg. Brandi Smith (text when on the way), so " (" could be another delimiter maybe?
Sometimes the realtor's name is spelled wrong in the calendar but not in the folder, as is the case with Brandi vs Brandy Smith on line 9. There would need to be a popup in this case asking for the correct folder. Something to the effect of "Could not find a folder called "Brandi Smith". Should we create it or choose another folder? and I'd choose the correct folder, or in the case of "Megan Forsberg" (line 8) who doesn't have a folder yet, allow it to create the folder.
I've racked my brain for a week trying to do this with Automator and variables and I'm at a complete loss, any help would be a godsend. I'll gladly clarify anything that doesn't make sense or answer any questions anyone has.
I can't understand the whole problem clearly but you can use below code in the applescript for the regex part.
set a to "Photos for Karie Williams (Zonker)"
set b to do shell script "str='" & a & "';sed 's/(.*//g' <<< $str"
set c to do shell script "inp='" & b & "';sed 's/.*\\(for \\)//' <<< $inp"
display dialog c
I have a folder that has around 400 subfolders each with ONE .jpeg file in them. I need to get all the pictures into 1 new folder using SSIS, everything is on my local (no connecting through different servers or DBs) just subfolders to one folder so that I can pull out those images without going one by one into each subfolder.
I would create 3 variables, all of type String. CurrentFile, FolderBase, FolderOutput.
FolderBase is going to be where we start searching i.e. C:\ssisdata
FolderOutput is where we are going to move any .jpg files that we find rooted under FolderBase.
Use a Foreach File Enumerator (sample How to import text files with the same name and schema but different directories into database?) configured to process subfolders looking for *.jpg. Map the first element on the Variable tab to be our CurrentFile. Map the Enumerator to start in FolderBase. For extra flexibility, create an additional variable to hold the file mask *.jpg.
Run the package. It should quickly zip through all the folders finding and doing nothing.
Drag and drop a file system task into the Foreach Enumerator. Make it a Move file (or maybe it's rename) type. Use a Variable source and destination. The Source will be CurrentFile and the destination will be FolderOutput
Im not scripting alot so i think this is total beginner stuff so
i have following problem, i want to move (like cut-out and paste) a folder ,that always starts with the same string but never have the same ending, to another folder.
Im working on a Windows Server that runs a Batch. The Batch is copying different Backup-Files to a Directory with a timestamp. This works fine because all the other Files and diretorys that i need to move have static names.
But im running into a problem with a folder/directory that has a dynamic name. The Folder starts always with the GUID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx} of the Application, so the start fo the directory name is static. But at the end, the Application is adding a underline _ followed by random charaters so the directory looks like following f.E. :
{11111111-1111-1111-1111-11111111111}_ehgwuh238th
This is how my other files with the static names are handled so far:
if exist %path%\%fullstamp% move %path%\Test %path%\%fullstamp%
path contains the path to the directory that includes the files that need to be moved.
fullstamp contains a timestamp which were used to create a new directory at the beginning of the batch.
I tried something like:
move %path%\Test* %path%\%fullstamp%
move %path%\Test*. %path%\%fullstamp%
move %path%\Test*\ %path%\%fullstamp%
But none of these worked out
So like i said probably not a big deal but i still need to ask.
To summarize it:
the directory that always starts/contains with the same string need to be moved to another directoy.
Some directoy names f.E.
Test_31tß0t30
Test_3tggwqgrgwrg
Test_ksmrh82ra
Thank you in advance and sorry for my bad english.
The move command seems to not accept wildcards for source directories, so you will need a for /D loop to resolve the path first:
for /D %%I in ("%ROOT%\Test*") do move "%%~I" "%ROOT%\%fullstamp%"
I also quoted both source and destination paths in order to avoid trouble with whitespaces or other special characters.
The fact that you use a variable %path% makes me think you set it to the root path of your operation, but PATH is a reserved variable used by the system to find executables, so you should not (over-)write it. That is why I used another variable name ROOT in my code suggestion.
I have (after FOREVER) figured out how to copy a test set folder from one location to another and rename it using a explicit folder id. Now, I want to rename the new folder right after pasting, so the id will NOT be known. I have found absolutely NOTHING on how I can do this.
I'm trying my hardest to use the online resource for OTA, but it's really unhelpful unless you already know the language. I can't seem to find what I need, so please don't suggest that.
Thanks in advance. Currently very frustrated and ready to throw out my computer.
Here's what I have to copy, paste, and rename a specific node by id
Set qcConnection = QCutil.QCConnection
copiedTestSet = qcConnection.TestSetTreeManager.CopyToClipboard(3)
QCConnection.TestSetFactory.PasteFromClipboard copiedTestSet,6,2,1
Set renameTest = qcconnection.TestSetTreeManager.NodeByID(30)
print renameTest.Name
renameTest.Name = "Rename Test"
renameTest.Post
Set renameTest = Nothing
Set copiedTestSet = Nothing
You will know the folder name of the pasted folder, because it should be same as the copied folder, you can simple search for the pasted folder with name under the parent folder.
Below page have few functions which can help you
https://github.com/sumeet-kushwah/ALM_OTA_Wrapper/blob/master/ALM_Wrapper/TestLabFolders.cs
There are three functions you should search for
FindChildFolderByName
FindChildFolders
GetTestSetFolder
I was able to find what I needed using sumeet's suggestion above. My exact code is below using variables because I need to be able to run this with any folder. It runs right after the paste command above. I had to insert a wait after pasting for some reason, but it works for now. I'll trouble shoot that later
Set renameTest = qcconnection.TestSetTreeManager.NodeByPath(strPath & "\" & strEventFolder)
I'm trying to run a batch file that exists in one folder, from a batch file in another folder:
Parent folder Big containes 2 folders BatchFolder and Medium.
BatchFolder contains a batch file called Batch1.
Medium contains another folder called Small.
Small contains a batch file called Batch2 that needs to run Batch1.
The command prompt is run from the location of Batch2
Therefor, how do I navigate up the folders To Big, and then navigate into the BatchFolder?
I've been trying alsorts to achieve this with no success, such as Bacth2 containing the following "call ../BatchFolder/Batch1.bat"
I'm not sure whether you really need to navigate to the required folder (i.e. set it as the current one) or you simply need a way to call the batch script in that folder using a relative path notation. Navigating, from how I understand the term, means the former, but your last sentence seem to show that you need the latter.
First, the answer:
call %~dp0%..\..\BatchFolder\Batch1.bat
Next, what it means. %~dp0% is a variation of %0: the latter is the full path to this batch file (i.e. Batch2.bat) including the file name, and the former is the full path to this batch's folder (including the trailing \).
.. points to the immediate parent folder. It is repeated twice because we need to access the 'grand-parent' of the Batch2.bat's folder, and the grand-parent is Big. Once we are pointing to Big, we can address the files/folders in it, in this case it's BatchFolder that we need, and eventually we can put the name of Batch1.bat.
This works regardless of what the current folder is. That is, in case I wasn't clear on that head, by simply calling a batch file you are not yet changing the current folder. You would have to use the CD command for that. That would be navigating (but I'm still open to being corrected as to my understanding of this term).