Useful for:
People who sell products through spreadshirt. You may have to change this script a bit if you are not using their German website.
What it does:
Changes name and keywords of products that have been added to the market together with a new design.
What you need:
- OS X, Safari, AppleScript Editor
Preparations:
- Copy the following code to AppleScript editor and save to /SnowLeopard/Users/username/Library/Scripts/ Name it anyway you want. Code:
-- For the absolut noobs: Two Hyphens are used to disable a line in the script. So most of the time the text behind them
-- is an explanation for the following section. But they are also used to disable optional lines, or settings. So you can simply
-- activate these by removing the Hyphens. Be aware that sometimes there are more lines in the script that are necessary for
-- one function. So read through the whole script if you want to enable, or disable any function.
-- needed if you want to change name of all open products
display dialog "Enter Name" default answer "" buttons {"Cancel", "OK"} default button 2
copy the result as list to {ProductName, button_pressed}
-- needed if you want to change the keywords of all open products
display dialog "Enter Keywords" default answer "" buttons {"Cancel", "OK"} default button 2
copy the result as list to {Keywords, button_pressed}
-- If you also want to change the description of all open products remove hyphens of next two lines
-- display dialog "Enter description" default answer "" buttons {"Cancel", "OK"} default button 2
-- copy the result as list to {Description_Entered, button_pressed}
-- don't delete
display dialog "How many products are open in tabs" default answer "1" buttons {"Cancel", "OK"} default button 2
copy the result as list to {NumberOfProducts, button_pressed}
-- this is just a warning. If you know what you're doing, you can delete this section
display dialog "Make sure that:
1. You don't have anything selected
2. Only the products that you want to change are open
3. Not less products open than you entered in the dialog before" buttons {"Cancel", "OK"} default button 2
-- opens safari, repeats following as often as entered in dialog earlier
tell application "Safari"
activate
end tell
repeat NumberOfProducts as number times
-- needed if you want to change names (sets clipboard to name entered earlier)
tell application "Finder" to set the clipboard to ProductName as string
delay 1
--don't delete (tabs to textfield with name)
tell application "System Events"
keystroke tab
keystroke tab
keystroke tab
delay 0.5
-- needed if you want to change names (pastes name from clipboard)
keystroke "v" using command down
end tell
-- If you also want to change the description of all open products remove hyphens of next two lines
-- tell application "Finder" to set the clipboard to Description_Entered as string
-- delay 1
-- don't delete (tabs to next textfield)
delay 1
tell application "System Events"
keystroke tab
-- If you also want to change the description of all open products remove hyphens of next two lines
-- keystroke "a" using command down
-- keystroke "v" using command down
end tell
-- needed if you want to change keywords (sets clipboard to Keywords entered earlier)
tell application "Finder"
set the clipboard to Keywords as string
end tell
-- don't delete (tabs to next textfield)
tell application "System Events"
keystroke tab
keystroke tab
keystroke tab
keystroke tab
delay 0.5
-- needed if you want to change keywords
keystroke "a" using command down
keystroke "v" using command down
-- don't delete (saves changes and switches to next tab
keystroke tab
keystroke tab
delay 0.5
keystroke return
if NumberOfProducts > 1 then
delay 1
key down command
key down shift
key code 124
key up command
key up shift
delay 1
end if
end tell
end repeat
- Activate script menu in menu bar, or save it as a service and assign a keyboard shortcut Mini How To's
- If you did not do so yet, go to your Spreadshirt account and create products with your new design.
- Publish your design on the market and choose which products to publish with it (up to 100).
- Switch to your products page, select market, set filter to the name of your design and open all products (or as much as your mac can handle) in new tabs (holding down command key while clicking). Count them.
- Switch to tab with the first product Do not click any textfield, or menu on the site!
- Trigger it by shortcut or menu.
- Enter a name for the products (probably the name of the design), click OK. The dialogs will only show up once, so all products will have the same name and same keywords!
- Enter keywords, click OK
- Enter number of products that are opened in tabs and are being changed.
- Ckick OK one last time and watch your computer doing the work for you.
- If you only want to change keywords, but have individual names for each product, or if you want to change the description, just read the script carefully. Every section is explained a bit so you just have to do what it says in the script.
- Of course, you can also save the script as an Application to anywhere you want and start it from there.
No comments:
Post a Comment