Sign in to follow this  
Followers 0
RogerRabbitsClone

Shellexecute with variable in document name

8 posts in this topic

hello again autoiters.

ok, what im trying to make this do is read the clipboard, (it will always be reading a number) and insert that number into the name of the file im trying to open with shellexecute.

$numbercheck = ClipGet ()
$templatedir = "\\Bserver\dtp\AA - Use this for sample\UC BUS CARD\"
ShellExecute("BC - UCB - $numbercheck.indd", "", $templateDir, "edit")

the files are called

BC - UCB - 1.indd

BC - UCB - 2.indd etc, up to 10

it didnt say anything about this in the online docs, is this possible?


<--a good way to start you day

Share this post


Link to post
Share on other sites



You just didn't assemble the string correctly. The variable needs to be outside the quotes:

"BC - UCB - " & $numbercheck & ".indd"

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

psaltyDS, your a frikkin genius. but its still not working. i double checked the location and the formating of the file name (where the spaces are).

can shellexecute open InDesign files?

can shellexecute open from a local server?

this is the error message i get

"Windows cannot find 'BC - UCB - 6.indd'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search."

nevermind, im a moron. i was using this:

ShellExecute("BC - UCB - " & $numbercheck & ".indd")

instead of this:

ShellExecute("BC - UCB - " & $numbercheck & ".indd", "", $templatedir)

thanks guys

Edited by RogerRabbitsClone

<--a good way to start you day

Share this post


Link to post
Share on other sites

It's looking in the script folder for the files. Is that where they are located? If not you need the full path to the file in ShellExecute()


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Additional Tip:

you may have to execute your indd files like this:

Local $indd = ("path To Indd file") 
ShellExecute('Indesign.exe', $indd)

basically opening indesign first and the opening the file you want.

I had this problem with PDF files...

Edited by billo

Share this post


Link to post
Share on other sites

Additional Tip:

you may have to execute your indd files like this:

Local $indd = ("path To Indd file") 
ShellExecute('Indesign.exe', $indd)

basically opening indesign first and the opening the file you want.

I had this problem with PDF files...

That happens when there is no file association created for a file type.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

actually i did get it to work

ShellExecute("BC - UCB - " & $numbercheck & ".indd", "", $templatedir)


<--a good way to start you day

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0