Script w/relative path that sends absolute path to a folder to theclipboard?

  • Thread starter StargateFanNotAtHome@mailinator.com
  • Start date
Status
Not open for further replies.
S

StargateFanNotAtHome@mailinator.com

I carry around my Outlook files with me on my USB flash drive, these

include the outcmd.dat and VbaProject.OTM, etc. I was hoping to

emulate the following type of script (done up in a freeware language

called AutoIt, for those not familiar with the syntax) that gives an

example of one of the paths of Outlook that is easily sent to the

clipboard no matter what computer I am or what the user profile

directory happens to be on the host computer:

ClipPut(@UserProfileDir & "\Application Data\Microsoft\Stationery")

[@UserProfileDir is a poweful tool to use in this language since you

get results with it no matter what.]

I was wondering what the above could be translated into vb so that I

can create other scripts based on that translation, using it as an

example ... ? Can this even be done in vb?

I have these types of AutoIt scripts outside of Outlook and other

office programs and use them all the time but would actually prefer to

have the 3 or so that I use strictly for Outlook saved within the

Outlook OTM scripts file itself and attached to buttons on the

interface. It just would make everything a couple of steps easier

since I would then have immediate access to the information as it'd be

a button click away right there.

Thanks!
 
S

StargateFanNotAtHome@mailinator.com

Re: Script w/relative path that sends absolute path to a folder tothe clipboard?

Actually, I just realized that the above could be made even more

efficient if instead of going to the clipboard, the folder itself was

opened. D'uh, that would save even more time since all I'd do with

the clipboard information anyway is to plug it into the address bar of

windows explorer. I keep thinking that vb capabilities in Outlook

don't include windows general scripting needs but that could be way

off.

In AutoIt, to open up a folder with a relative path, this is the

syntax, in an effort to illustrate the type of scripting in vb that

would be ideal to achieve:

ShellExecute(@UserProfileDir & "\Application Data\Microsoft

\Stationery", "", "", "open", @SW_MAXIMIZE)

Sorry, hope I didn't confuse the issue but it only occurred to me

several minutes after posting the initial message in this thread.

Both types of syntax would be great, clipboard and opening a folder;

it's just that the end result is to open an Outlook folder from within

Outlook off of a button with a vb script attached that doesn't have an

absolute path. That's all I have at present but have found all these

years of using this system that it's a pain to have to keep modifying

the paths every new place I go to! Half the time I forget and it's a

pain in the ... <g
Anyway, thanks. Crossing my fingers that this can be done then I need

ever again have to update those paths!!! Wow, that would be really

neat.

Cheers! :eek:D
 
S

StargateFan

Re: Script w/relative path that sends absolute path to a folder to the clipboard?

On Fri, 20 Mar 2009 06:51:08 -0700 (PDT),

StargateFanNotAtHome@mailinator.com wrote:

[snip]


> In AutoIt, to open up a folder with a relative path, this is the
> syntax, in an effort to illustrate the type of scripting in vb that
> would be ideal to achieve:

> ShellExecute(@UserProfileDir & "\Application Data\Microsoft
> \Stationery", "", "", "open", @SW_MAXIMIZE)


[snip]

Can something like this be done in Outlook, pls?
 
K

Ken Slovak - [MVP - Outlook]

Re: Script w/relative path that sends absolute path to a folder to the clipboard?

Nothing to do with Outlook code.

Using Win32 API calls code would look like this:

Public Declare Function SHGetFolderPath Lib "shfolder.dll" _

Alias "SHGetFolderPathA" (ByVal hwndOwner As Long, ByVal nFolder As Long,

_

ByVal hToken As Long, ByVal dwReserved As Long, ByVal lpszPath As String)

As Long

retVal = SHGetFolderPath(0&, CSIDL_LOCAL_APPDATA Or CSIDL_FLAG_CREATE, _

0&, SHGFP_TYPE_CURRENT, strLocalSettings)

But you can't use Win32 API calls from VBScript code.

Using VBS there isn't a way that I know of to get to <appData> directly.

What you can do is to use the registry functions in Windows Scripting to

read a registry location that should point to <appData>.

The location to look at is

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell

Folders\AppData. That has a string value pointing to <appData>, you can take

that and append "\Microsoft\Stationery" to it.

The Windows scripting method to use would be WshShell.RegRead, something

like this:

Dim WshShell

Dim appDataPath

Dim strPath

strPath = _

"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell

Folders\AppData"

Set WshShell = CreateObject("WScript.Shell")

appDataPath = WshShell.RegRead(strPath)

appDataPath = appDataPath & "\Microsoft\Stationery"

"StargateFan" <IDon'tAcceptSpam@NoJunkMail.com> wrote in message

news:k5kgs4ldvlm96qbigtk42g6eg1u72jm9h0@4ax.com...
> On Fri, 20 Mar 2009 06:51:08 -0700 (PDT),
> StargateFanNotAtHome@mailinator.com wrote:

> [snip]
>
> >In AutoIt, to open up a folder with a relative path, this is the
> >syntax, in an effort to illustrate the type of scripting in vb that
> >would be ideal to achieve:
>

>
>
>>ShellExecute(@UserProfileDir & "\Application Data\Microsoft
> >\Stationery", "", "", "open", @SW_MAXIMIZE)


> [snip]

> Can something like this be done in Outlook, pls?
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
G print attachment straight away; working script edit not working Outlook VBA and Custom Forms 0
G Save attachment run a script rule Outlook VBA and Custom Forms 0
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
G Script does not exist Outlook VBA and Custom Forms 0
G Trigger script without restaring outlook Outlook VBA and Custom Forms 7
A VBA Script - Print Date between first email in Category X and last email in Category Y Outlook VBA and Custom Forms 3
L Modifying VBA script to delay running macro Outlook VBA and Custom Forms 3
L Need help modifying a VBA script for emails stuck in Outbox Outlook VBA and Custom Forms 6
L VB script only runs manually Outlook VBA and Custom Forms 5
E Having some trouble with a run-a-script rule (moving mail based on file type) Outlook VBA and Custom Forms 5
D.Moore VB script to Digitaly Sign newly created outlook message Outlook VBA and Custom Forms 2
Aussie Rules Run a Script on an Incoming Email OK and then the Email reverts Outlook VBA and Custom Forms 0
D.Moore VBA script fail after Office 365 update Using Outlook 8
M Outlook 2013 Script Assistance - Save Opened Link with Subject Added Outlook VBA and Custom Forms 1
F Script for zip file attachment Outlook VBA and Custom Forms 1
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
Y Outlook 2013 Run A Script Outlook VBA and Custom Forms 4
Z Script to set account? Using Outlook 0
dweller Outlook 2010 Rule Ignores VBA Script Outlook VBA and Custom Forms 2
N VBA Script to Open highlighted e-mail and Edit Message Outlook VBA and Custom Forms 5
B Outlook rule run a Script doesn't work Outlook VBA and Custom Forms 1
J Calling a Public sub-routine from the script editor via VB script Outlook VBA and Custom Forms 4
K Outlook Archive to PST Files by Date Range VBA Script? Outlook VBA and Custom Forms 1
Peter H Williams Enable script containing VBA Outlook VBA and Custom Forms 12
H VB script in outlook form doesn't work anymore Outlook VBA and Custom Forms 2
A Script to fetch data from mails in restricted collection and sending them to excel Using Outlook 1
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
Bri the Tech Guy Registry Tweak to make "Run a Script" Action Available Outlook VBA and Custom Forms 2
V VB script code to save a specific email attachment from a given email Outlook VBA and Custom Forms 14
Bri the Tech Guy Run Script rule not running for newly arriving messages Outlook VBA and Custom Forms 25
M Subject Line Automation - Trigger Script Delayed Outlook VBA and Custom Forms 2
Q Script to create a pst file for Archiving Using Outlook 1
Vijay Error in rule- Run a script Using Outlook 1
R VBA Script Quick Parts Using Outlook 1
Vijay Run script doesn't work in outlook Using Outlook 1
Q VBA Script to move item in secondary mailbox Outlook VBA and Custom Forms 2
Diane Poremsky Run a Script Rule: Send a New Message when a Message Arrives Using Outlook 2
F Avoid sending duplicate using Outlook script Outlook VBA and Custom Forms 2
oliv- How to Run a Script IN AN ADDIN with Outlook's Rules and Alerts Outlook VBA and Custom Forms 2
L Run a Script Rule doesn't work Using Outlook 5
N Outlook script to forward emails based on senders' address Outlook VBA and Custom Forms 2
S using script rule to save attachments on arrival Outlook 2010 Outlook VBA and Custom Forms 9
X Outlook script to run excel data Outlook VBA and Custom Forms 1
N VBA Script to Send Automatic Emails from Outlook 2010 Outlook VBA and Custom Forms 1
Davzell Change default pop3 account with script, prf or registery ? Outlook VBA and Custom Forms 0
D RUN SCRIPT WHEN OUTLOOK IS CLOSE Outlook VBA and Custom Forms 1
L Cannot run script from rule Outlook VBA and Custom Forms 7
O modify vba to run it as script rule Outlook VBA and Custom Forms 8
D Script to parse email and set a task Outlook VBA and Custom Forms 1
L Moving Message Class email via script and Rule Outlook VBA and Custom Forms 3

Similar threads

Top