Run a script on a particular file + user input

Asked by LP81 on 2010-02-01

Hello all,

I am attempting to create a script that I can run on a particular file but I need to gather both file info and user input to complete.

Here is the background on how I currently do this task, then how I want the script to work. I prefer to use my PC for this, but since most of the people here use the Mac environment, I will do it from their perspective.

I click the image, press return to "rename" the file. Since it is OSX 10.6, I have to hit "Apple A" to select the full name and copy the file name. I open a web browser page and input the following info:
file name: <paste> <tab>
business ID: self input <tab>
file name (again): <paste>
Browse for the file being used
Image Alt text: Self input
image dimension: choice of 15 or so standard dimensions in a pull down menu
click save

Copy the info given back to me by the system, paste it into an email and sent it off.

How I envision this script:
Click on the image I need uploaded.
The script will pop up asking me to input the Business ID and Alt text and store this info for later.
The script will then copy the file name, get info on the file, look for the Dimensions Attribute, and store that information.
Open the Web interface, paste in the File name, paste in the Business ID, Paste the file name again, click the browse button and find the image in question, paste in the Alt text, and find the appropriate Size choice in the drop down menu.

I suppose the main questions should be:
Can I have the script run off of a drag and drop feature or on whatever file I currently have selected
Can I have a user input field that stores info for later use.

I can probabaly figure out all the other steps when I tinker, but I want to know if it is worth my time to try and develop this anyway...


Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
LP81 (pjbreen) said : #1

I have figured out how to use the User Input as stored values, however I am still struggling to make other aspects work. I am trying to limit the number of fields the user has to type in to 2 if possible. The Business ID and the Alt Text.

Phat W. (cp-gphone) said : #2

You said that you would prefer your PC for this task so I will provide you a possible solution. As you did not state where the picture is coming from I can only assume that it is from a general location. Write a batch file that navigates to that location and then prompts for the image name. When provided it then write the full path of the image to a text file. Now the batch file should prompt for Business ID and Alt Text. This information will be put on new lines in that same text file. After the last of your information is entered into that text document have the batch file run a Sikuli script via the command line interface. Your script should then navigate to the web browser and select the field that you need to fill in first. Now set it to open the text file information and select the first line (hint: try to use the keyboard commands for this part. You know where the cursor will be when you switch to each application so you can keep track of where sikuli is going.) Copy and paste the information into the desired dialogs and finish your script. As far as getting the appropriate size settings, you should be able to generate another text file that will contain the information.

You could eliminate the text file step if it is possible to pass variables into a Sikuli script at runtime. I have not looked into this feature but you bet I will be later today. I hope this helps!

LP81 (pjbreen) said : #3

Unfortunately my system somehow decided it was out of memory and crashed Sikuli and the file became corrupt so I have to start from scratch again.

Anyway, as much as I'd like to do this all on PC, the 2 other people that will be using it it on Mac OSX 10.6 so I need to keep them in mind.

My main concern is still being able to run the script on a selected file (drag and drop or adding to the shell pop up)

I am trying to find round about ways to capture the file dimensions and file name, but that is another story...

RaiMan (raimund-hocke) said : #4

Can you help with this problem?

Provide an answer of your own, or ask LP81 for more information if necessary.

To post a message you must log in.