Jump to content

Label 'shortcut'/hyperlink


 Share

Recommended Posts

Hey guys, 

So im wanting to have a main spreadsheet where i keep my filepaths so that i can update that spreadsheet rather than changing code however, when i try to do this... it opens the master spreadsheet(graphdata.xlsm) instead of reading the cell and opening the actual link.

$Label1 = GUICtrlCreateLabel("Test", 216, 168, 25, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$oExcel = _ExcelBookOpen("Q:\Documents\Load Support\Tom\Projects\Dashboard\" & "graphdata.xlsm", 0, True)
$PMTest = _ExcelReadCell($oExcel, 40, 2)
_ExcelBookClose($oExcel,0,0)
$ASIALINK = "\\fbnecl3\inzb\Documents\14-15 FCGP CONTRACTING\14-15 Product Masters\Asia and Arabia\"

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         case $label1
            Run("explorer.exe " & "\\fbnecl3\inzb\Documents\14-15 FCGP CONTRACTING\14-15 Product Masters\Asia and Arabia\" & $PMTest)

    EndSwitch
WEnd

I have also tried;

run("explorer.exe " & $asialink & $pmtest)

also tried using excel instead of explorer, no luck!

Edited by 13lack13lade
Link to comment
Share on other sites

Use an INI file, it's a lot easier to deal with than a spreadsheet.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

only used excel as thats the only way ive done it so far, not sure how to use do it with an ini file.. guess ill go do some more googling :D

Didnt work, dont think im doing this right... so my ini file contains this

[ASIA]
$china = "fbnecl3inzbDocuments14-15 FCGP CONTRACTING14-15 Product MastersAsia and ArabiaChina Product Master 14-15.xlsx"
 
and i have coded my autoit script from how ive interpreted the help file... what have i done wrong? :(
$Label1 = GUICtrlCreateLabel("Test", 216, 168, 25, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$ChinaLnk = IniRead("Q:\Documents\Load Support\Tom\Projects\Dashboard\ProductMasterLinks.ini","[ASIA]","$china","")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         case $label1
            FileOpen($chinalnk)

    EndSwitch
WEnd
Edited by 13lack13lade
Link to comment
Share on other sites

remove the square brackets from the section name:

incorrect:

$ChinaLnk = IniRead("Q:DocumentsLoad SupportTomProjectsDashboardProductMasterLinks.ini","[ASIA]","$china","")

correct:

$ChinaLnk = IniRead("Q:DocumentsLoad SupportTomProjectsDashboardProductMasterLinks.ini","ASIA","$china","")

and yes, ini is better then Excel in your case.

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Hey guys, gave it another shot.. still couldnt get it to work

is this the correct way to use it?

$ChinaLnk = IniRead("Q:DocumentsLoad SupportTomProjectsDashboardProductMasterLinks.ini","ASIA","$china","")
$OpChinaLnk = FileOpen($chinalnk)
 
So then i would simply call $OpChinaLnk to open the file? im trying to use the links in things like this : and changing the link itself to values in the ini file.. cant get it to work though! :(
$AUSPMBSC = _GuiCtrlHyperLink_Create("Brisbane Sunshine Coast" , 200, 200, 122, 17, 0x0000FF, 0x551A8B, -1 , 'Q:\Documents\14-15 FCGP CONTRACTING\14-15 Product Masters\Australia\Brisbane Sunshine Coast Product Master 14-15.xlsx',"Brisbane Sunshine Coast 14-15 Product Master", $DLScreen)
_GUICtrlHyperLink_SetData($AUSPMBSC,2,'Q:\Documents\14-15 FCGP CONTRACTING\14-15 Product Masters\Australia\Brisbane Sunshine Coast Product Master 14-15.xlsx')
GUICtrlSetTip($AUSPMBSC,"Brisbane Sunshine Coast 14-15 Product Master")
Link to comment
Share on other sites

Please post a runnable script and an example of what you'd like the ini file to contain so we can at least attempt to see what it is you're doing.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Will create an example script soon, just finishing off a GUI atm...

All i am wanting is an inifile to save all my file paths so that if a file changes name for example, i can just open the inifile and change the name in the file path so the script will continue to work wihtout having me re-code it again because ive used exact strings

e.g if 1 = 1 then

but i would rather

if A = 1 then.

Where A = link to ini file, inwhich in the ini file reads A = value. which i can just change in notepad :)

 

BTW is an moderator able to change the topic title to Using an Ini File for stored data? or something like that... i just realised the title has nothing to do with the topic, other than 'short cut' lol

Edited by 13lack13lade
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...