Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

Go / Open social medias with a gui/form

Hello experts,


I have the following AutoHotkey script that should allows me to go to 4 social medias:


;====================================
;Gui: Run Facebook, Instagram, TikTok and YouTube applications
;====================================


#!s::
Facebook:="https://www.instagram.com/"
Instagram:="https://www.facebook.com/"
TikTok:="https://www.tiktok.com/"
YouTube:="https://www.youtube.com"


AppSocialMediaTitle:="Run Social media application"
If (WinExist(AppSocialMediaTitle))
{
  Gui,+OwnDialogs
  MsgBox,4144,Warning,%SocialMedia% dialog is already opened
  Return
}
GuiWidth:=300 ;Gui Width
GuiHeight:=180 ;Gui Height
Gui,New,,%SocialMedia%
Gui,Font,s10 w200 cblack,Arial ;s=>size, w=>bold of font, c=>Color can also be RGB value,Type=>Font Type
Gui,Add,Text,xm,Select SocialMedia apps options:
Gui,Add,Radio,Checked vAppsSocialMediaOption xm,&Outlook
Gui,Add,Radio,y+15,&Facebook
Gui,Add,Radio,y+15,&Instagram
Gui,Add,Radio,y+15,&TikTok
Gui,Add,Button,xm gButtonSendAppsSocialMediaOK Default,&OK ;Button Ok
Gui,Add,Button,x+10 gButtonSendAppsSocialMediaCancel,&Cancel ;Button Cancel
Gui,Show,w%GuiWidth% h%GuiHeight%
Return


ButtonSendSocialMediaOK:
Gui,Submit
Gui,Destroy


Switch AppsSocialMediaOption
{
  Case 1:
  AppSocialMedia:=Facebook
  
  Case 2:
  AppSocialMedia:=Instagram


  Case 3:
  AppSocialMedia:=TikTok
  
  Case 4:
  AppSocialMedia:=YouTube
}


If (FileExist(AppSocialMedia))
  Run,%AppSocialMedia%
Else
  MsgBox,4112,Error,Social Media app exists on this system
Return


ButtonSendAppsSocialMediaCancel:
Gui,Destroy
Return

Open in new window

I don't understand why is not working.

Thank you in advance for your help.


Best,

Luis Diaz.

Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

For starters, follow the error messages that you get and fix the problems. For example, running the script exactly as you posted it gives this:

User generated image
That makes it crystal clear what the problem is, namely, the Gui,Add,Button statement has the label ButtonSendAppsSocialMediaOK, but the actual label in your code is ButtonSendSocialMediaOK. After fixing that, the dialog appears with Outlook checked, which is obviously wrong, as you meant to have YouTube there.

There are other problems that jump out, which you should be able to find by testing the script. For example:

(1) The variable SocialMedia is never assigned a value. You probably want AppSocialMediaTitle there.

(2) The Switch values (1-4) don't match up correctly with the platforms.

(3) The Facebook and Instagram assignment statements are reversed.

(4) The FileExist function does not work on a URL. It is intended for files/folders.

Luis, I could fix all this for you and get the script working, but I'd like you to make some progress on your own. It seems to me that you didn't test/debug this thoroughly before posting. Please do that and then post when you get to any really difficult problem that you can't solve after thorough testing. I'll be happy to help you then. Regards, Joe
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Luis Diaz

ASKER

Hi Joe,

Please find attached my answer related to your last message/advice.

Regards,
Luis.
Social-media-gui-form_20230101_01264.mp4
Sorry to hear about your accident but very glad to hear that you are fully recovered.

One problem with your script is that you still have the #!s:: hotkey in there (line 13). Delete it. There may be other problems, but I can't see the whole script in your video. Also, the new <^>!+ù:: hotkey needs to work...I don't know if it does on your system. I guarantee that the script I posted works.

Thank you for the 2023 wishes...much appreciated...and same to you! Regards, Joe
Thank you Joe your script works perfectly!
Following link of this video proves that:
https://drive.google.com/file/d/1cZErKsRJLvTkSgV0Lb1NQf4Zk2Zd2qgn/view?usp=sharing

Best,
Luis.
Hi Luis,
I'm very glad to hear that the script works perfectly. Btw, I am not able to access the video in your comment above (I am able to access the one in your other question...the one in this post). Regards, Joe
Hello Joe,

I have just share the video with you.

Could you please confirm that you have access now?

Best,
Luis.
Yes, I have access now...and it is a great video! Very nice to see the script in action and working well. Happy New Year! Regards, Joe
Excellent Joe! Happy new year for you too! All the best for this new year!
Regards,
Luis.
Hello Joe,

Sorry to contact you again but I am having issues with GUI-form go to social medias.

The video attached explain what I am having as issue.

If you can help me, I will appreciate the action a lot.

Regards,
Luis.
Go-to-social-medias-issue-Luis-Diaz_.mp4
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Joe,

Sorry for the delay but I had a lot of meetings today. Thank you for the advice. It works perfectly now!

Regards,
Luis.
Great news!