topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 8:40 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA : script which popup browse dialog and generate shortcut  (Read 18572 times)

Coldiffusion

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 11
    • View Profile
    • Donate to Member
What I'm looking is pretty simple (I think)

A vbs (propably) which pop up the user a browse dialog like this


the user choose a folder, and it generate a shortcut (on his desktop) and add the choosen folder's path to the shortcut

Example :

c:\app\app.exe path of the folder*.jpg path of the folder /someparameter /someparameter

Parameters in blue never change, they are the same for all shortcut created, only the red change

(I would also like to be able to specify an icon for the generated shortcut, but it's absolutely not a priority ^^)





Thanks !
« Last Edit: August 21, 2008, 05:41 AM by Coldiffusion »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #1 on: August 21, 2008, 07:02 AM »
i have something similar for creating shortcuts to the folders instead. maybe i can adapt the script for you but can you give a working example? it'll be easier for me to create ini file items for the static parameters.

ws-choose-n-create-1.png

Coldiffusion

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #2 on: August 21, 2008, 07:32 AM »
first, thanks for the fast reply !

I intend to use the shortcut to execute Aid4mail (software used to convert mails) on multiples computers.

so a shortcut could look like this :

c:\aid4mail\a4m.exe c:\archive\*.msf c:\archive /pst /s

(in this example the user used the browse dialog and selected c:\archive)





lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #3 on: August 21, 2008, 10:13 AM »
ok, try Choose_n_Create.

usage:
when you run the program for the first time, it will prompt you to fill out the INI file. which i guess is self-explanatory. it should be something like in the screenshot. the value 'PromptAfterCreate' is to show the properties of the shortcut (after being created) so that you can modify the icon.

ws-Choose_n_Create-new_ver001.png

btw, if you have Autohotkey, you can download the source as well. do let me know if it doesn't work as you wanted. :)

---o---
edit: have added the new INI entries (see screenshot). rename or delete the old ini file before running the new version. let me know if i missed anything. :)

edit2: two more values to further customize the output.
• ShortcutName - to make the shortcuts unique, i still suffix them with the folder name.
• NoTrayMenu - no tray icon shown and this will also make the script auto-exit after the shortcut is created.

:)
« Last Edit: August 22, 2008, 09:46 AM by lanux128 »

Coldiffusion

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #4 on: August 21, 2008, 04:56 PM »
ok, it's working great !

however 2 things I would like to change :

First the text in the browse dialog : "select a folder that is to be processed. Note: A shortcut will be created on the Desktop"


(yes I'm french ;D)

I tried to change it in the ahk but with no success, I think I have to edit "choose_n_create.exe"


Second thing, the icon of the shortcut :

As I dont want the user to be asked to choose the icon of the created shortcut, I'm trying to change the icon of the console exe of Aid4Mail, "a4m.exe" (which dont have any icon) so the shortcut will have the icon I choosed for a4m.exe

The problem is that I couln't be able to change a4m.exe's icon with "Exe Icon Changer" (a soft that seems to be the solution), but I'm almost sure there are plenty other softs which would be able to do it

Of course the best would be to tell choose_n_create to use a specific icon (in the .ini for example) but I don't know if it's possible, you tell me  :P


lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #5 on: August 21, 2008, 10:22 PM »
First the text in the browse dialog : "select a folder that is to be processed. Note: A shortcut will be created on the Desktop"
...
(yes I'm french ;D)
hehe, i based the script from your earlier screenshot. no worries i'll add an ini entry for you so that you can alter text into French. :)

Second thing, the icon of the shortcut :

As I dont want the user to be asked to choose the icon of the created shortcut, I'm trying to change the icon of the console exe of Aid4Mail, "a4m.exe" (which dont have any icon) so the shortcut will have the icon I choosed for a4m.exe
i didn't know that a4m.exe is a console program. i was thinking of something else then when i put prompt on create thing. :) i guess an ini entry will do the trick here as well. will update the above in a while.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #6 on: August 21, 2008, 11:26 PM »
ok, i've added the new INI entries. rename or delete the old ini file before running the new version. btw, you can also specify the icon number for DLL or EXE files. :)

Coldiffusion

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #7 on: August 22, 2008, 12:41 AM »
2 last things and it will be perfect !

Add a line in the ini to choose the name of generated shortcut (this "Process '%getNameNoExt%' Folder.lnk"
Remove (or hide ?) the choose_n_create icon tray (if it's possible)


Btw thanks again for your fabulous quick job !

when my friend talk me about donationcoder, I couldn't imagine this community was this fast answering problems that would took me days or weeks  :P

Merci !  :-*



lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #8 on: August 22, 2008, 02:54 AM »
Add a line in the ini to choose the name of generated shortcut (this "Process '%getNameNoExt%' Folder.lnk"
Remove (or hide ?) the choose_n_create icon tray (if it's possible)
hehe.. i knew you'd want to change that very English shortcut name. ;) so here's another two values for you to modify.

ShortcutName - to make the shortcuts unique, i still suffix them with the folder name. let me know if you have other preferences.
NoTrayMenu - no tray icon shown and this will also make the script auto-exit after the shortcut is created.


when my friend talk me about donationcoder, I couldn't imagine this community was this fast answering problems that would took me days or weeks
yes, you just gotta love this place. :)

Coldiffusion

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #9 on: August 22, 2008, 03:29 AM »
almost almost perfect !  :tellme:

after choosing the folder, a dialog popup with the shortcut name



A way to avoid that ?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #10 on: August 22, 2008, 08:00 AM »
hehe.. that's the debug msgbox that i must have overlooked. it's removed now. :)

Coldiffusion

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #11 on: August 22, 2008, 09:20 AM »
You even corrected the little bug with "Foood_Bulb.ico" ^^

that's just perfect, exactly what I was looking for.

thanks you  :-*

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA : script which popup browse dialog and generate shortcut
« Reply #12 on: August 22, 2008, 09:50 AM »
You even corrected the little bug with "Foood_Bulb.ico" ^^

hmm.. you give me an idea to remove any calls to external resource outright. so i modified a bit more, in case anyone uses the tray option. please get the updated version. :)